/* Hallmark · route: custom (bespoke) · structure: single-fold hologram teaser (logo → spin → tagline → capture)
 * idea: "the only colour in the room is the patch" — glowing contour foot en pointe, spinning in a warm void,
 *       cherry pebbles riding the rotation; page explains nothing (hard-launch secrecy, founder brief 30 Aug 2026)
 * paper: var(--color-void) oklch(14% 0.006 60) · accent: #C2172C (patches only — no accent UI anywhere)
 * display: hand-drawn SVG wordmark (staging stand-in for “Nice Together”, Struvictory — pending licence)
 * body: General Sans · tagline: General Sans 500 caps tracked 0.22em (Erode retired 3 Sep 2026)
 * axes: dark / geometric-sans / warm · nav: none (logo only) · footer: Ft2 inline micro
 * motion: continuous turntable spin (the brief IS the motion) + one draw-in entrance; reduced-motion → static ¾ view
 * studied: no · context: founder-directed (reference video: glass hand, ref.mp4) · differs from Split Studio on all axes
 * contrast: pass (ivory/dim/sand on void ≥ 7:1; rule-void 3.2:1) · honest: pass · tokens: pass · mobile: pass
 * Hallmark · pre-emit critique: P5 H4 E4 S5 R4 V5
 */

/* ---------- base ---------- */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: clip; }

body {
  overflow-x: clip;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-paper);
  background:
    radial-gradient(120% 90% at 50% 38%, oklch(19% 0.01 60) 0%, var(--color-void) 62%),
    var(--color-void);
  -webkit-font-smoothing: antialiased;
  padding-inline: max(0px, env(safe-area-inset-left), env(safe-area-inset-right));
}

::selection { background: var(--color-paper); color: var(--color-ink); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus-inv);
  outline-offset: 2px;
  border-radius: inherit;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- composition ---------- */

