/* ════════════════════════════════════════════════════════════════════
   EXYPNOS · COUNTDOWN — "The Sands of Orbit"
   The oldest timer meets the oldest sky. A celestial hourglass: its sand
   is star-grains and small planets, streaming down past a sun caught in
   its waist, which is ringed by tilted orbits bearing worlds. Time is read
   as the level of the sands.
   ════════════════════════════════════════════════════════════════════ */

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

:root {
  --bg:          #000;
  --ink:         #f4efe5;
  --ink-soft:    rgba(244, 239, 229, 0.62);
  --ink-faint:   rgba(244, 239, 229, 0.30);
  --line:        rgba(255, 210, 130, 0.14);
  --line-strong: rgba(255, 210, 130, 0.28);
  --amber:       #ffd282;
  --amber-soft:  rgba(255, 210, 130, 0.55);
  --ember:       #c46a4a;
  --sage:        #8fb795;
  --cream:       #f4e8c8;
  --lora:        'Lora', Georgia, serif;
  --geist:       'Geist', 'Helvetica Neue', sans-serif;
  --mono:        'JetBrains Mono', 'SF Mono', monospace;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--lora);
  overflow-x: hidden;
  min-height: 100svh;
}
::selection { background: rgba(255, 210, 130, 0.36); color: #1a1208; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(255, 210, 130, 0.10), transparent 65%),
    radial-gradient(ellipse 70% 55% at 50% 115%, rgba(15, 10, 5, 0.72), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  pointer-events: none;
  z-index: 200;
  opacity: 0.32;
  mix-blend-mode: screen;
}

#starfield, #aurora {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
#aurora { z-index: 0; opacity: 0.55; }

/* ── Fixed furniture ── */
.edition-stamp {
  position: fixed; right: 26px; top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: right center;
  font-family: var(--geist); font-size: 0.52rem; letter-spacing: 0.5em;
  text-transform: uppercase; color: rgba(255, 210, 130, 0.24);
  white-space: nowrap; pointer-events: none; z-index: 5;
  display: flex; align-items: center; gap: 0.9em;
}
.edition-stamp::after { content: ''; display: inline-block; width: 16px; height: 1px; background: rgba(255, 210, 130, 0.34); }

.corner-mark { position: fixed; width: 15px; height: 15px; pointer-events: none; z-index: 5; opacity: 0.4; }
.corner-mark::before, .corner-mark::after { content: ''; position: absolute; background: rgba(255, 210, 130, 0.55); }
.corner-mark::before { top: 50%; left: 0; width: 100%; height: 1px; }
.corner-mark::after  { left: 50%; top: 0; width: 1px; height: 100%; }
.corner-mark.tr { top: 22px; right: 22px; }
.corner-mark.bl { bottom: 22px; left: 22px; }

.brand-link { position: fixed; top: 20px; left: 22px; z-index: 40; display: inline-block; transition: opacity 0.3s ease; }
.brand-link:hover { opacity: 0.82; }
.brand-logo { height: 104px; width: auto; display: block; }

.back-link {
  position: fixed; top: 30px; right: 30px; z-index: 40;
  display: inline-flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid rgba(255, 210, 130, 0.22);
  background: rgba(8, 6, 4, 0.5); backdrop-filter: blur(8px);
  color: rgba(255, 210, 130, 0.85);
  font-family: var(--geist); font-size: 0.62rem; letter-spacing: 0.26em;
  text-transform: uppercase; text-decoration: none;
  transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}
.back-link:hover { border-color: var(--amber); background: rgba(255, 210, 130, 0.06); color: var(--ink); }
.back-link svg { transition: transform 0.3s cubic-bezier(.22,1,.36,1); }
.back-link:hover svg { transform: translateX(-3px); }

/* ── Stage ── */
.page {
  position: relative; z-index: 3; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: 96px 24px 52px;
}
.stage {
  position: relative; width: 100%; max-width: 860px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.amb { position: absolute; display: block; opacity: 0.5; animation: ambDrift 9s ease-in-out infinite; pointer-events: none; z-index: 0; }
.amb svg { display: block; width: 100%; height: 100%; }
@keyframes ambDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.16; }
  50%      { transform: translateY(-14px) rotate(18deg); opacity: 0.55; }
}
.eyebrow, .headline, .kicker, .hourglass-wrap, .readout, .subline, .enter-btn { position: relative; z-index: 1; }

