/* Editorial archive mobile safety override: Blogs, History, Poetry and Trending */
@media (max-width: 44rem) {
  .editorial-library-page { max-width:100%; overflow-x:hidden; }
  .editorial-library-page .editorial-library-grid,
  .editorial-library-page .books-library-grid.editorial-library-grid {
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:.72rem!important;
    width:100%!important;
    max-width:100%!important;
  }
  .editorial-library-page .editorial-card-v2 {
    display:grid!important;
    grid-template-columns:8rem minmax(0,1fr)!important;
    height:auto!important;
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    overflow:hidden!important;
  }
  .editorial-library-page .editorial-card-v2 .story-card-v2-media {
    width:100%!important;
    height:100%!important;
    min-height:8.5rem!important;
    aspect-ratio:auto!important;
  }
  .editorial-library-page .editorial-card-v2 .story-card-v2-body {
    min-width:0!important;
    padding:.62rem!important;
  }
  .editorial-library-page .editorial-card-v2 h3 {
    font-size:.82rem!important;
    line-height:1.18!important;
  }
  .editorial-library-page .editorial-card-v2 .story-card-v2-body>p {
    font-size:.55rem!important;
    -webkit-line-clamp:2!important;
  }
  .editorial-library-page .editorial-card-v2 footer {
    align-items:flex-start!important;
    flex-direction:column!important;
    gap:.2rem!important;
  }
}
@media (max-width: 24rem) {
  .editorial-library-page .editorial-card-v2 {
    grid-template-columns:6.9rem minmax(0,1fr)!important;
  }
}
@media (max-width: 44rem) {
  body.blogs-archive-page .header-search-mobile,
  body.history-archive-page .header-search-mobile,
  body.poetry-archive-page .header-search-mobile,
  body.trending-archive-page .header-search-mobile {
    width:100%!important;
    max-width:100%!important;
    padding:0 .7rem .65rem!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  body.blogs-archive-page .header-search-mobile .site-search,
  body.history-archive-page .header-search-mobile .site-search,
  body.poetry-archive-page .header-search-mobile .site-search,
  body.trending-archive-page .header-search-mobile .site-search {
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  body.blogs-archive-page .header-search-mobile .site-search button,
  body.history-archive-page .header-search-mobile .site-search button,
  body.poetry-archive-page .header-search-mobile .site-search button,
  body.trending-archive-page .header-search-mobile .site-search button {
    flex:0 0 auto!important;
    padding-inline:.65rem!important;
  }
}
@media (max-width: 44rem) {
  .editorial-library-page .archive-empty {
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    padding:1rem!important;
  }
  .editorial-library-page .archive-empty h2 {
    margin:0!important;
    max-width:100%!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
    font-size:1rem!important;
    line-height:1.3!important;
  }
}
@media (max-width: 44rem) {
  body.blogs-archive-page .site-header,
  body.history-archive-page .site-header,
  body.poetry-archive-page .site-header,
  body.trending-archive-page .site-header,
  body.blogs-archive-page .header-main,
  body.history-archive-page .header-main,
  body.poetry-archive-page .header-main,
  body.trending-archive-page .header-main {
    min-height:0!important;
  }
  body.blogs-archive-page .header-main-inner,
  body.history-archive-page .header-main-inner,
  body.poetry-archive-page .header-main-inner,
  body.trending-archive-page .header-main-inner {
    min-height:3.85rem!important;
    padding:.45rem .75rem!important;
  }
  body.blogs-archive-page .site-brand,
  body.history-archive-page .site-brand,
  body.poetry-archive-page .site-brand,
  body.trending-archive-page .site-brand {
    min-width:0!important;
    max-width:calc(100% - 3.25rem)!important;
  }
  body.blogs-archive-page .brand-logo-picture--mobile,
  body.history-archive-page .brand-logo-picture--mobile,
  body.poetry-archive-page .brand-logo-picture--mobile,
  body.trending-archive-page .brand-logo-picture--mobile {
    width:min(12.5rem,72vw)!important;
  }
}


/* Trending mobile: keep archive inside viewport */
@media (max-width: 44rem) {
  body.trending-archive-page .books-library-shell,
  body.trending-archive-page .books-library-layout,
  body.trending-archive-page .books-library-main,
  body.trending-archive-page .books-library-toolbar,
  body.trending-archive-page .archive-controls {
    width:100%!important; max-width:100%!important; min-width:0!important; box-sizing:border-box!important;
  }
  body.trending-archive-page .archive-filter-fields {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:100%!important; max-width:100%!important;
  }
  body.trending-archive-page .editorial-library-grid { grid-template-columns:1fr!important; min-width:0!important; }
  body.trending-archive-page .editorial-card-v2 { width:100%!important; max-width:100%!important; min-width:0!important; }
  body.trending-archive-page .editorial-card-v2 .story-card-v2-body { min-width:0!important; overflow:hidden!important; }
  body.trending-archive-page .editorial-card-v2 h3,
  body.trending-archive-page .editorial-card-v2 h3 a,
  body.trending-archive-page .editorial-card-v2 .story-card-v2-body>p {
    max-width:100%!important; white-space:normal!important; overflow-wrap:anywhere!important;
  }
}

/* Trending mobile: hard viewport containment */
@media (max-width: 44rem) {
  body.trending-archive-page,
  body.trending-archive-page .page-container,
  body.trending-archive-page .books-library-page {
    width:100vw!important; max-width:100vw!important; overflow-x:hidden!important;
  }
  body.trending-archive-page .books-library-shell {
    width:calc(100vw - .75rem)!important;
    max-width:calc(100vw - .75rem)!important;
    margin-inline:auto!important;
  }
  body.trending-archive-page .editorial-card-v2 {
    grid-template-columns:7.2rem minmax(0,1fr)!important;
    box-sizing:border-box!important;
  }
  body.trending-archive-page .editorial-card-v2 .story-card-v2-body,
  body.trending-archive-page .editorial-card-v2 h3,
  body.trending-archive-page .editorial-card-v2 h3 a,
  body.trending-archive-page .editorial-card-v2 p {
    min-width:0!important; max-width:100%!important; overflow-wrap:anywhere!important;
  }
}

/* ZTRG collapse unfilled Google Auto Ads without hiding filled inventory. */
.google-auto-placed:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display:none!important;
  width:0!important;
  height:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  overflow:hidden!important;
}
ins.adsbygoogle[data-ad-status="unfilled"] {
  display:none!important;
  width:0!important;
  height:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
}

/* Mobile archives: suppress only the oversized Auto Ads placement injected directly between header and content. */
@media (max-width: 767px) {
  body.ew-page-family-content .site-shell > header.site-header + .google-auto-placed {
    display:none!important;
    width:0!important;
    height:0!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
  }
}
/* EW 2026-10-30: isolated archive-card proportions. Mobile only.
   Deliberately leave homepage, header, footer, books grid, search, and
   desktop rules alone. This block replaces the rejected broad staging patch.
   All media dimensions are fixed to avoid stretched photos or blank columns. */
@media (max-width: 44rem) {
  /* Existing archive-layout-final.css hides this control later in its cascade. */
  body.ew-page-family-content .books-library-page .archive-view-area {
    display: flex !important;
  }

  /* Stories GRID: real portrait art rather than a landscape strip. */
  body.ew-page-family-content .books-library-page
  .stories-library-grid:not(.archive-list) > .story-card-v2 {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0;
  }
  body.ew-page-family-content .books-library-page
  .stories-library-grid:not(.archive-list) .story-card-v2-media {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 3 / 4 !important;
    overflow: hidden;
  }
  body.ew-page-family-content .books-library-page
  .stories-library-grid:not(.archive-list) .story-card-v2-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Stories LIST: horizontal card with a compact non-stretched thumbnail. */
  body.ew-page-family-content .books-library-page
  .stories-library-grid.archive-list > .story-card-v2 {
    display: grid !important;
    grid-template-columns: minmax(6rem, 30%) minmax(0, 1fr) !important;
    height: auto !important;
  }
  body.ew-page-family-content .books-library-page
  .stories-library-grid.archive-list .story-card-v2-media {
    width: 100% !important;
    max-width: 100% !important;
    height: 7.2rem !important;
    min-height: 7.2rem !important;
    max-height: 7.2rem !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden;
  }
  body.ew-page-family-content .books-library-page
  .stories-library-grid.archive-list .story-card-v2-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Keep archive rows content-sized; the legacy 1fr row sizing created
     large empty areas under short editorial summaries on phones. */
  body.ew-page-family-content .books-library-page
  .editorial-library-grid {
    grid-auto-rows: auto !important;
    align-items: start !important;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid > .editorial-card-v2 {
    align-self: start !important;
    min-height: 0 !important;
    grid-template-rows: auto !important;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid .story-card-v2-body {
    height: auto !important;
    flex: 0 1 auto !important;
  }

  /* Blogs / History / Philosophy / Poetry / Trending: short square media,
     not an image stretched to the full height of the accompanying text. */
  body.ew-page-family-content .books-library-page
  .editorial-library-grid > .editorial-card-v2 {
    display: grid !important;
    grid-template-columns: 7.2rem minmax(0, 1fr) !important;
    align-items: start !important;
    height: auto !important;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid .editorial-card-v2 .story-card-v2-media {
    width: 100%;
    height: 7.2rem !important;
    min-height: 7.2rem !important;
    max-height: 7.2rem !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden;
    align-self: start !important;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid .editorial-card-v2 .story-card-v2-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid .editorial-card-v2 .story-card-v2-body {
    min-width: 0;
    align-self: start !important;
    justify-content: flex-start !important;
  }
}
@media (max-width: 24rem) {
  body.ew-page-family-content .books-library-page
  .editorial-library-grid > .editorial-card-v2 {
    grid-template-columns: 6.5rem minmax(0, 1fr) !important;
  }
  body.ew-page-family-content .books-library-page
  .editorial-library-grid .editorial-card-v2 .story-card-v2-media {
    height: 6.5rem !important;
    min-height: 6.5rem !important;
    max-height: 6.5rem !important;
  }
}