/* ==========================================================================
   ADW Studium — Coming Soon
   Colors from the ADW Studium Design System v2
   ========================================================================== */

/* Fonts (self-hosted, SIL Open Font License) */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/space-grotesk-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/space-grotesk-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/space-grotesk-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  --blue-slate: #4776D8;
  --blue: #1665F6;
  --blue-deep: #0024D8;
  --white: #FFFFFF;
  --ink: #12151c;          /* text on the light scene */
  --ink-soft: #2a2f3a;

  --font-brand: 'General Sans', 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 3.4vw, 3.5rem);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* --fg is driven by JS from the scene's light (night → day), so text follows the light smoothly */
  --fg: #F3F1EC;
}

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

/* Base size scales up on very large screens */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (min-width: 1920px) { html { font-size: 18px; } }
@media (min-width: 2560px) { html { font-size: 22px; } }
@media (min-width: 3400px) { html { font-size: 28px; } }

html, body { height: 100%; }
body {
  background: #0a0f1c;
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Scene ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.scene-fallback {
  position: fixed; inset: 0; z-index: 0; display: none;
  background: radial-gradient(120% 90% at 50% 20%, #f6f1e8 0%, #dfe4ee 35%, #8ea3c7 70%, #3b4a6b 100%);
}
.no-webgl #scene { display: none; }
.no-webgl .scene-fallback { display: block; }

/* ---------- Stage / parallax layer ---------- */
.stage { position: fixed; inset: 0; z-index: 1; perspective: 1200px; overflow: hidden; }
.stage__inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------- Top bar ---------- */
.topbar {
  position: absolute; left: var(--gutter); right: var(--gutter);
  top: calc(var(--gutter) * .9 + env(safe-area-inset-top));
  display: flex; justify-content: space-between; align-items: center;
  opacity: 0; transition: opacity 1.6s var(--ease-soft);
}
.is-ready .topbar { opacity: 1; }

.brand {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.link-btn {
  background: none; border: 0; cursor: pointer;
  font: 500 .75rem/1 var(--font-mono);
  letter-spacing: .04em;
  color: var(--fg);
  opacity: .78;
  padding: .5rem 0;
  position: relative;
  transition: opacity .3s;
}
.link-btn::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .2rem; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .5s var(--ease-out);
}
.link-btn:hover { opacity: 1; }
.link-btn:hover::after { transform: scaleX(1); transform-origin: left; }
.link-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 2px; }
#skip { transition: opacity .6s, visibility .6s; }
.is-final #skip { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- Intro lines ---------- */
.intro { position: absolute; inset: 0; pointer-events: none; }
.intro__line {
  position: absolute; left: var(--gutter); right: var(--gutter);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.2vw, 6.25rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--fg);
  visibility: hidden;
}
.intro__line.is-active { visibility: visible; }
.intro__line--center { top: 50%; transform: translateY(-58%); }
.intro__line--top { top: 25%; transform: translateY(-50%); }
.is-night .intro__line { text-shadow: 0 0 40px rgba(120, 160, 255, .22); }

/* ---------- Character "decode" animation ---------- */
.word { display: inline-block; white-space: nowrap; }
.ch {
  display: inline-block;
  position: relative;
  opacity: 0;
  filter: blur(10px);
  transform: translate3d(0, .06em, 0);
  transition:
    opacity 1s var(--ease-soft),
    filter 1.1s var(--ease-soft),
    transform 1.1s var(--ease-soft);
  will-change: opacity, filter, transform;
}
.ch::after {                       /* the flickering random glyph */
  content: attr(data-g);
  position: absolute; left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  font: 500 .5em/1 var(--font-mono);
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
}
.ch.is-scr { opacity: .5; filter: blur(1.5px); color: transparent; transition-duration: .2s; }
.ch.is-scr::after { opacity: 1; color: var(--fg); }
.ch.is-in { opacity: 1; filter: blur(0); transform: none; }
.ch.is-out {
  opacity: 0; filter: blur(12px);
  transform: translate3d(0, -.04em, 0);
  transition: opacity .75s var(--ease-io), filter .85s var(--ease-io), transform .85s var(--ease-io);
}

