/* ============ $SKOLL design system ============ */
:root {
  --space: #050508;
  --starlight: #e8e4da;
  --starlight-dim: #9a968c;
  --gold: #ffb347;
  --gold-hot: #ffd98a;
  --blood: #b3121b;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Cinzel", serif;
  --body: "Inter", system-ui, sans-serif;
}

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

html { scroll-behavior: auto; }

body {
  background: var(--space);
  color: var(--starlight);
  font-family: var(--body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ Canvas ============ */
#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  touch-action: pan-y;
}
body.map-active #gl { touch-action: none; }

/* ============ Fallback (no WebGL) ============ */
#fallback { display: none; }
body.no-webgl #gl { display: none; }
body.no-webgl #fallback {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--space);
}
body.no-webgl .fallback-eclipse {
  position: absolute;
  top: 38%; left: 50%;
  width: min(52vw, 44vh);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #07070b;
  box-shadow:
    0 0 60px 18px rgba(255, 179, 71, 0.55),
    0 0 160px 60px rgba(255, 179, 71, 0.28),
    0 0 320px 120px rgba(255, 179, 71, 0.12);
}

/* ============ Header ============ */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem 1.6rem;
  background: linear-gradient(to bottom, rgba(5,5,8,0.85), rgba(5,5,8,0));
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
}
#tabs { display: flex; gap: 0.4rem; }
.tab {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--starlight-dim);
  background: none;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--starlight); }
.tab.active {
  color: var(--gold);
  border-color: rgba(255, 179, 71, 0.35);
}

/* ============ Countdown ============ */
.countdown {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  white-space: nowrap;
}
#countdown-header { margin-left: auto; }
.cd-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--starlight-dim);
}
.cd-time {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--starlight);
  font-variant-numeric: tabular-nums;
}
body.escaped .cd-label { color: var(--blood); }
body.escaped .cd-time { display: none; }

#countdown-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  justify-content: center;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(5,5,8,0.92), rgba(5,5,8,0));
}

@media (max-width: 760px) {
  #countdown-header { display: none; }
  #countdown-bar { display: flex; }
  #header { gap: 1rem; padding: 0.8rem 1rem; }
  .hero-countdown { margin-bottom: 4.5rem; padding: 1.1rem 1.2rem 1rem; }
}

/* ============ Lore sections ============ */
#home-view { position: relative; z-index: 10; }

.lore {
  min-height: 118vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem;
  position: relative;
}
.lore-inner {
  max-width: 34rem;
  text-align: center;
}
.lore h1, .lore h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  letter-spacing: 0.14em;
  color: var(--starlight);
  margin-bottom: 2.2rem;
  text-shadow: 0 0 30px rgba(5,5,8,0.9);
}
.lore p {
  font-size: clamp(0.98rem, 2.2vw, 1.12rem);
  font-weight: 400;
  line-height: 1.9;
  margin-bottom: 1.4rem;
  color: var(--starlight);
  text-shadow: 0 1px 18px rgba(5,5,8,0.95), 0 0 6px rgba(5,5,8,0.9);
}
.lore .beat {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-top: 2.4rem;
}
#s4 .beat { color: var(--blood); }
#s1 { min-height: 100vh; }

/* First section: give the sun room, copy sits lower */
#s1 .lore-inner { margin-top: 34vh; }

.scroll-hint {
  margin: 3rem auto 0;
  width: 1.4rem; height: 2.4rem;
  border: 1px solid rgba(232,228,218,0.35);
  border-radius: 0.8rem;
  position: relative;
}
.scroll-hint span {
  position: absolute;
  top: 0.4rem; left: 50%;
  width: 3px; height: 6px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--gold);
  animation: hint 1.8s ease-in-out infinite;
}
@keyframes hint {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(0.9rem); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============ Kickers ============ */
.kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 1.4rem;
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  color: var(--gold);
  opacity: 0.85;
}
.kicker::before, .kicker::after {
  content: "";
  height: 1px;
  width: 3.5rem;
  background: linear-gradient(to var(--dir, right), transparent, rgba(255,179,71,0.55));
}
.kicker::before { --dir: right; }
.kicker::after { --dir: left; }
.kicker.blood { color: var(--blood); }
.kicker.blood::before, .kicker.blood::after {
  background: linear-gradient(to var(--dir, right), transparent, rgba(179,18,27,0.7));
}

/* ============ Hero countdown ============ */
.hero-countdown {
  margin: 3.2rem auto 0;
  display: inline-block;
  padding: 1.4rem 2rem 1.2rem;
  border: 1px solid rgba(255,179,71,0.28);
  background: rgba(5,5,8,0.55);
  box-shadow: 0 0 40px rgba(255,179,71,0.08), inset 0 0 30px rgba(255,179,71,0.04);
  backdrop-filter: blur(3px);
}
.hc-label {
  display: block;
  margin-bottom: 0.9rem;
  color: var(--gold) !important;
  animation: hcPulse 2.4s ease-in-out infinite;
}
@keyframes hcPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}
.hc-cells {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7rem;
}
.hc-cell { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; }
.hc-num {
  font-family: var(--mono);
  font-size: clamp(2.1rem, 7.5vw, 3.4rem);
  font-weight: 500;
  color: var(--starlight);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px rgba(255,179,71,0.55), 0 0 60px rgba(255,179,71,0.25);
}
.hc-sep {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 5.5vw, 2.6rem);
  color: rgba(255,179,71,0.6);
  transform: translateY(-0.4rem);
  animation: hcPulse 1s steps(2, jump-none) infinite;
}
.hc-unit {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--starlight-dim);
}
body.escaped .hero-countdown .hc-cells { display: none; }
body.totality-now .hc-num { color: var(--blood); text-shadow: 0 0 26px rgba(179,18,27,0.7); }

