/* ============================================================
   PORTHOLE · the opening of the 3.0b homepage (David, 2026-11-23).
   Layout after the HorizonX "Tharsis" hero (pristine copy: _untrusted/tharsis-hero-1.0.0), but the
   window looks onto THIS scan's own first frame, live: the porthole is an overlay inside the scan
   section's sticky stage, in the 120vh lead-in (data-lead) that scan.js reserves for a prologue.
   js/porthole.js scrolls the cabin through the glass: the zoom box scales around the window centre
   until the glass covers the screen, then the scan's headline, panel and cue ride in (--hxf), as they
   did for the old statement prologue (hero.css rules).
   Layers: .ph__zoom (ink with a window-shaped hole, the cabin art, glass, spill) · .ph__scrim · .ph__chrome.
   Cabin art = Tharsis placeholder (images/porthole/), an Orb interior to follow via Higgsfield.
   ============================================================ */
.ph {
  --ph-ink: #050607;   /* the cabin art's own black, so the fill never shows a seam */
  --art-ratio: 1672 / 941;
  /* the window cut-out, in % of the art (measured by HorizonX for cabin-desktop.webp) */
  --win-left: 14.115%; --win-top: 48.884%; --win-width: 71.711%; --win-height: 28.693%;
  /* the same hole as an SVG mask in the art's own pixel space (rx = half the height: a stadium) */
  --win-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1672 941' preserveAspectRatio='none'%3E%3Cpath fill-rule='evenodd' d='M0 0H1672V941H0Z M371 460H1300A135 135 0 0 1 1300 730H371A135 135 0 0 1 371 460Z'/%3E%3C/svg%3E");
  position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; color: var(--ink);
}
@media (max-aspect-ratio: 1/1) {
  .ph {
    --art-ratio: 941 / 1672;
    --win-left: 26.249%; --win-top: 24.342%; --win-width: 46.865%; --win-height: 53.409%;
    --win-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 941 1672' preserveAspectRatio='none'%3E%3Cpath fill-rule='evenodd' d='M0 0H941V1672H0Z M247 627.5A220.5 220.5 0 0 1 688 627.5V1079.5A220.5 220.5 0 0 1 247 1079.5Z'/%3E%3C/svg%3E");
  }
}
.ph.is-done { display: none; }
/* the lead-in is 180vh with the porthole (wide fly-in, then the zoom through the glass): keep it in step
   with data-lead on #scan (hero.css set 1100vh of scan + 120vh for the old statement prologue) */
.sc-embed.has-prologue { height: calc(1100vh + 180vh); }
/* mobile audit (2026-11-23): the porthole already carries the scroll cue ("Scroll ▸ Enter"), so the scan's own
   "Scroll ▸ Fly" cue (which sits on the first caption on phones) stays off on this page; on phones the
   "ARC Edge · network fly-through" plate is dropped too: it collided with node labels and doubled the nav emblem */
.sc-embed.has-prologue .sc-cue { display: none; }
@media (max-width: 767px) { .sc-embed.has-prologue .sc-plate-wrap { display: none; } }

/* ---------- the cabin: everything in here scales as one, around the window centre ---------- */
.ph__zoom {
  position: absolute; left: 50%; width: 100vw; aspect-ratio: var(--art-ratio);
  /* Tharsis placement: sits on the floor; on tall screens lift it so the footer clears the window */
  bottom: min(150px, max(calc((100vh - 100vw / (1672 / 941)) * .75), calc((100vh - 100vw / (1672 / 941)) * .3)));
  translate: -50% 0;
  transform-origin: calc(var(--win-left) + var(--win-width) / 2) calc(var(--win-top) + var(--win-height) / 2);
  will-change: transform, opacity;
}
@media (max-aspect-ratio: 1/1) {
  .ph__zoom { width: calc(90vh * 941 / 1672); bottom: auto; top: calc(50% + 2vh); translate: -50% -50%; }
}
/* ink everywhere the art does not reach: four bars around the box, and the box itself minus the window */
.ph__zoom::before, .ph__zoom::after, .ph__bar { content: ''; position: absolute; background: var(--ph-ink); }
.ph__zoom::before { left: -150vw; right: -150vw; bottom: calc(100% - 1px); height: 150vh; }
.ph__zoom::after { left: -150vw; right: -150vw; top: calc(100% - 1px); height: 150vh; }
.ph__bar.is-l { right: calc(100% - 1px); top: 0; bottom: 0; width: 150vw; }
.ph__bar.is-r { left: calc(100% - 1px); top: 0; bottom: 0; width: 150vw; }
.ph__ink {
  position: absolute; inset: 0; background: var(--ph-ink);
  -webkit-mask: var(--win-mask) center / 100% 100% no-repeat; mask: var(--win-mask) center / 100% 100% no-repeat;
}
.ph__art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
@media (max-aspect-ratio: 1/1) {
  .ph__art { -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
}
.ph__zoom.is-fit .ph__art { -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); }
/* fade the art's top and bottom into the ink so a short stage never shows a seam */
.ph__fade { position: absolute; left: 0; right: 0; pointer-events: none; }
.ph__fade.is-t { top: -1px; height: 18%; background: linear-gradient(var(--ph-ink), transparent); }
.ph__fade.is-b { bottom: -1px; height: 14%; background: linear-gradient(transparent, var(--ph-ink)); }
@media (max-aspect-ratio: 1/1) { .ph__fade.is-t { height: 19.5%; background: linear-gradient(var(--ph-ink) 0%, var(--ph-ink) 72%, transparent 100%); } }

