/* ==========================================================================
   Multi-Hyphenate — ABOUT.

   Ported from mocks/console.html?state=about. What used to be three scrolling
   chapters is now ONE page inside the fixed frame (see css/frame.css): the
   portrait on the right, the name at the shared display size, and the bio in a
   single column at a real measure.

   LAYOUT LAW, inherited from the mock:
   1. The page is one frame bounded below by the rail.
   2. Nothing that carries content is position:absolute.
   3. Exactly one row is flexible, and that row is the designated scroll
      region. A fixed frame may never become a trap: if the bio genuinely
      cannot fit, it scrolls — visibly, with a fade and a cue — rather than
      ending in silence.
   ========================================================================== */

/* Hidden means hidden. Any rule that sets `display` on a block would otherwise
   silently beat the UA [hidden] rule. */
body.page-about [hidden] { display: none !important; }

/* base.css pins .noscript-nav with `inset: 0 0 auto` and chrome.css re-anchors
   it to the bottom without ever releasing `top`, so top:0 and bottom:0 are both
   in force: with JavaScript off the nav stretches the full viewport and eats
   every click on the page. Released here, because chrome.css is not this
   page's to edit. */
body.page-about .noscript-nav { top: auto; }

/* --------------------------------------------------------------- the frame */

body.page-about .mh-frame {
  /* THE TYPE SCALE. Every page title on the site shares --fs-display. */
  --fs-display: clamp(2.1rem, 4.5cqw, 3.4rem);
  --fs-sub: 1.35rem;
  --fs-lead: 1rem;
  --fs-body: 0.9rem;
  --fs-meta: 0.8rem;
  --fs-micro: 0.75rem;

  /* one measure for every prose block: 62–68 characters */
  --measure: 34rem;

  --accent: var(--coral, #e87945);
  --accent-hot: var(--mh-nav-accent, #ef5c32);
}

/* The content region is a two-row grid: the wordmark, then the page. */
body.page-about .mh-frame-content {
  display: grid;
  grid-template-rows: min-content minmax(0, 1fr);
  gap: clamp(0.75rem, 2.4svh, 1.5rem);
  align-content: stretch;
}

/* The persistent wordmark, in the corner on every inner route. */
.mh-page-mark {
  display: block;
  width: clamp(6.6rem, 9cqw, 9rem);
  line-height: 0;
}

.mh-page-mark img {
  width: 100%;
  height: auto;
}

/* -------------------------------------------------------------------- type */

/* Five page titles, one display size. Deliberately NOT huge: the name is a
   credit, not a billboard. */
.mh-page-title {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 680;
  font-stretch: 92%;
  font-variation-settings: "wdth" 92, "wght" 680;
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.mh-page-title span { display: block; }

.mh-credit-line {
  margin: 0;
  color: #f2ad63;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mh-credit-line span { color: rgb(244 236 223 / 0.62); }

/* The accent has one job: it is the hyphen. js/hyphens.js wraps the joining
   hyphens in Writer-Producer-Director; this is what it wraps them in. */
.mh-hy {
  color: var(--accent);
  font-style: normal;
  padding-inline: 0.02em;
}

/* ------------------------------------------------- the scroll region + cue */

/* The bio is the one flexible row. When it fits, nothing announces itself.
   When it does not, the region says so: a fade at the lower edge and a cue
   under it. js/console-pages.js measures and adds .can-scroll / .has-more. */
.mh-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgb(232 121 69 / 0.8) rgb(244 236 223 / 0.09);
}

.mh-scroll.can-scroll {
  scrollbar-gutter: stable;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 46px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 46px), transparent 100%);
}

/* At the bottom there is nothing left to promise. */
.mh-scroll.can-scroll.at-end {
  -webkit-mask-image: none;
  mask-image: none;
}

/* Chrome's overlay scrollbars are invisible at rest, and an invisible
   scrollbar inside a frame that otherwise never scrolls reads as "this is all
   there is". Make it a classic, always-visible bar. */
.mh-scroll::-webkit-scrollbar { width: 9px; }
.mh-scroll::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: rgb(232 121 69 / 0.8);
}
.mh-scroll::-webkit-scrollbar-track { background: rgb(244 236 223 / 0.09); }

