/*
 * One-page scroll version. In "fx" mode everything is fixed to the viewport
 * and scroll position drives the lenses and the text (see js/scroll.js).
 * Without fx (no WebGL, reduced motion, narrow screens) it is a plain stacked page.
 */

/* ---------- fx mode ---------- */

.fx .scene {
  position: fixed; top: 0; bottom: 0; z-index: 1;
  left: max(0px, calc((100vw - 1760 * var(--u)) / 2));
  right: max(0px, calc((100vw - 1760 * var(--u)) / 2));
  pointer-events: none;
  transition: opacity .3s ease;
}
.fx.dialog-open .scene { opacity: 0; }
.fx .scene .nav, .fx .scene .foot, .fx .scene .loc { pointer-events: auto; }
.fx .hero { position: absolute; inset: 0; pointer-events: none; will-change: opacity, transform; }

.fx .pt {
  position: absolute; left: calc(64 * var(--u)); bottom: calc(104 * var(--u)); width: calc(500 * var(--u));
  display: flex; flex-direction: column; gap: calc(12 * var(--u));
  opacity: 0; visibility: hidden; pointer-events: none; will-change: opacity, transform;
}
.fx .pt .row-title--lg { font-size: calc(56 * var(--u)); }
.fx .pt .row-link { position: relative; }
.fx .pt .row-link::after { content: ""; position: absolute; inset: calc(-12 * var(--u)) 0; }
.fx .pt .row-line { max-width: calc(500 * var(--u)); }

.fx .lens--s { position: absolute; left: 0; top: 0; width: 0; height: 0; margin: 0; visibility: hidden; pointer-events: none; }
.fx .anchor {
  position: absolute; left: calc(100% - 555 * var(--u)); top: calc(235 * var(--u));
  width: calc(470 * var(--u)); height: calc(470 * var(--u)); visibility: hidden; pointer-events: none;
}
.fx .track { width: 1px; }

/* the open cue (also used by the row text) */
.open-cue {
  font-size: var(--small); font-weight: 500; line-height: 1.4; color: var(--ink);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .25s ease, transform .25s ease;
}
.is-active .open-cue { opacity: 1; transform: none; }

/* ---------- plain mode ---------- */