.credits {
  margin-top: 3.5rem;
  font-size: 0.6rem !important;
  letter-spacing: 0.12em;
  color: rgba(154,150,140,0.5) !important;
  text-shadow: none !important;
}

/* ============ Art ============ */
.cta-emblem {
  display: block;
  width: min(13rem, 46vw);
  margin: 0 auto 2rem;
  border-radius: 50%;
  box-shadow: 0 0 45px rgba(255, 179, 71, 0.28), 0 0 120px rgba(255, 179, 71, 0.12);
}

/* ============ CTA ============ */
.cta { max-width: 40rem; }
.cta-title {
  font-size: clamp(2.6rem, 9vw, 4.6rem) !important;
  color: var(--gold) !important;
  letter-spacing: 0.18em !important;
  margin-bottom: 0.6rem !important;
  text-shadow: 0 0 40px rgba(255,179,71,0.35) !important;
}
.cta-sub {
  font-family: var(--display);
  letter-spacing: 0.1em;
  color: var(--starlight);
  margin-bottom: 3rem !important;
}
.ca-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
#ca-value {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--starlight);
  background: rgba(232,228,218,0.06);
  border: 1px solid rgba(232,228,218,0.18);
  padding: 0.75rem 1.1rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}
#ca-copy {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  padding: 0.75rem 1.1rem;
  background: var(--blood);
  color: var(--starlight);
  border: none;
  cursor: pointer;
}
#ca-copy:disabled { opacity: 0.35; cursor: default; }
.cta-links {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}
.btn {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--starlight);
  text-decoration: none;
  border: 1px solid rgba(232,228,218,0.25);
  padding: 0.8rem 1.5rem;
  transition: border-color 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.soon { opacity: 0.45; pointer-events: none; }
.cta-countdown {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}
.cd-time-big { font-size: clamp(1.6rem, 6vw, 2.6rem) !important; color: var(--gold); }

/* ============ Map view ============ */
#map-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#map-labels { position: absolute; inset: 0; overflow: hidden; }
.map-label {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--starlight-dim);
  text-shadow: 0 0 8px rgba(5,5,8,1);
  pointer-events: none;
  user-select: none;
}
.map-label.sun-label { color: var(--gold); }
.map-label.constellation-label {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  color: #b8ac8e;
  opacity: 0.6;
}
.card-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; }
.card-head .card-name { margin-bottom: 0; }
.card-emblem { width: 2.6rem; height: 2.6rem; border-radius: 50%; }

#map-hint {
  position: absolute;
  bottom: 1.2rem; left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  color: var(--starlight-dim);
  opacity: 0.8;
  transition: opacity 1s;
  white-space: nowrap;
}
#map-hint.faded { opacity: 0; }
@media (max-width: 760px) {
  #map-hint { bottom: calc(3.4rem + env(safe-area-inset-bottom)); }
}

/* Info card */
#map-card {
  position: absolute;
  min-width: 15rem;
  max-width: 19rem;
  background: rgba(8, 8, 14, 0.92);
  border: 1px solid rgba(232,228,218,0.2);
  padding: 1rem 1.1rem;
  pointer-events: auto;
  animation: cardIn 0.13s ease-out;
  backdrop-filter: blur(6px);
}
#map-card.skoll-card {
  border-color: rgba(255,179,71,0.65);
  box-shadow: 0 0 24px rgba(255,179,71,0.25), inset 0 0 24px rgba(255,179,71,0.05);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card-name {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: 0.95rem;
  color: var(--starlight);
  margin-bottom: 0.5rem;
}
.skoll-card .card-name { color: var(--gold); }
.card-lore {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--starlight-dim);
}
.card-ca {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.4rem;
}
.card-ca code {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--starlight);
  background: rgba(232,228,218,0.07);
  border: 1px solid rgba(232,228,218,0.15);
  padding: 0.45rem 0.55rem;
  overflow-wrap: anywhere;
  flex: 1;
}
.card-drop {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.drop-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--starlight-dim);
}
.drop-count {
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255,179,71,0.4);
}
.card-links { margin-top: 0.7rem; display: flex; gap: 0.5rem; }
.card-links a, .card-links span {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(255,179,71,0.3);
  padding: 0.4rem 0.7rem;
}
.card-links span { opacity: 0.5; }

/* ============ Toast ============ */
#copy-toast {
  position: fixed;
  bottom: 5.5rem; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--space);
  background: var(--gold);
  padding: 0.6rem 1.2rem;
}

/* ============ Totality (live mode) ============ */
body.live-totality .lore-inner { opacity: 0.15; transition: opacity 2s; }
body.live-totality #s4 .lore-inner { opacity: 1; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint span { animation: none; }
}