/* ── Masthead ── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 13px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--amber);
  animation: rise 0.9s cubic-bezier(.22,1,.36,1) both;
}
.eyebrow::before, .eyebrow::after { content: ''; width: 26px; height: 1px; background: rgba(255, 210, 130, 0.45); }

.headline {
  font-family: var(--lora); font-style: italic; font-weight: 500;
  line-height: 1.08; font-size: clamp(1.8rem, 4.4vw, 3.1rem);
  letter-spacing: -0.01em; color: var(--ink); margin-bottom: 4px;
  animation: rise 1s cubic-bezier(.22,1,.36,1) 0.06s both;
}
.headline .accent { color: var(--amber); }
.kicker {
  font-family: var(--geist); font-size: clamp(0.66rem, 1.3vw, 0.78rem);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
  margin-bottom: 2px;
  animation: rise 1s cubic-bezier(.22,1,.36,1) 0.12s both;
}

/* ── The hourglass ── */
.hourglass-wrap {
  width: clamp(288px, 44vw, 412px);
  aspect-ratio: 560 / 690;
  margin: 0 auto;
  animation: rise 1.1s cubic-bezier(.22,1,.36,1) 0.18s both;
}
.hourglass { width: 100%; height: 100%; display: block; }

/* ── Readout — an engraved inscription, not a box ── */
.readout { margin-top: 6px; animation: rise 1s cubic-bezier(.22,1,.36,1) 0.32s both; }
.ro-line { display: inline-flex; align-items: baseline; gap: clamp(7px, 1.7vw, 17px); }
.ro-grp { display: inline-flex; align-items: baseline; gap: 3px; }
.ro-num {
  font-family: var(--lora); font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 6.4vw, 3.5rem); line-height: 1; color: var(--cream);
  text-shadow: 0 0 24px rgba(255, 210, 130, 0.28);
}
.ro-num.flip { animation: flip 0.5s cubic-bezier(.22,1,.36,1); }
@keyframes flip {
  0%   { opacity: 0.15; transform: translateY(-3px) scale(0.96); filter: blur(0.5px); }
  100% { opacity: 1;    transform: translateY(0) scale(1);       filter: blur(0); }
}
.ro-u {
  font-family: var(--mono); font-size: clamp(0.66rem, 1.5vw, 0.92rem);
  letter-spacing: 0.06em; color: var(--amber); text-transform: uppercase;
  align-self: flex-start; margin-top: 0.24em;
}
.ro-sep {
  font-family: var(--lora); color: rgba(255, 210, 130, 0.38);
  font-size: clamp(1.3rem, 3.6vw, 2rem); align-self: center;
}
.ro-date {
  margin-top: 13px; font-family: var(--mono);
  font-size: clamp(0.6rem, 1.4vw, 0.74rem); letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-soft);
}
.ro-date .g { color: var(--amber-soft); }
.ro-date .dot { color: var(--ember); padding: 0 0.35em; }

.subline {
  max-width: 30rem; margin-top: 18px;
  font-family: var(--lora); font-style: italic;
  font-size: clamp(0.92rem, 1.7vw, 1.1rem); line-height: 1.55; color: var(--ink-soft);
  animation: rise 1s ease 0.4s both;
}

/* ── Emptied (done) state ── */
.stage.is-done .headline { color: var(--amber); }
.stage.is-done .ro-num { color: var(--amber); text-shadow: 0 0 32px rgba(255, 210, 130, 0.6); }
.enter-btn {
  display: none; align-items: center; gap: 0.8rem; margin-top: 26px;
  padding: 0.85rem 1.6rem; border: 1px solid var(--amber-soft);
  background: rgba(255, 210, 130, 0.06);
  font-family: var(--geist); font-size: 0.72rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--cream); text-decoration: none;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.enter-btn svg { transition: transform 0.3s cubic-bezier(.22,1,.36,1); }
.enter-btn:hover { background: rgba(255, 210, 130, 0.13); border-color: var(--amber); transform: translateY(-1px); }
.enter-btn:hover svg { transform: translateX(4px); }
.stage.is-done .enter-btn { display: inline-flex; animation: rise 0.8s cubic-bezier(.22,1,.36,1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ── Responsive ── */
@media (max-width: 720px) {
  .brand-logo { height: 74px; }
  .back-link { top: 18px; right: 14px; padding: 0.42rem 0.7rem; font-size: 0.56rem; letter-spacing: 0.18em; }
  .page { padding: 92px 12px 48px; }
  .hourglass-wrap { width: clamp(268px, 76vw, 360px); }
}
@media (max-width: 460px) {
  .eyebrow { font-size: 0.54rem; letter-spacing: 0.3em; gap: 8px; }
  .eyebrow::before, .eyebrow::after { width: 15px; }
  .ro-line { gap: 6px; }
  .ro-num { font-size: clamp(1.7rem, 12vw, 2.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .amb { animation: none !important; }
  .eyebrow, .headline, .kicker, .hourglass-wrap, .readout, .subline, .enter-btn { animation: none !important; }
  .ro-num.flip { animation: none !important; }
}
