/* ==========================================================================
   Multi-Hyphenate — UTILITY ROUTES.

   Ported from mocks/console.html?state=privacy and ?state=404. Both live
   inside the fixed frame (see css/frame.css).

   PRIVACY is one page, four sections — not chapters. The statement sits left,
   the document right, both filling the frame at a 62–68 character measure.
   404 is a single title card, vertically centred, so the empty space around
   it reads as composition rather than as an accident.
   ========================================================================== */

/* Hidden means hidden. */
body.page-privacy [hidden],
body.page-404 [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-privacy .noscript-nav,
body.page-404 .noscript-nav { top: auto; }

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

body.page-privacy .mh-frame,
body.page-404 .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);
}

body.page-privacy .mh-frame-content,
body.page-404 .mh-frame-content {
  display: grid;
  grid-template-rows: min-content minmax(0, 1fr);
  gap: clamp(0.75rem, 2.4svh, 1.5rem);
  align-content: stretch;
}

.mh-page-mark {
  display: block;
  width: clamp(6.6rem, 9cqw, 9rem);
  line-height: 0;
}

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

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

.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-dek {
  max-width: 42ch;
  margin: 0;
  color: var(--paper-dim);
  font-size: var(--fs-lead);
  line-height: 1.45;
  text-wrap: pretty;
}

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

.mh-head {
  display: grid;
  gap: 0.42rem;
  align-content: start;
}

/* ==========================================================================
   PRIVACY — statement left, document right, both filling the frame
   ========================================================================== */

/* Both columns are sized to their content, not to a fraction of whatever the
   viewport happens to be. As `0.8fr` + `space-between` the left column grew
   with the window while its text held its measure, so on a wide display the
   two halves drifted to opposite edges with a screen of nothing between them.
   Same correction as About. */
.mh-privacy {
  display: grid;
  grid-template-columns: minmax(12rem, 24rem) minmax(0, var(--measure));
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
  align-content: stretch;
  column-gap: clamp(1.5rem, 3cqw, 3rem);
  min-height: 0;
}

/* The still is the poster and the fallback; the loop plays over it. Cut on the
   same six-vertex language as the About portrait and the Contact aperture. */
.mh-doc-plane {
  position: relative;
  width: 100%;
  aspect-ratio: 2.39;
  margin: 0;
  overflow: hidden;
  /* Wide wedge, slanting the opposite way to the Contact slab. */
  clip-path: polygon(0 0, 100% 9%, 100% 100%, 0 91%);
}

.mh-doc-plane img,
.mh-doc-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  filter: contrast(1.04) saturate(0.96) brightness(0.96);
}

.mh-doc-video { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .mh-doc-video { display: none; }
}

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

/* The title and the glyph read as one group, centred together, rather than the
   title pinned to the top with the glyph floating in the middle. Rows 1 and 4
   are flexible spacers; the stamp keeps the foot of the column. */
.mh-doc-side {
  display: grid;
  grid-template-rows: 1fr min-content min-content 1fr min-content;
  gap: 0;
  min-height: 0;
}

.mh-doc-side .mh-head { grid-row: 2; }
.mh-doc-side .mh-doc-plane { grid-row: 3; margin-top: clamp(1rem, 3cqh, 2rem); }
.mh-doc-side .mh-stamp { grid-row: 5; }

/* The document is the one flexible region: four sections, and if the viewport
   is too short for them it scrolls rather than losing the last one. */
.mh-doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* `space-between` pushed the four sections to the extremes of the column and
     left canyons between them. They sit together now — and CENTRED, so this
     column shares its centring with the title and glyph opposite instead of
     being top-aligned against a centred left column. */
  align-content: center;
  gap: clamp(1.1rem, 2.6cqh, 1.9rem);
  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-doc::-webkit-scrollbar { width: 9px; }
.mh-doc::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: rgb(232 121 69 / 0.8);
}
.mh-doc::-webkit-scrollbar-track { background: rgb(244 236 223 / 0.09); }

/* Matches .mh-scroll.can-scroll on About: a region that had to fall back to
   scrolling must SAY so. Without the fade this clipped mid-sentence at the rail
   line and read as the end of the page. */
.mh-doc.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%);
}

.mh-doc.can-scroll.at-end {
  -webkit-mask-image: none;
  mask-image: none;
}

.mh-doc section { margin: 0; }

.mh-doc h2 {
  margin: 0 0 0.3rem;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: var(--fs-sub);
  font-weight: 680;
  font-stretch: 92%;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.mh-doc p {
  max-width: var(--measure);
  margin: 0;
  color: #d8d2c6;
  font-size: var(--fs-lead);
  line-height: 1.5;
  text-wrap: pretty;
}

.mh-doc a {
  color: var(--accent);
  text-underline-offset: 0.22em;
}

.mh-doc a:hover { color: #fff3e2; }

.mh-stamp {
  margin: 0;
  align-self: end;
  color: rgb(244 236 223 / 0.55);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mh-doc-side .mh-routes { align-self: end; }

/* ==========================================================================
   404 — centred in the frame rather than stranded at the top
   ========================================================================== */

.mh-404 {
  display: grid;
  grid-template-columns: minmax(0, 30rem);
  align-content: center;
  justify-content: start;
  gap: 0.65rem;
  min-height: 0;
}

.mh-404-copy {
  display: grid;
  gap: 0.65rem;
  align-content: center;
}

.mh-404-plane { display: none; }

/* Wide enough for two columns: the copy holds the left, the glyph the right,
   sized to its own measure so the pair stays together instead of drifting to
   opposite edges as the window grows. */
@media (min-width: 900px) {
  .mh-404 {
    grid-template-columns: minmax(0, 26rem) minmax(0, 24rem);
    justify-content: center;
    align-items: center;
    column-gap: clamp(1.5rem, 3cqw, 3rem);
  }

  .mh-404-plane {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 2.39;
    margin: 0;
    overflow: hidden;
    /* Rotated quad -- neither slab nor wedge. */
    clip-path: polygon(7% 0, 100% 6%, 93% 100%, 0 94%);
  }

  .mh-404-plane img,
  .mh-404-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    filter: contrast(1.05) saturate(0.9) brightness(0.98);
  }

  .mh-404-video { z-index: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .mh-404-video { display: none; }
}

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

.mh-routes {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem 2rem;
  margin-top: 0.6rem;
}

.mh-routes a {
  color: var(--paper);
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: var(--fs-sub);
  font-stretch: 92%;
}

.mh-routes a:hover {
  color: #fff3e2;
  border-bottom-color: #fff3e2;
}

.mh-colophon-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: baseline;
  margin: 0;
  color: rgb(244 236 223 / 0.5);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

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

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

@media (max-width: 700px) {
  .mh-privacy {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: min-content minmax(0, 1fr);
    row-gap: 0.8rem;
  }

  .mh-doc-side {
    align-content: start;
    gap: 0.5rem;
  }

  .mh-stamp { align-self: start; }
  .mh-doc { align-content: start; }
  .mh-doc p { font-size: var(--fs-body); }
  .mh-404 { gap: 0.55rem; }
}

@media (max-height: 30rem) {
  /* The frame has released into normal document flow; stop competing. */
  .mh-doc { overflow: visible; }
  .mh-404 { align-content: start; }
}
