/* Halvenne. Concept by BOMA Designs. Fonts: Cormorant Garamond and Jost, SIL OFL 1.1 (see fonts/). */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/lab/_shared/fonts/cormorant-garamond-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("/lab/_shared/fonts/cormorant-garamond-latin-300-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/jost-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/jost-latin-500-normal.woff2") format("woff2");
}

:root {
  --ivory: #F6F1E7;
  --muted: #C9C2B4;
  --hair: rgba(246, 241, 231, 0.28);
  --glow: #FFC27A;
  --core: #FFD9A0;
  --scrim: rgba(8, 10, 20, 0.55);
  --night: #05081A;
  --inset: 64px;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --out: cubic-bezier(0.16, 1, 0.3, 1);
  --roll: cubic-bezier(0.22, 1, 0.36, 1);
  --rail-h: 60vh;
  --rail-r: 32px;
}

* { box-sizing: border-box; }

html {
  background: var(--night);
  color: var(--ivory);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  font: 300 16px/1.55 var(--sans);
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.spacer { height: 1060vh; width: 1px; pointer-events: none; }

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--night);
  animation: stage-in 1200ms ease-out both;
}
#stage:focus-visible { outline: 1px solid var(--ivory); outline-offset: -6px; }
@keyframes stage-in { from { opacity: 0; } to { opacity: 1; } }

/* Scrims keep ivory text readable over bright daytime sky and sea. */
.scrim { position: fixed; pointer-events: none; z-index: 1; }
.scrim-t {
  left: 0; top: 0; width: 70vw; height: 46vh;
  background: radial-gradient(ellipse at 0% 0%, rgba(8, 10, 20, 0.42) 0%, rgba(8, 10, 20, 0.22) 38%, transparent 72%);
}
.scrim-b {
  left: 0; right: 0; bottom: 0; height: 40vh;
  background: linear-gradient(to top, var(--scrim), transparent);
}

.eyebrow {
  margin: 0;
  font: 500 11px/1.4 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory);
}