.teaser {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  /* top padding is 0 by design: the leg video is anchored to the viewport's top
     edge, so the column must start exactly there (founder: "the leg goes into
     the browser") */
  padding: 0 var(--page-gutter) var(--space-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  text-align: center;
}

/* ---------- wordmark (staging SVG) ---------- */

/* the living logo · generous crop of the square drip video (content spans ~x 12–89%,
   letters ~y 38–58%, drips below). Screen blending makes the video's black literally
   invisible on the page, so no hard edges exist; only the bottom fades so falling
   drips dissolve instead of hitting the crop line. */
.logo {
  position: relative;
  z-index: 1; /* floats above the leg video passing behind it */
  line-height: 0;
  margin-top: var(--space-lg);
  width: clamp(12.1rem, 36.3vw, 16.9rem);
  aspect-ratio: 7 / 5;
  /* no overflow clip and no mask — either would create a stacking context and
     break the screen blend that melts the video's black into the page */
}
.logo-canvas {
  position: absolute;
  width: 108.7%;
  aspect-ratio: 1 / 1;
  height: auto;
  left: -4.35%;
  top: -33.4%;
  pointer-events: none;
}
.logo-src {
  position: absolute;
  width: 2px; height: 2px;
  opacity: 0.01;
  pointer-events: none;
}
.logo-fallback {
  display: block;
  width: 82.6%;
  height: auto;
  margin: 14% auto 0;
  filter: drop-shadow(0 2px 18px oklch(96% 0.005 90 / 0.16));
}
.logo-fallback[hidden] { display: none; }

.chp-0 { stop-color: var(--chrome-hi); }
.chp-1 { stop-color: var(--chrome-mid); }
.chp-2 { stop-color: var(--chrome-deep); }

/* ---------- the spin ---------- */

.stage {
  position: relative;
  height: min(46dvh, 30rem);
  aspect-ratio: 9 / 16;
  max-width: 100%;
  margin-block: var(--space-md) var(--space-md);
  perspective: 1200px;
  /* the exact distance from the viewport's top edge to this box's top edge —
     MUST mirror the real chain above it: logo margin-top + logo height
     (width clamp × 5/7 aspect) + stage margin-top. The video adds this to its
     height and hangs from the stage bottom, so its top edge lands exactly on
     the viewport edge: the leg enters from the browser itself. */
  --above-stage: calc(var(--space-lg) + (clamp(12.1rem, 36.3vw, 16.9rem) * 0.7143) + var(--space-md));
}

.spin-video {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  height: calc(100% + var(--above-stage));
  aspect-ratio: 9 / 16;
  width: auto;
  object-fit: cover;
  /* melt the render's black into the warm void at the sides and below the toe —
     but NOT at the top: the leg is cut by the viewport edge, which is the point.
     Ellipse centre rides high so the top edge stays solid. */
  mask-image: radial-gradient(56% 110% at 50% 22%, #000 55%, transparent 87%);
  -webkit-mask-image: radial-gradient(56% 110% at 50% 22%, #000 55%, transparent 87%);
}
.story-video { transition: opacity 0.45s var(--ease-out); }
.story-video.story-done { opacity: 0; pointer-events: none; }
/* the return dissolve (spin → story) runs slower: the plasters melting away
   before the chrome comes back for the foot */
.story-video.story-return { transition-duration: 0.95s; }
.holo { position: absolute; inset: 0; perspective: 1200px; }
.holo[hidden] { display: none; }
.stage::after {                       /* light pool the object stands in */
  content: "";
  position: absolute; left: 50%; bottom: -3%;
  width: 78%; height: 9%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, oklch(88% 0.02 90 / 0.14), transparent 70%);
  pointer-events: none;
}

.tilt { position: absolute; inset: 0; transform: rotateX(4deg); transform-style: preserve-3d; }
.spin {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  animation: spin var(--spin-period) linear infinite;
}
@keyframes spin { to { transform: rotateY(360deg); } }

.plane { position: absolute; inset: 0; mix-blend-mode: screen; }
.plane svg { width: 100%; height: 100%; display: block; overflow: visible; }
.plane-2 { transform: rotateY(45deg); }
.plane-3 { transform: rotateY(90deg); --show-instep: 0; }
.plane-4 { transform: rotateY(135deg); --show-toe: 0; }
.plane-2 { --show-heel: 0; }

.contour {
  fill: none;
  stroke: url(#legfade);
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px oklch(96% 0.017 90 / 0.55))
          drop-shadow(0 0 22px oklch(96% 0.017 90 / 0.22));
}
.contour--main { stroke-width: 3; opacity: 0.92; }
.fade-0 { stop-color: var(--color-paper); stop-opacity: 0; }
.fade-1 { stop-color: var(--color-paper); stop-opacity: 1; }

.body {
  fill: url(#bodyfade);
  stroke: none;
  opacity: 0;
  animation: fadein 1.1s var(--ease-out) 0.5s forwards;
}
.bfade-0 { stop-color: var(--color-paper); stop-opacity: 0; }
.bfade-1 { stop-color: var(--color-paper); stop-opacity: 0.07; }

.patch { filter: drop-shadow(0 0 9px oklch(92% 0.005 90 / 0.7)) drop-shadow(0 0 24px oklch(92% 0.005 90 / 0.3)); }
.pebble { fill: url(#chromePeb); }
.pgloss { fill: var(--color-surface); opacity: 0.75; }

/* entrance · contour draws itself once, patches arrive after */
.contour--main {
  stroke-dasharray: 1900 1900;
  stroke-dashoffset: 1900;
  animation: draw 1.7s var(--ease-out) 0.2s forwards;
}
.patch { opacity: 0; animation: fadein 0.8s var(--ease-out) 1.2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
.patch--heel   { animation-name: fadein-heel; }
.patch--instep { animation-name: fadein-instep; }
.patch--toe    { animation-name: fadein-toe; }
@keyframes fadein-heel   { to { opacity: var(--show-heel, 1); } }
@keyframes fadein-instep { to { opacity: var(--show-instep, 1); } }
@keyframes fadein-toe    { to { opacity: var(--show-toe, 1); } }

/* ---------- copy ---------- */

/* the tagline · Merchandise retro-pop display (founder pick, 3 Sep 2026 — staging
   stand-in while the final logo font is chosen and licensed; DEMO licence, see
   README before spending on ads). Self-hosted woff2, General Sans caps fallback. */
@font-face {
  font-family: "Merchandise";
  src: url("merchandise.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
.tag {
  font-family: "Merchandise", var(--font-sans);
  font-weight: 400;
  font-size: clamp(1.7rem, 4.2vw, 2.3rem);
  letter-spacing: 0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere; min-width: 0;
  text-wrap: balance;
}

.micro { margin-top: var(--space-md); font-size: var(--text-sm); color: var(--color-dim); }
.notice { margin-top: var(--space-sm); font-size: var(--text-sm); color: var(--color-sand); }
.notice[hidden] { display: none; }
.success { margin-top: var(--space-lg); color: var(--color-paper); }
.success[hidden] { display: none; }
.signup[hidden] { display: none; }

/* ---------- capture ---------- */

.signup {
  margin-top: var(--space-lg);
  width: 100%;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm);
}
.signup input[type="email"] {
  flex: 1 1 100%;
  font: inherit; color: var(--color-paper);
  background: var(--color-void-2);
  border: var(--rule-hair) solid var(--color-rule-void);
  border-radius: var(--radius-input);
  min-height: 48px; padding: 0.75rem 1rem;
  text-align: center;
  transition: border-color var(--dur-short) var(--ease-out);
}
.signup input[type="email"]::placeholder { color: var(--color-dim); }
@media (hover: hover) and (pointer: fine) {
  .signup input[type="email"]:hover { border-color: var(--color-dim); }
}
.signup input[type="email"]:focus-visible { outline: 2px solid var(--color-focus-inv); outline-offset: 1px; }
.signup input[type="email"][aria-invalid="true"] { border-color: var(--color-sand); }
.signup input:disabled { opacity: 0.55; cursor: not-allowed; }

.btn {
  flex: 1 1 100%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-paper); color: var(--color-ink);
  font: inherit; font-weight: 500;
  min-height: 48px; padding: 0.75rem 1.5rem;
  border: var(--rule-hair) solid transparent; border-radius: var(--radius-input);
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out),
              transform var(--dur-micro) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--color-sand); transform: translateY(-1px); }
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-focus-inv); outline-offset: 3px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

.field__error {
  flex: 1 1 100%;
  min-height: 1lh;
  font-size: var(--text-sm); color: var(--color-sand);
}

/* ---------- footer ---------- */

.foot {
  padding: var(--space-md) var(--page-gutter) max(var(--space-lg), env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--space-xs) var(--space-lg);
}
.foot__links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-lg); }
.foot__links a {
  color: var(--color-dim); text-decoration: none;
  font-size: var(--text-sm); white-space: nowrap;
  min-height: 44px; display: inline-flex; align-items: center;
}
@media (hover: hover) and (pointer: fine) {
  .foot__links a:hover { color: var(--color-paper); text-decoration: underline; text-underline-offset: 3px; }
}
.foot__fine { font-size: var(--text-xs); color: var(--color-dim); }

/* ---------- grain ---------- */

.grain {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.05;
  pointer-events: none;
  z-index: var(--z-grain);
}

/* ---------- ≥ 40rem ---------- */

@media (min-width: 40rem) {
  .signup { max-width: 26rem; margin-inline: auto; }
  .signup input[type="email"] { flex: 1 1 12rem; text-align: left; }
  .btn { flex: 0 0 auto; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; transform: rotateY(24deg); }
  .contour--main { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .body { animation: none; opacity: 1; }
  .patch--heel   { animation: none; opacity: var(--show-heel, 1); }
  .patch--instep { animation: none; opacity: var(--show-instep, 1); }
  .patch--toe    { animation: none; opacity: var(--show-toe, 1); }
  *, *::before, *::after { transition-duration: 1ms !important; }
}
