/* ==========================================================================
   Digital Scribes — Light vs. Darkness theme

   All colors live here in :root. The -rgb variants are channel triplets so
   alpha variants can derive from the palette via rgba(var(--x-rgb), a).
   ClojureScript reads these too (see particles.cljs), so this block is the
   single source of truth for the theme.
   ========================================================================== */

:root {
  /* darkness */
  --ink: #070810;
  --ink-rgb: 7, 8, 16;
  --ink-2: #0d0f1c;
  --ink-2-rgb: 13, 15, 28;
  --ink-3: #131629;
  --ink-deep-rgb: 5, 6, 12;

  /* light */
  --gold: #d4a94a;
  --gold-rgb: 212, 169, 74;
  --gold-bright: #f0c75e;
  --gold-bright-rgb: 240, 199, 94;
  --gold-pale: #fff3cf;
  --gold-deep: #8a6b23;
  --gold-dim: rgba(var(--gold-rgb), 0.25);

  /* text */
  --parchment: #e9dfc8;
  --text-dim: #9a94a8;
  --text-dim-rgb: 154, 148, 168;

  /* atmosphere gradients */
  --bg-dusk: #1a1430;
  --bg-ember: #201708;

  /* card art scenes */
  --art-ember: #2a2010;
  --art-night: #10101e;
  --art-veil: #141222;
  --art-abyss: #08080f;

  /* svg scene props */
  --book-leather-dark: #1c1706;
  --book-leather: #241d08;
  --lantern-metal: #6b5a2e;
  --lantern-metal-dark: #3a3118;
  --lantern-glass: rgba(20, 18, 34, 0.9);

  --font-display: "Cinzel", serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, var(--bg-dusk) 0%, transparent 60%),
    radial-gradient(ellipse 100% 50% at 50% 110%, var(--bg-ember) 0%, transparent 55%),
    var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.7;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--ink); }

/* --- Particle canvas ------------------------------------------------------ */

.particle-field {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

main, header.hero, footer { position: relative; z-index: 2; }

/* --- Navigation ----------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2.5rem;
  transition: background 0.4s ease, border-color 0.4s ease, padding 0.4s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(var(--ink-rgb), 0.88);
  backdrop-filter: blur(8px);
  border-bottom-color: var(--gold-dim);
  padding: 0.7rem 2.5rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-decoration: none;
}

.nav-links { display: flex; gap: 2.2rem; list-style: none; }

.nav-links a {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--parchment);
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -5px;
  height: 1px;
  background: var(--gold-bright);
  transition: right 0.35s ease;
}

.nav-links a:hover { color: var(--gold-bright); }
.nav-links a:hover::after { right: 0; }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  left: 50%; bottom: -35%;
  width: 130vmax; height: 90vmax;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(var(--gold-bright-rgb), 0.20) 0%,
    rgba(var(--gold-rgb), 0.08) 30%,
    transparent 62%);
  animation: breathe 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes breathe {
  0%, 100% { opacity: 0.75; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.06); }
}

.hero-content { position: relative; max-width: 60rem; }

.hero-kicker {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.6rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(100deg,
    var(--gold-deep) 0%, var(--gold) 25%, var(--gold-pale) 50%,
    var(--gold) 75%, var(--gold-deep) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s linear infinite;
  filter: drop-shadow(0 0 28px rgba(var(--gold-bright-rgb), 0.35));
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

.hero-tagline {
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-style: italic;
  color: var(--parchment);
  margin-top: 1.8rem;
}

.hero-verse {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin-top: 1.1rem;
}

.hero .btn { margin-top: 2.6rem; }

.scroll-cue {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 1.6rem;
  text-decoration: none;
  animation: bob 2.2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.9; }
  50%      { transform: translate(-50%, 10px); opacity: 0.4; }
}

/* --- Ornamental divider ---------------------------------------------------- */

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.6rem auto 0;
  width: min(24rem, 70%);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.divider::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.divider .diamond {
  width: 8px; height: 8px;
  background: var(--gold-bright);
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(var(--gold-bright-rgb), 0.8);
  animation: glint 3s ease-in-out infinite;
}

@keyframes glint {
  0%, 100% { box-shadow: 0 0 6px rgba(var(--gold-bright-rgb), 0.5); }
  50%      { box-shadow: 0 0 16px rgba(var(--gold-bright-rgb), 1); }
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-bright);
  background: transparent;
  border: 1px solid var(--gold);
  padding: 0.95rem 2.4rem;
  cursor: pointer;
  transition: all 0.35s ease;
}

.btn:hover {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 0 32px rgba(var(--gold-bright-rgb), 0.45);
}

/* --- Sections ---------------------------------------------------------------- */

section { padding: 7rem 2rem; }

.section-inner { max-width: 72rem; margin: 0 auto; }

.section-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--parchment);
}

.section-sub {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2.2rem;
  margin-bottom: 0;
  font-size: 1.15rem;
}

/* --- Scroll reveal ------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.19, 1, 0.22, 1);
}

.reveal.visible { opacity: 1; transform: translateY(0); }

/* --- Game cards ----------------------------------------------------------------- */

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 2.4rem;
  margin-top: 3.5rem;
}

/* stretch cards through their reveal wrappers so all boxes match height */
.games-grid > .reveal { display: flex; }
.games-grid > .reveal > .game-card { flex: 1; }

