/* ============================================================================
   S10 · Contact — the finale. "Same letters, different route."
   CSS default = the key pose (still edition, no JS): the name at rest, an arrow,
   the email as a plain link, Copy, the channels, the footer. One clean panel.
   `.finale--live` is added by mount(): the absolute composition the scrub drives
   (letters frozen to measured positions, the email measured, the cluster below).
   ========================================================================== */

.scene--finale {
  /* The poster, as the hero sets it: three lines at one size, flush left, MASKARIÑO fitted to the gutters
     (8.216em at wdth 125). CSS approximates the fit so the still edition is composed; JS measures it exactly. */
  --finale-avail: calc(100vw - 2 * var(--gutter));
  --finale-fs: min(calc(var(--finale-avail) / 8.216), 24svh);
  --finale-wdth-last: 125;
  --finale-line-gap: 0; /* ERNEST / JOHN: solid leading, as the hero sets them */
  --finale-tilde-gap: 0.2em; /* the tilde's own band above the Ñ, as in the hero */
  --finale-domain: clamp(14px, 1.5vw, 26px);
}
.scene--finale .scene__stage {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: calc(var(--header-h) + 64px) var(--gutter) max(var(--gutter), 24px);
}

/* ---------- the name (still edition: flow) ---------- */
.finale__name {
  position: relative;
  width: 100%;
  text-transform: none;
  color: var(--bone);
}
/* Measured, never transitioned: the reduced-motion rule in home.css makes every change a 0.01ms transition,
   which would let a synchronous measurement read the pre-change size. */
.finale__name,
.finale__name *,
.finale__measure,
.finale__measure *,
.finale__underline,
.finale__underline * {
  transition: none !important;
}
.finale__w {
  display: block;
  width: max-content;
  max-width: 100%;
  font-size: var(--finale-fs);
  letter-spacing: -0.01em; /* the display primitive's tracking, computed at the line's own size (as the hero's lines) */
  white-space: nowrap;
  text-align: left;
}
.finale__w--john {
  margin-top: var(--finale-line-gap);
}
.finale__w--last {
  /* the tilde's own band above the Ñ; fitted on the width axis where the lines share ERNEST's size */
  margin-top: var(--finale-tilde-gap);
  font-variation-settings: "wdth" var(--finale-wdth-last), "wght" 900;
  font-stretch: calc(var(--finale-wdth-last) * 1%);
}
.finale__l {
  position: relative;
  display: inline-block;
  text-transform: none;
}
.finale__l.is-lc {
  font-variation-settings: "wdth" 90, "wght" 900;
  font-stretch: 90%;
}
.finale__g {
  display: inline;
}
.finale__tilde {
  position: absolute;
  left: 0.06em;
  top: -0.2em;
  width: 0.64em;
  height: auto;
  overflow: visible;
  color: var(--signal);
  pointer-events: none;
}
.finale__domain {
  display: none;
  font-size: var(--finale-domain);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: var(--fg);
  white-space: nowrap;
}
.finale__measure {
  display: none;
}

/* the underline: the tilde, redrawn under the whole email (live edition only) */
.finale__underline {
  display: none;
  color: var(--signal);
  overflow: visible;
  pointer-events: none;
}