.mh-more {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.has-more > .mh-more { display: flex; }

/* --------------------------------------------------------------- the page */

/* One row, and it is the flexible one. Without an explicit track the implicit
   row is sized to max-content — which is the whole bio — and the page spills
   past the rail instead of handing the overflow to the scroll region below. */
/* The bio column is sized to its MEASURE, not to `1fr`. As `1fr` it swallowed
   every spare pixel while the text stayed at ~68 characters, so on a wide
   display the copy and the portrait drifted a third of a screen apart with
   nothing between them. Sized to the measure and centred as a pair, they stay
   together at any width. */
.mh-about {
  display: grid;
  grid-template-columns: minmax(0, 38rem) clamp(13rem, 26cqw, 21rem);
  grid-template-rows: min-content minmax(0, 1fr);
  gap: clamp(0.7rem, 1.6cqh, 1.2rem);
  column-gap: clamp(1.5rem, 3cqw, 2.75rem);
  justify-content: center;
  align-items: stretch;
  min-height: 0;
}

/* The bio column runs the full height beside the portrait. */
.mh-about-copy {
  grid-column: 1;
  grid-row: 1 / -1;
}

/* The headshot is the hero image and it sits on the RIGHT. */
.mh-portrait {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  margin: 0;
}

/* The coda takes the space below the portrait. */
/* Sits directly under the portrait. The caption used to occupy this gap; with
   it gone the coda closes up rather than leaving a hole where a line of type
   used to be. */
.mh-coda {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  max-width: 34ch;
  margin: 0;
  padding-top: clamp(0.55rem, 1.2cqh, 1rem);
  border-top: 1px solid rgb(244 236 223 / 0.16);
}

.mh-coda p {
  margin: 0;
  color: rgb(244 236 223 / 0.78);
  font-size: var(--fs-small, 0.95rem);
  line-height: 1.62;
  text-wrap: pretty;
}

/* height:auto is load-bearing. The <img> keeps its width/height attributes so
   the box is reserved before the file lands, but the height attribute is a
   presentational hint of 1280px — a specified height, which switches
   aspect-ratio off and lets the portrait run 1300px past the rail. */
/* The cut moves to the wrapper so the still and the loop share one box, one
   crop and one shape — the video can then sit exactly on top of the poster
   with nothing to align. */
.mh-portrait-cut {
  position: relative;
  width: 100%;
  aspect-ratio: 0.84;
  overflow: hidden;
  clip-path: polygon(0 6%, 46% 0, 100% 4%, 100% 92%, 54% 100%, 0 96%);
}

.mh-portrait-cut img,
.mh-portrait-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 51% 44%;
  filter: contrast(1.06) saturate(1.04);
}

/* No JS gate: the loop simply plays over its own poster. If the file fails to
   decode, the still underneath is already the right picture. */
.mh-portrait-video { z-index: 1; }

/* Motion is a choice. Off, the portrait is the photograph it was. */
@media (prefers-reduced-motion: reduce) {
  .mh-portrait-video { display: none; }
}

body.mh-motion-paused .mh-portrait-video { display: none; }

.mh-portrait figcaption {
  margin-top: 0.5rem;
  color: rgb(244 236 223 / 0.6);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mh-about-copy {
  display: grid;
  grid-template-rows: min-content min-content minmax(0, 1fr) min-content;
  gap: 0.4rem;
  order: 1;
  min-height: 0;
}

/* One column, one measure. The bio is five paragraphs: two columns left
   two-thirds of the frame empty AND cut the measure to 50 characters. */
.mh-measure {
  max-width: var(--measure);
  margin-top: 0.3rem;
  padding-right: 0.2rem;
}

.mh-measure p {
  margin: 0 0 0.85rem;
  color: #d8d2c6;
  font-size: var(--fs-lead);
  line-height: 1.58;
  text-wrap: pretty;
}

.mh-measure p:last-child { margin-bottom: 0; }
.mh-measure strong { color: var(--paper); }

/* ---------------------------------------------------------------- narrow */

@media (max-width: 700px) {
  /* One column: portrait above, bio below. At 390 the bio genuinely cannot
     fit, so the region scrolls — visibly. */
  /* One column, so the explicit column/row placement above must be released
     or the portrait and coda stay stranded in a track that no longer exists. */
  .mh-about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: min-content minmax(0, 1fr) min-content;
    gap: 0.9rem;
  }

  .mh-portrait {
    grid-column: 1;
    grid-row: 1;
    width: min(46%, 10.5rem);
  }

  .mh-portrait figcaption { margin-top: 0.35rem; }

  .mh-about-copy {
    grid-column: 1;
    grid-row: 2;
  }

  /* The coda stays put below the scrolling bio: it is the last thing he says,
     and it should not be the thing you have to scroll to discover. */
  .mh-coda {
    grid-column: 1;
    grid-row: 3;
    max-width: none;
    padding-top: 0.55rem;
  }

  .mh-measure p { font-size: var(--fs-body); line-height: 1.55; }

  /* THE BIO SCROLLS AS PART OF THE PAGE ON A PHONE, not inside a 147px window.
     The inner scroller left 524px of copy hidden behind a strip too small to
     hit with a thumb — and a swipe anywhere else on the page did nothing, so
     "scroll for more" was a promise the layout could not keep. Here the whole
     content region scrolls (frame.css already makes it `auto`) and the rail
     stays put, because it is a separate grid row. */
  .mh-about {
    grid-template-rows: min-content min-content min-content;
    align-content: start;
  }

  .mh-about-copy { grid-template-rows: none; }

  .mh-scroll {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* Nothing left to promise: the page itself scrolls now. */
  .mh-more { display: none !important; }

  /* Two facts, two lines. Inline they wrapped mid-phrase. */
  .mh-credit-line {
    display: grid;
    gap: 0.18rem;
    justify-items: start;
  }
}

/* Below the frame's own release point the page returns to normal document
   flow (frame.css), so the inner scroll region must stop competing with it. */
@media (max-height: 30rem) {
  .mh-scroll {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .has-more > .mh-more { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mh-scroll { scroll-behavior: auto; }
}

/* The colophon rides inside the coda rather than as its own grid child: the
   About grid places every item explicitly, so an unplaced child would be
   auto-placed into a track that was never designed for it. */
.mh-coda .mh-colophon-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  align-items: baseline;
  margin: clamp(0.7rem, 1.8cqh, 1.2rem) 0 0;
  color: rgb(244 236 223 / 0.45);
  font-family: var(--font-mono);
  font-size: var(--fs-micro, 0.75rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mh-coda .mh-colophon-line a {
  color: rgb(244 236 223 / 0.72);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.mh-coda .mh-colophon-line a:hover,
.mh-coda .mh-colophon-line a:focus-visible {
  color: var(--paper);
  border-bottom-color: var(--accent);
}