.game-card {
  background: linear-gradient(170deg, var(--ink-3) 0%, var(--ink-2) 70%);
  border: 1px solid var(--gold-dim);
  display: flex;
  flex-direction: column;
  transition: transform 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease;
}

.game-card:hover {
  transform: translateY(-8px);
  border-color: var(--gold);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6),
              0 0 40px rgba(var(--gold-bright-rgb), 0.12);
}

.game-art {
  height: 15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--gold-dim);
}

.game-art svg { width: 100%; height: 100%; }

.game-body { padding: 1.8rem 2rem 2.2rem; flex: 1; }

.game-status {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.game-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  margin-top: 0.6rem;
  color: var(--parchment);
}

.game-blurb { margin-top: 0.9rem; color: var(--text-dim); }

/* --- Card art scenes (SVG styling lives here, not in the markup) ------------------ */

.art-book {
  background: radial-gradient(ellipse at 50% 65%, var(--art-ember) 0%, var(--art-night) 70%);
}

.art-veiled {
  background: radial-gradient(ellipse at 50% 60%, var(--art-veil) 0%, var(--art-abyss) 75%);
}

.rays line {
  stroke: var(--gold-bright);
  stroke-width: 1.2;
  opacity: 0.35;
  transform-origin: 100px 78px;
  animation: ray-pulse 4s ease-in-out infinite;
}

.rays line:nth-child(2n) { animation-delay: 1.3s; }
.rays line:nth-child(3n) { animation-delay: 2.1s; }

@keyframes ray-pulse {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.55; }
}

.book-cover { stroke: var(--gold); stroke-width: 2; }
.book-cover-left { fill: var(--book-leather-dark); }
.book-cover-right { fill: var(--book-leather); }
.book-spine { stroke: var(--gold-bright); stroke-width: 1.5; }
.book-line { stroke: rgba(var(--gold-bright-rgb), 0.45); stroke-width: 1.5; }

.veil-glow { fill: rgba(var(--gold-bright-rgb), 0.05); }
.lantern-handle { fill: none; stroke: var(--lantern-metal); stroke-width: 2; }
.lantern-cap { fill: var(--lantern-metal-dark); }
.lantern-glass { fill: var(--lantern-glass); stroke: var(--lantern-metal); stroke-width: 2; }
.flame-outer { fill: var(--gold-bright); }
.flame-core { fill: var(--gold-pale); }
.veiled-label {
  fill: rgba(var(--text-dim-rgb), 0.65);
  font-size: 11px;
  letter-spacing: 4px;
  font-family: var(--font-display);
}

.lantern-flame {
  animation: flicker 2.6s ease-in-out infinite;
  transform-origin: center;
}

@keyframes flicker {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  30%      { opacity: 1;    transform: scale(1.12); }
  60%      { opacity: 0.7;  transform: scale(0.95); }
}

/* --- Mission ---------------------------------------------------------------------- */

.mission-verse {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-style: italic;
  text-align: center;
  max-width: 46rem;
  margin: 3rem auto 0;
  color: var(--parchment);
  text-shadow: 0 0 24px rgba(var(--gold-bright-rgb), 0.18);
}

.mission-ref {
  display: block;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  margin-top: 1.2rem;
}

.mission-text {
  max-width: 44rem;
  margin: 2.6rem auto 0;
  text-align: center;
  color: var(--text-dim);
}

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem;
  margin-top: 4rem;
}

/* stretch pillars through their reveal wrappers so all boxes match height */
.pillars > .reveal { display: flex; }
.pillars > .reveal > .pillar { flex: 1; }

.pillar {
  text-align: center;
  padding: 2.4rem 1.6rem;
  border: 1px solid rgba(var(--gold-rgb), 0.15);
  background: rgba(var(--ink-2-rgb), 0.6);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.pillar:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 30px rgba(var(--gold-bright-rgb), 0.08);
}

.pillar-icon { font-size: 1.9rem; color: var(--gold-bright); }

.pillar h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 1rem;
  color: var(--parchment);
}

.pillar p { margin-top: 0.8rem; color: var(--text-dim); font-size: 1.05rem; }

/* --- Newsletter -------------------------------------------------------------------- */

.newsletter { text-align: center; }

.newsletter-form {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 2.6rem;
}

.newsletter-form input[type="email"] {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--parchment);
  background: rgba(var(--ink-2-rgb), 0.8);
  border: 1px solid var(--gold-dim);
  padding: 0.9rem 1.3rem;
  width: min(24rem, 80vw);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(var(--gold-bright-rgb), 0.15);
}

.newsletter-thanks {
  margin-top: 2.6rem;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--gold-bright);
}

/* --- Footer ------------------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--gold-dim);
  padding: 3.2rem 2rem 2.6rem;
  text-align: center;
  background: rgba(var(--ink-deep-rgb), 0.7);
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
}

.footer-motto {
  font-style: italic;
  color: var(--text-dim);
  margin-top: 0.7rem;
  font-size: 1.05rem;
}

.footer-copy {
  margin-top: 1.6rem;
  font-size: 0.95rem;
  color: rgba(var(--text-dim-rgb), 0.6);
}

/* --- Responsive / accessibility -------------------------------------------------------- */

@media (max-width: 640px) {
  .nav { padding: 1rem 1.2rem; }
  .nav-links { gap: 1.2rem; }
  .nav-links a { font-size: 0.7rem; }
  section { padding: 4.5rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
