/* v23: every page ends at the footer. No trailing empty dark/olive
   band on iPad (portrait or landscape), iPhone, or desktop.
   WebKit treats overflow-x:hidden/clip + overflow-y:visible as
   overflow-y:auto, which creates a second scroller and a blank gap
   past the footer. Always set both axes together. */

html{
  height:auto!important;
  min-height:0!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
}
body{
  display:flex!important;
  flex-direction:column!important;
  min-height:100svh!important;
  height:auto!important;
  max-height:none!important;
  margin-bottom:0!important;
  padding-bottom:0!important;
  overflow:visible!important;
}
main,
main.magazine{
  flex:1 0 auto!important;
  margin-bottom:0!important;
}
main.magazine{
  overflow-x:hidden!important;
  overflow-y:clip!important;
}

/* Short pages: keep the footer at the bottom of the viewport
   rather than leaving an empty band beneath it. */
footer,
footer.fhs-footer{
  flex:0 0 auto!important;
  margin-top:auto!important;
  margin-bottom:0!important;
  position:relative!important;
  z-index:3!important;
}

/* Clip sticky 100svh backdrops to their section so they cannot
   paint a leftover olive field below the footer. */
.bgs,
.bgs .seg{
  /* clip does not make a scroll container, so sticky backdrops still work */
  overflow:clip!important;
}
article.page:not(.cover-page),
.page.photo-page{
  overflow-x:clip;
  overflow-y:clip;
}

/* Prefer the small viewport so iPad toolbars do not inflate sticky
   backgrounds past the visible page. 100svh already used as the
   second declaration in existing rules; this covers leftovers. */
.bgs .seg .bgp{
  max-height:calc(100svh - var(--fh-header-height, 0px));
}

/* v24: iPad portrait (~810–820 CSS px) was still a cramped 3-column
   footer, because the 2-column break lived at 760px. Branding goes
   full width; the two link columns sit side by side. Phone stays
   a single column. */
@media (max-width:920px){
  html body footer.fhs-footer .fhs-foot{
    grid-template-columns:1fr 1fr!important;
    gap:24px 32px!important;
  }
  html body footer.fhs-footer .fhs-foot>div:first-child{
    grid-column:1/-1!important;
  }
}
/* iPhone 14/15/16 Plus and Pro Max are 430 CSS px wide; keep a single column. */
@media (max-width:480px){
  html body footer.fhs-footer .fhs-foot{
    grid-template-columns:1fr!important;
  }
  html body footer.fhs-footer .fhs-foot>div:first-child{
    grid-column:auto!important;
  }
}

/* Keep footer text clear of the fixed music button (do not move the button).
   Higher specificity so this still wins when fh-sections-v24 loads later. */
html body footer.fhs-footer{
  padding-right:max(clamp(22px,5vw,64px), 72px)!important;
}

/* Keep headings from breaking mid-token or mid-phrase when they wrap to two lines.
   Higher specificity than magazine .page-body>*{overflow-wrap:anywhere}. */
html body h1,html body h2,html body h3,html body h4,html body h5,html body h6,
html body .page-body>h1,html body .page-body>h2,html body .page-body>h3,
html body .page-body>h4,html body .page-body>h5,html body .page-body>h6{
  text-wrap:balance;
  hyphens:none;
  -webkit-hyphens:none;
  overflow-wrap:normal;
  word-break:normal;
}
.fh-nowrap{white-space:nowrap!important}

/* Shrink a heading only when a nowrap phrase would overflow the column.
   --fh-fit is 100cqi * (font-size / phrase-width) for the longest unit. */
.fh-fit-host{container-type:inline-size}
html body .fh-fit-host>h2,
html body.fh-connect-page .page .fh-fit-host>h2{
  font-size:min(clamp(40px,6vw,76px),var(--fh-fit,10cqi));
}

/* Folio titles: don't hyphenate or mid-word wrap.
   Left side may shrink and wrap; the right side keeps nowrap phrase units. */
html body .folio>span{
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
  -webkit-hyphens:none;
}
html body .folio>span:first-child{min-width:0}
html body .folio>span:last-child{min-width:min-content;flex:0 1 auto}