/* glass on the window: inner depth and a soft sheen (Tharsis), gone once you are through it */
.ph__glass {
  position: absolute; left: var(--win-left); top: var(--win-top); width: var(--win-width); height: var(--win-height);
  border-radius: 9999px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 18px 60px rgba(0, 0, 0, .7), inset 0 -30px 80px rgba(0, 0, 0, .5);
  background:
    linear-gradient(112deg, transparent 28%, rgba(255, 255, 255, .045) 38%, transparent 47%),
    linear-gradient(112deg, transparent 52%, rgba(255, 255, 255, .025) 56%, transparent 61%),
    radial-gradient(120% 140% at 50% 50%, transparent 55%, rgba(0, 0, 0, .4) 100%);
}
/* dusk light from the window spilling onto the cabin floor */
.ph__spill {
  position: absolute; left: calc(var(--win-left) - 4%); width: calc(var(--win-width) + 8%);
  top: calc(var(--win-top) + var(--win-height) * .55); height: 40%; pointer-events: none;
  background: radial-gradient(50% 45% at 50% 30%, rgba(247, 140, 70, .14), transparent 70%); mix-blend-mode: screen;
}

/* legibility over the cabin (scrims for legibility only); leaves with the copy */
.ph__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 6, 7, .55) 0%, transparent 22%), linear-gradient(0deg, rgba(5, 6, 7, .7) 0%, transparent 18%);
}

/* ---------- the copy ---------- */
.ph__chrome {
  position: absolute; inset: 0; z-index: 2; display: grid; grid-template-rows: auto 1fr;
  padding: 116px var(--pad) calc(var(--pad) * .8); will-change: opacity, transform;
}
.ph__bottom { align-self: end; }
.ph__chrome a { pointer-events: auto; }
.ph__intro { justify-self: center; text-align: center; max-width: 1180px; }
/* one headline, one size, one colour (David, 2026-11-23: no eyebrow, no stepped-down second line) */
.ph__h {
  margin: 0; padding-left: var(--track-display);
  font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--track-display); text-transform: uppercase;
  font-size: clamp(15px, 1.47vw, 25px); line-height: 1.45; color: var(--ink); text-wrap: balance;   /* halved, then +25% (David, 2026-11-23) */
}

/* the bottom is one quiet row on the page's bottom edge: subheader · readout · cue (no rule, no CTA) */
.ph__bottom {
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "left tele cue";
  align-items: end; column-gap: 32px;
}
.ph__lede { grid-area: left; margin: 0; max-width: 31em; font: 400 14px/1.55 var(--sans); color: rgba(241, 241, 237, .74); text-wrap: pretty; }
.ph__tele, .ph__cue { font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding-bottom: 4px; }
.ph__tele { grid-area: tele; display: flex; gap: clamp(16px, 2vw, 32px); }
.ph__tele span { display: inline-flex; align-items: center; gap: 8px; }
.ph__tele b { font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }
.ph__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--held); box-shadow: var(--halo-held, 0 0 10px rgba(58, 224, 110, .55)); }
.ph__cue { grid-area: cue; justify-self: end; color: var(--dim); }

/* entrance: rise in from a light blur (Tharsis), the cabin fades up */
.ph__rise { opacity: 0; transform: translateY(14px); filter: blur(6px); }
.ph.is-ready .ph__rise { opacity: 1; transform: none; filter: none; transition: opacity 1.4s var(--ease), transform 1.4s var(--ease), filter 1.4s var(--ease); transition-delay: calc(var(--i, 0) * 110ms + 150ms); }
.ph__art, .ph__glass { opacity: 0; transition: opacity 1.6s var(--ease); }
.ph.is-ready .ph__art, .ph.is-ready .ph__glass { opacity: 1; }

/* the scan's own chrome stays hidden until the zoom hands over (hero.css covers caption, scrim, panel, cue) */
.sc-embed.is-prologue .sc-tag.is-on,
.sc-embed.is-prologue > .sc-stage > .sc-rail,
.sc-embed.is-prologue > .sc-stage > .sc-plate-wrap { opacity: var(--hxf, 0); transition: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) { .ph__tele { display: none; } .ph__bottom { grid-template-columns: 1fr auto; grid-template-areas: "left cue"; } }
@media (max-aspect-ratio: 1/1) {
  .ph__chrome { padding-top: 104px; }
  .ph__h { font-size: 15px; line-height: 1.5; }   /* the 12px phone floor, +25% */
  .ph__bottom { grid-template-columns: 1fr; grid-template-areas: "left" "cue"; justify-items: center; text-align: center; row-gap: 14px; }
  .ph__lede { font-size: 13px; line-height: 1.5; max-width: 30em; }
  .ph__cue { justify-self: center; }
  .ph__scrim { background: linear-gradient(180deg, rgba(5, 6, 7, .96) 0%, rgba(5, 6, 7, .82) 17%, transparent 25%), linear-gradient(0deg, rgba(5, 6, 7, .92) 0%, rgba(5, 6, 7, .7) 22%, transparent 32%); }
}
@media (max-aspect-ratio: 1/1) and (max-width: 340px) { .ph__lede { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .ph__rise, .ph__art, .ph__glass { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
}