/* ---------- still edition rows ---------- */
.finale__arrow {
  margin: clamp(20px, 3vh, 36px) 0 clamp(14px, 2vh, 24px);
  font-size: clamp(18px, 2vw, 28px);
  color: var(--signal);
}
.finale__below {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.finale__email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 8px;
}
.finale__mail {
  font-family: var(--mono);
  font-size: clamp(17px, 2.2vw, 30px);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.finale__copy {
  min-width: 96px;
  justify-content: center;
}
.finale__line {
  max-width: 30ch;
}
.finale__open {
  color: var(--fg-2);
}
.finale__channels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.finale__channels a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
.finale__sep {
  color: var(--fg-3);
}
.finale__cred,
.finale__where {
  color: var(--fg-3);
}
.finale__where {
  color: var(--fg-2);
}
.finale__clock {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.finale__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: auto;
  padding-top: clamp(24px, 4vh, 48px);
  color: var(--fg-3);
}
.finale__pages a {
  display: inline-block;
  padding: 6px 0;
  color: var(--fg-2);
  transition: color 0.25s;
}
.finale__pages a:hover {
  color: var(--fg);
}

/* ---------- the live edition: everything placed, the scrub drives it ---------- */
.finale--live .scene__stage {
  display: block;
  padding: 0;
  /* The E and J leave the (fixed) header while this stage is still rising out of the fold: let them paint above
     the stage's top edge. Horizontal clipping stays (rails start off-screen). */
  overflow-x: clip;
  overflow-y: visible;
  pointer-events: none;
}
.finale--live .finale__name {
  pointer-events: none;
}
.finale--done .finale__below,
.finale--done .finale__foot {
  pointer-events: auto;
}
.finale--live .finale__name {
  position: absolute;
  inset: 0;
  perspective: 800px;
  perspective-origin: 50% 50%;
}
.finale--live .finale__l {
  transform-origin: 0 50%;
  backface-visibility: hidden;
}
.finale--live .finale__l--fixed {
  position: absolute;
  z-index: 1;
  white-space: pre;
}
.finale--live .finale__l--anchor {
  z-index: 2;
}
.finale--live .finale__domain {
  display: block;
  position: absolute;
}
.finale--live .finale__measure {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  white-space: nowrap;
  pointer-events: none;
  text-transform: none;
  font-variation-settings: "wdth" 90, "wght" 900;
  font-stretch: 90%;
}
.finale__mg {
  display: inline-block;
}
.finale__mdom {
  display: inline-block;
  vertical-align: baseline;
  /* part of the address: in scale with the lowercase name (DOMAIN_RATIO in finale.js), baseline-aligned */
  font-size: 0.4em;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  margin-left: 0.1em;
}
.finale__mbase {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: baseline;
}
.finale--live .finale__underline {
  display: block;
  position: absolute;
  z-index: 1;
}
.finale--live .finale__arrow {
  display: none;
}
/* The real mailto link lies over the drawn address (geometry from finale.js): the letters are the visible text,
   the link is what you click, tab to and hear. Always focusable; its ring frames the address. */
.finale--live .finale__mail {
  position: absolute;
  z-index: 3;
  display: block;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 1px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  background: none;
  border: 0;
  pointer-events: none;
}
.finale--live .finale__mail:focus-visible {
  outline-offset: 6px;
}
.finale--done .finale__mail {
  pointer-events: auto;
  cursor: pointer;
}
.finale--live .finale__below {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: var(--finale-below, 62vh);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "line email"
    "open open"
    "channels channels"
    "cred cred"
    "where where";
  align-items: end;
  gap: 10px 24px;
}
.finale--live .finale__email {
  grid-area: email;
  margin: 0;
  justify-content: flex-end;
}
.finale--live .finale__line {
  grid-area: line;
}
.finale--live .finale__open {
  grid-area: open;
  margin-top: 4px;
}
.finale--live .finale__channels {
  grid-area: channels;
  margin-top: 8px;
}
.finale--live .finale__cred {
  grid-area: cred;
}
.finale--live .finale__where {
  grid-area: where;
}
.finale--live .finale__foot {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: max(var(--gutter), 24px);
  margin: 0;
  padding: 0;
}

/* ---------- portrait under 1024 (phones, portrait tablets): ERNEST fitted to the gutters, MASKARIÑO at the same
   size on the width axis (wdth ≈ 79; JS fits it exactly) — the hero's three-line rule ---------- */
@media (max-width: 1023px) and (orientation: portrait) {
  .scene--finale {
    --finale-fs: min(calc(var(--finale-avail) / 5.27), 20svh); /* ERNEST = 5.27em at wdth 125 */
    --finale-wdth-last: 78.7;
  }
}

/* ---------- phone edition ---------- */
@media (max-width: 767px) {
  .scene--finale {
    --finale-domain: 5.5vw;
  }
  .scene--finale .scene__stage {
    padding-top: calc(var(--header-h) + 44px);
  }
  .finale__mail {
    font-size: 17px;
  }
  .finale__email {
    gap: 12px 16px;
  }
  .finale__copy {
    min-height: 48px;
  }
  .finale__channels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }
  .finale__channels a {
    min-height: 48px;
    border-bottom: 1px solid var(--line);
  }
  .finale__sep {
    display: none;
  }
  .finale__foot {
    flex-direction: column;
    gap: 4px;
  }
  .finale__pages a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .finale--live .finale__below {
    gap: 6px 12px;
  }
  .finale--live .finale__line {
    font-size: clamp(20px, 6vw, 26px);
  }
  .finale--live .finale__open {
    margin: 2px 0 0;
  }
  .finale--live .finale__channels {
    margin: 2px 0 0;
  }
  .finale--live .finale__cred {
    font-size: var(--mono-s);
  }
  .finale--live .finale__foot {
    bottom: 8px;
    font-size: 11px;
  }
  .finale__pages {
    letter-spacing: 0.02em;
  }
  .finale--live .finale__foot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 16px;
  }
}

/* ---------- landscape phones: two lines, compact rows ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .scene--finale {
    --finale-fs: min(calc(var(--finale-avail) / 8.216), 22vh);
  }
  .finale--live .finale__below {
    gap: 3px 16px;
  }
  .finale--live .finale__below .mono {
    font-size: 11px;
    line-height: 1.3;
  }
  .finale--live .finale__line {
    font-size: 18px;
  }
  /* Compact rows, full-size targets: every link and Copy is a 44px hit box; negative margins keep the rhythm. */
  .finale--live .finale__copy {
    min-height: 44px;
    margin: -6px 0;
    padding: 0 14px;
  }
  .finale--live .finale__open {
    margin-top: 0;
  }
  .finale--live .finale__channels {
    margin-top: 2px;
    gap: 0 14px;
  }
  .finale--live .finale__channels a {
    min-height: 44px;
    margin: -12px 0;
    padding: 0 2px;
  }
  .finale--live .finale__foot {
    font-size: 11px;
    bottom: 4px;
    align-items: center;
  }
  .finale--live .finale__pages a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
  }
}