html:not(.fx) .scene {
  position: static; display: flex; flex-direction: column; padding: 20px 20px 28px; gap: 0;
  max-width: 760px; margin: 0 auto; min-height: 100vh;
}
html:not(.fx) .track, html:not(.fx) .anchor { display: none; }
html:not(.fx) .top { position: static; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
html:not(.fx) .loc, html:not(.fx) .nav { position: static; }
html:not(.fx) .nav ul { gap: 18px; }
html:not(.fx) .hero { position: static; }
html:not(.fx) .display {
  position: static; margin: 30px 0 0 -0.03em; font-size: min(21vw, 118px); letter-spacing: -0.017em;
  font-family: var(--name-font, "Fraunces Variable"), Georgia, serif; font-weight: var(--name-w, 420); line-height: 0.92;
}
html:not(.fx) .role { position: static; margin-top: 22px; font-size: 22px; }
html:not(.fx) .tagline { position: static; margin-top: 4px; font-size: 16px; }
html:not(.fx) .pt {
  position: static; width: auto; margin-top: 56px; display: flex; flex-direction: column; gap: 10px;
  background: rgba(10, 12, 14, 0.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 14px; padding: 16px 18px; align-self: flex-start;
}
html:not(.fx) .row-title--lg { font-size: 34px; }
html:not(.fx) .row-link::after { content: ""; position: absolute; inset: 0; }
html:not(.fx) .pt { position: relative; }
html:not(.fx) .open-cue { display: none; }
html:not(.fx) .lens--s { position: static; width: min(70vw, 340px); margin: 20px 0 0; }
html:not(.fx) .foot { position: static; margin-top: 48px; align-self: flex-start; }

/* name: plain type by default (query ?name=plain|steel|glass, ?fx=both|sweep|drop|plain,
   ?font=Fraunces&w=500, ?gt=debug). With the engine on, the plain name is drawn by GL so the
   glass can bend it, and the DOM text goes transparent (.gt-on). */
.fx .display {
  font-family: var(--name-font, "Fraunces Variable"), Georgia, serif;
  font-weight: var(--name-w, 420);
  font-size: calc(118 * var(--u));
  letter-spacing: var(--name-ls, calc(-2 * var(--u)));
  line-height: 0.92;
}
.fx.name-plain .role { top: calc(338 * var(--u)); }
.fx.name-steel .display, .fx.name-glass .display {
  font-size: calc(150 * var(--u)); letter-spacing: var(--name-ls, calc(-3 * var(--u))); line-height: 0.9;
}
.fx.name-glass .display { font-weight: var(--name-w, 460); }
.fx.name-steel .display { font-weight: var(--name-w, 640); }
.fx.gt-on .display { color: transparent; }
.fx.name-flat.gt-on .role { color: transparent; }
.fx.gt-debug .display { color: rgba(255, 60, 60, 0.45); }

.font-pick { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; padding: 8px 16px; border-radius: 99px;
  background: rgba(11,13,15,.78); color: #e9ecee; font: 500 13px/1.3 system-ui, sans-serif; letter-spacing: .02em; pointer-events: none; white-space: nowrap; }

/* scroll cue: a quiet label and a pulsing hairline at bottom centre, gone after the first scroll */
.scroll-cue { display: none; }
.fx .scroll-cue {
  display: block; position: absolute; left: 50%; bottom: calc(30 * var(--u)); transform: translateX(-50%);
  text-align: center; pointer-events: none; will-change: opacity;
  font-size: max(11px, calc(12 * var(--u))); font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2);
}
.scroll-cue i {
  display: block; position: relative; overflow: hidden; width: 1px; height: calc(34 * var(--u)); margin: calc(9 * var(--u)) auto 0;
  background: rgba(233, 236, 238, 0.16);
}
/* a short bright streak runs down the hairline, then rests, so the loop has no visible seam */
.scroll-cue i::after {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 55%;
  background: linear-gradient(to bottom, rgba(233, 236, 238, 0), rgba(233, 236, 238, 0.9) 60%, rgba(233, 236, 238, 0));
  transform: translateY(-110%); animation: cue-run 2.4s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}
@keyframes cue-run { 0% { transform: translateY(-110%); } 65%, 100% { transform: translateY(190%); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue i::after { animation: none; transform: translateY(20%); } }

/* ---------- phones: the same scroll, composed for a tall screen (html.fx-portrait) ----------
   --u is about 1px per design px of a 390 wide phone; scroll.js places the lenses. */
html.fx-portrait .nav { top: calc(18 * var(--u)); right: calc(20 * var(--u)); }
html.fx-portrait .nav ul { gap: calc(15 * var(--u)); }
html.fx-portrait .nav a { font-size: max(12px, calc(13 * var(--u))); }
html.fx-portrait .display { left: calc(22 * var(--u)); top: calc(66 * var(--u)); font-size: calc(68 * var(--u)); letter-spacing: calc(-1.4 * var(--u)); }
html.fx-portrait.name-plain .role { top: calc(196 * var(--u)); left: calc(23 * var(--u)); font-size: calc(19 * var(--u)); }
html.fx-portrait .pt { left: calc(22 * var(--u)); bottom: calc(62 * var(--u)); width: calc(100% - 44 * var(--u)); gap: calc(8 * var(--u)); }
html.fx-portrait .pt .row-title--lg { font-size: calc(34 * var(--u)); }
html.fx-portrait .pt .row-line { max-width: none; font-size: max(14px, calc(15 * var(--u))); }
html.fx-portrait .foot { left: calc(22 * var(--u)); bottom: calc(22 * var(--u)); }
html.fx-portrait .scroll-cue { display: none; }
html.fx-portrait .open-cue { display: none; }
html.fx-portrait .pd-inner { grid-template-columns: 1fr; align-items: start; align-content: start; padding: 84px 20px 32px; }
html.fx-portrait .pd-shot img { width: 100%; }
html.fx-portrait .anchor { right: auto; }

/* ---------- the still version: a photograph of the steel behind the plain page ---------- */
html:not(.fx) body { background: transparent; }
html:not(.fx) body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #0a0c0e url("../assets/steel-still-wide.jpg") right center / cover no-repeat;
}
@media (max-width: 640px) {
  html:not(.fx) body::before { background-image: url("../assets/steel-still-tall.jpg"); background-position: center top; }
}