/* Clock */
.clock {
  position: fixed;
  z-index: 3;
  left: var(--inset);
  top: var(--inset);
  pointer-events: none;
  text-shadow: 0 1px 18px rgba(8, 10, 20, 0.35);
}
.clock-face { position: relative; font: 300 clamp(60px, 6.8vw, 100px)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
.clock-digits { display: flex; align-items: flex-start; height: 1em; }
.dg { display: block; position: relative; width: 0.5em; height: 1em; overflow: hidden; text-align: center; }
.strip { display: block; will-change: transform; transition: transform 280ms var(--roll); }
.strip.cont { transition: none; }
.strip span { display: block; height: 1em; line-height: 1; }
.colon { display: block; width: 0.28em; height: 1em; line-height: 0.92; text-align: center; }
.clock-ghost {
  position: absolute; left: 0; top: 0; height: 1em; line-height: 1; white-space: pre;
  opacity: 0; will-change: transform, opacity;
  transition: opacity 160ms ease-out;
}
.clock-ghost.on { opacity: 0.25; }
.clock-part { margin-top: 10px; padding-left: 3px; }

/* Intro */
.intro {
  position: fixed; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
  padding: 0 24px 16vh;
}
.intro-inner { will-change: transform, opacity; }
.brand {
  margin: 14px 0 10px;
  font: italic 300 clamp(56px, 9vw, 140px)/1 var(--serif);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 40px rgba(8, 10, 20, 0.4);
}
.brand .ch {
  display: inline-block;
  animation: rise 900ms var(--out) both;
  animation-delay: calc(var(--i) * 40ms + 250ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.intro-line { margin: 0; font: 300 clamp(15px, 1.5vw, 18px)/1.5 var(--sans); color: var(--ivory); letter-spacing: 0.02em; }
.hint {
  position: absolute; left: 0; right: 0; bottom: calc(40px + env(safe-area-inset-bottom));
  margin: 0; text-align: center;
  font: 500 11px/1.4 var(--sans); letter-spacing: 0.22em; text-transform: uppercase;
  animation: pulse 2400ms ease-in-out infinite;
}
.hint.gone { display: none; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Moment cards (driven by scene time in main.js) */
.cards { position: fixed; z-index: 3; left: var(--inset); bottom: var(--inset); width: min(420px, calc(100vw - 2 * var(--inset))); height: 0; pointer-events: none; }
.card { position: absolute; left: 0; bottom: 0; width: 100%; }
.card > * { opacity: 0; will-change: transform, opacity; }
.card.hidden { visibility: hidden; }
.card h2 {
  margin: 12px 0 10px;
  font: 300 clamp(36px, 3.6vw, 54px)/1.04 var(--serif);
  color: var(--ivory);
  text-shadow: 0 1px 24px rgba(8, 10, 20, 0.4);
}
.card .body { margin: 0; font: 300 16px/1.6 var(--sans); color: var(--muted); max-width: 36ch; }
.card.end h2 { margin-top: 0; font-size: clamp(38px, 4vw, 60px); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.card .actions { pointer-events: auto; }
.btn {
  appearance: none; cursor: pointer;
  font: 500 11px/1 var(--sans); letter-spacing: 0.22em; text-transform: uppercase;
  color: #0b0f22; background: var(--ivory);
  border: 1px solid var(--ivory); border-radius: 999px;
  padding: 0 24px; min-height: 44px;
  transition: opacity 200ms ease-out;
}
.btn-ghost { color: var(--ivory); background: rgba(8, 10, 20, 0.3); border-color: var(--hair); }
.btn:hover { opacity: 0.88; }
.btn:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }
.note { margin: 14px 0 0; min-height: 1.6em; font: 300 14px/1.6 var(--sans); color: var(--ivory); opacity: 0; transition: opacity 400ms ease-out; }
.note.show { opacity: 1; }

/* Play hint */
.play-hint {
  position: fixed; z-index: 3; margin: 0;
  right: var(--rail-r); top: calc(20vh - 44px);
  max-width: 190px; text-align: right;
  font: 300 13px/1.45 var(--sans); color: var(--ivory);
  text-shadow: 0 1px 12px rgba(8, 10, 20, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 600ms ease-out;
}
.play-hint.on { opacity: 0.9; }

/* Time rail */
.rail {
  position: fixed; z-index: 4;
  right: var(--rail-r); top: 50%; transform: translateY(-50%);
  width: 44px; height: var(--rail-h);
  touch-action: none; cursor: pointer; outline: none;
  -webkit-user-select: none; user-select: none;
}
.rail:focus-visible .rail-line { background: var(--ivory); }
.rail-line { position: absolute; right: 0; top: 0; bottom: 0; width: 1px; background: var(--hair); }
.tick { position: absolute; right: 0; width: 6px; height: 1px; background: rgba(246, 241, 231, 0.55); box-shadow: 0 0 6px rgba(8, 10, 20, 0.35); pointer-events: none; }
.tick.long { width: 14px; background: var(--ivory); }
.tick-label {
  position: absolute; right: 20px; transform: translateY(-50%);
  font: 500 9px/1 var(--sans); letter-spacing: 0.14em; color: var(--ivory);
  text-shadow: 0 0 8px rgba(8, 10, 20, 0.5);
  pointer-events: none;
}
.rail-marker {
  position: absolute; right: -4.5px; top: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 0 0 4px rgba(246, 241, 231, 0.18), 0 0 12px rgba(8, 10, 20, 0.4);
  will-change: transform; pointer-events: none;
}

.credit {
  position: fixed; z-index: 3; right: 32px; bottom: calc(26px + env(safe-area-inset-bottom)); margin: 0;
  font: 300 11px/1.4 var(--sans); letter-spacing: 0.06em; color: var(--ivory); opacity: 0.6;
  pointer-events: none;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Desktop: keep the title clear of the house */
@media (min-width: 700px) {
  .intro { padding-right: 34vw; }
  .hint { right: 34vw; }
}

/* Phone */
@media (max-width: 699px) {
  :root { --inset: 20px; --rail-r: 16px; --rail-h: 50vh; }
  .rail { top: 16vh; transform: none; }
  .clock-face { font-size: 60px; }
  .cards { width: calc(100vw - 40px); bottom: calc(46px + env(safe-area-inset-bottom)); }
  .card h2 { font-size: 34px; }
  .card .body { font-size: 15px; max-width: none; }
  .play-hint { top: calc(16vh - 42px); max-width: 150px; font-size: 12px; }
  .intro { padding-bottom: 24vh; }
  .credit { right: 20px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .scrim-t { width: 100vw; height: 36vh; }
}

/* Reduced motion: calm fallback, content and idea stay reachable */
@media (prefers-reduced-motion: reduce) {
  #stage { animation-duration: 200ms; }
  .brand .ch { animation: fade 200ms ease-out both; animation-delay: 0ms; }
  .hint { animation: none; opacity: 0.85; }
  .strip { transition: none; }
  .clock-ghost { display: none; }
  .card > *, .intro-inner, .hint { transition: opacity 200ms linear; }
  .play-hint { transition: opacity 200ms linear; }
  .note { transition: opacity 200ms linear; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