/* ---------- Floating glyphs around messages (Echo-style) ---------- */
.glyphs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.glyph {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 500 .8125rem/1 var(--font-mono);
  letter-spacing: .04em;
  color: var(--fg);
  opacity: 0;
  filter: blur(4px);
  transition: opacity 1.1s ease, filter 1.1s ease, transform 4.5s linear;
}
.glyph.is-on { opacity: .62; filter: blur(0); }
.glyph--big { font-size: 1.0625rem; }
.glyph--dim.is-on { opacity: .32; }
.glyph.is-off { opacity: 0; filter: blur(4px); transition: opacity .9s ease, filter .9s ease, transform 4.5s linear; }
.glyph.is-gone { transition: opacity 1.2s ease, filter 1.2s ease; }
.glyph-corner {
  position: absolute;
  width: 7px; height: 7px;
  border: 1px solid var(--fg);
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0;
  transition: opacity .6s ease, transform .9s var(--ease-soft);
}
.glyph-corner.is-on { opacity: .4; transform: translate(-50%, -50%) scale(1); }
.glyph-corner.is-off { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
.glyph-index {
  position: absolute;
  font: 500 .625rem/1 var(--font-mono);
  letter-spacing: .2em;
  color: var(--fg);
  opacity: 0;
  transition: opacity .8s ease;
}
.glyph-index.is-on { opacity: .45; }

/* ---------- Hero (04 Coming soon) ---------- */
.hero, .bottombar { visibility: hidden; }
.is-final .hero, .is-final .bottombar { visibility: visible; }

.hero {
  position: absolute;
  left: calc(var(--gutter) * 1.25);
  top: clamp(5.5rem, 19vh, 30vh);
  width: max-content;
  max-width: min(58vw, 72rem);
  color: var(--ink);
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .7em;
  font: 500 .75rem/1 var(--font-mono);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 1.4rem;
}
.hero__eyebrow::before {
  content: ""; width: 1.6rem; height: 1px; background: currentColor;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, min(4.6vw, 8.6vh), 5.75rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.hero__sub {
  font: 400 clamp(1rem, 1.25vw, 1.375rem)/1.45 var(--font-body);
  color: var(--ink-soft);
  margin-bottom: 2.4rem;
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  filter: blur(8px);
  transition: opacity 1.2s var(--ease-soft), transform 1.4s var(--ease-soft), filter 1.2s var(--ease-soft);
  transition-delay: var(--d, 0s);
}
.is-final .reveal { opacity: 1; transform: none; filter: blur(0); }

/* ---------- Form ---------- */
.notify { display: flex; gap: .5rem; width: min(100%, 27rem); }
.notify__input {
  flex: 1 1 auto; min-width: 0;
  height: 3rem; padding: 0 1rem;
  font: 400 .9375rem var(--font-body);
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(18, 21, 28, .16);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.notify__input::placeholder { color: #6c7280; }
.notify__input:hover { background: rgba(255, 255, 255, .85); }
.notify__input:focus {
  outline: none; background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(22, 101, 246, .14);
}
.notify__input[aria-invalid="true"] { border-color: #c2412d; }

.notify__btn {
  flex: 0 0 auto;
  height: 3rem; padding: 0 1.5rem;
  font: 500 .9375rem var(--font-body);
  color: #fff;
  background: var(--blue);
  border: 0; border-radius: 4px;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: background .25s, transform .25s var(--ease-out), box-shadow .3s;
}
.notify__btn::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .8s var(--ease-out);
}
.notify__btn:hover { background: #0f58e0; box-shadow: 0 8px 24px -8px rgba(22, 101, 246, .7); }
.notify__btn:hover::before { transform: translateX(120%); }
.notify__btn:active { transform: scale(.97); }
.notify__btn:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 3px; }
.notify__btn[disabled] { cursor: progress; opacity: .8; }
.is-loading .notify__btn-label { opacity: 0; }
.is-loading .notify__btn::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 1.1rem; height: 1.1rem; margin: -.55rem 0 0 -.55rem;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notify__msg { min-height: 1.5em; margin-top: .8rem; font: 500 .875rem/1.4 var(--font-body); color: var(--ink-soft); }
.notify__msg.is-error { color: #b0361f; }
.notify__msg.is-success { color: var(--blue-deep); }
.notify.is-done { display: none; }

/* ---------- Bottom bar + progress ---------- */
.bottombar {
  position: absolute;
  left: calc(var(--gutter) * 1.25);
  right: var(--gutter);
  bottom: calc(var(--gutter) * .9 + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
}
.progress { display: flex; align-items: flex-end; gap: 1.1rem; color: #fff; }
.progress__pct {
  font: 500 2.5rem/.82 var(--font-mono);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 28px rgba(60, 130, 255, .55);
  min-width: 3ch;
}
.progress__pct small { font-size: .42em; margin-left: .12em; opacity: .7; letter-spacing: 0; }
.progress__meta { display: flex; flex-direction: column; gap: .7rem; padding-bottom: .15rem; }
.progress__label {
  display: inline-flex; align-items: center; gap: .65em;
  white-space: nowrap;
  font: 500 .6875rem/1 var(--font-mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
}
.progress__label::before {               /* live status dot */
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #4d8dff;
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(77, 141, 255, .75); }
  100% { box-shadow: 0 0 0 9px rgba(77, 141, 255, 0); }
}
.progress__track {
  position: relative; display: block;
  width: clamp(9rem, 15vw, 18rem); height: 4px;
  background: rgba(255, 255, 255, .16);
  border-radius: 4px;
}
.progress__track::after {                 /* 10% tick marks */
  content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 4px;
  background: repeating-linear-gradient(to right, rgba(255,255,255,.35) 0 1px, transparent 1px 10%);
  opacity: .7;
}
.progress__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #1d4fd6 0%, #1665F6 35%, #9cc3ff 50%, #1665F6 65%, #1d4fd6 100%);
  background-size: 220% 100%;
  animation: flow 2.6s linear infinite;
  box-shadow: 0 0 14px rgba(40, 110, 255, .85), 0 0 2px rgba(255,255,255,.6);
}
.progress__fill::after {                  /* glowing head */
  content: ""; position: absolute; right: -5px; top: 50%;
  width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 101, 246, .45), 0 0 18px 5px rgba(90, 150, 255, .9);
  animation: headPulse 1.8s ease-in-out infinite;
}
@keyframes flow { from { background-position: 100% 0; } to { background-position: -120% 0; } }
@keyframes headPulse { 50% { box-shadow: 0 0 0 5px rgba(22, 101, 246, .25), 0 0 26px 8px rgba(90, 150, 255, .75); } }

#replay { white-space: nowrap; color: #fff; opacity: .9; text-shadow: 0 1px 8px rgba(0,0,0,.25); }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Phones & portrait tablets — text on top, figure centered below */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .hero {
    left: var(--gutter); right: var(--gutter);
    top: calc(env(safe-area-inset-top) + clamp(5.5rem, 13vh, 9rem));
    width: auto; max-width: none;
  }
  .hero__eyebrow { margin-bottom: 1rem; }
  .hero__title { font-size: clamp(2.1rem, 9.5vw, 4.5rem); }
  .hero__sub { margin-bottom: 1.6rem; font-size: 1rem; }
  .notify { width: 100%; max-width: 30rem; }
  .bottombar { left: var(--gutter); }
  .progress { gap: .8rem; }
  .progress__pct { font-size: 2rem; }
  .progress__track { width: clamp(5.5rem, 26vw, 12rem); }
  .progress__label { letter-spacing: .14em; }
  .intro__line { font-size: clamp(2rem, 9.6vw, 5rem); }
  .intro__line--center { top: 40%; }
  .intro__line--top { top: 24%; }
}

/* Small phones: stack input + button */
@media (max-width: 420px) {
  .notify { flex-direction: column; }
  .notify__btn { width: 100%; }
  .hero__title br { display: none; }
}

/* Short landscape phones */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .hero { top: 4.25rem; max-width: 60vw; }
  .hero__eyebrow { margin-bottom: .6rem; }
  .hero__title { font-size: clamp(1.8rem, 5.6vh + 1.2vw, 2.8rem); margin-bottom: .4rem; }
  .hero__sub { margin-bottom: 1rem; font-size: .9rem; }
  .notify__input, .notify__btn { height: 2.6rem; }
  .notify__msg { margin-top: .4rem; }
  .progress__pct { font-size: 1.75rem; }
}

/* Large screens */
@media (min-width: 1920px) {
  .hero, .bottombar { left: calc(var(--gutter) * 1.6); }
}

@media (prefers-reduced-motion: reduce) {
  .ch, .reveal { transition-duration: .01s !important; }
  .progress__fill, .progress__fill::after, .progress__label::before { animation: none; }
}
