/* Reset, layout, nav, typography. Mobile-first. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s3);
  flex: 1;
}

a { color: var(--gold); }
a:hover { color: var(--gold-bright); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--stone-800);
  color: var(--gold);
  padding: var(--s2) var(--s3);
  z-index: 100;
}
.skip-link:focus { left: 0; }

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

/* --- Navigation --- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gold-ghost);
  padding: var(--s3);
  gap: var(--s3);
}

.logo {
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  text-decoration: none;
  font-size: var(--text-lg);
}

.nav-links {
  display: flex;
  gap: var(--s4);
  align-items: center;
}
.nav-links a {
  color: var(--parchment);
  text-decoration: none;
  transition: color var(--t-fast);
}
.nav-links a:hover { color: var(--gold); }

.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  color: var(--gold);
  font-size: var(--text-xl);
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle-label { display: block; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s3);
    padding-top: var(--s3);
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }
}

/* --- Typography --- */
.section-title {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: var(--text-2xl);
  letter-spacing: 0.06em;
  margin: var(--s4) 0 var(--s3);
}

.subsection-title {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: var(--text-lg);
  margin: var(--s4) 0 var(--s2);
}

.page-description {
  color: var(--parchment-dim);
  margin-bottom: var(--s4);
  max-width: 60ch;
}

.aside-note {
  color: var(--parchment-dim);
  font-size: var(--text-sm);
}

/* --- Hero (landing) --- */
/* .hero-stage hosts the cave-shrine backdrop: a CSS gradient shrine glow that
   is the permanent no-JS / reduced-motion / mobile fallback. The Phase 6
   3D scene mounts a canvas inside .hero-backdrop, layered over the gradient. */
.hero-stage {
  position: relative;
  overflow: hidden;
  /* The cave shrine IS the first screen — fill the viewport below the nav */
  min-height: calc(100vh - 5rem);
  display: grid;
  place-items: center;
}
.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 40% at 50% 92%, var(--gold-ember), transparent 68%),
    radial-gradient(ellipse 100% 75% at 50% 110%, var(--stone-800), transparent 62%),
    radial-gradient(ellipse 130% 110% at 50% -10%, var(--ink) 35%, var(--cave-black) 100%);
}
.hero-backdrop::after {
  /* altar flame flicker — collapses under prefers-reduced-motion */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 35% 22% at 50% 96%, var(--gold-ember), transparent 70%);
  animation: ember-flicker 4.5s ease-in-out infinite;
}
.hero-backdrop canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
@keyframes ember-flicker {
  0%, 100% { opacity: 0.45; }
  35%      { opacity: 1; }
  60%      { opacity: 0.65; }
  80%      { opacity: 0.9; }
}
.hero-stage > :not(.hero-backdrop) {
  position: relative;
  z-index: 1;
}

/* Full-page fixed 3D backdrop (dashboard temple). Content layers above it;
   without JS/WebGL the plain --ink background remains. */
.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.page-backdrop canvas {
  width: 100%;
  height: 100%;
  display: block;
}
main.container {
  position: relative;
  z-index: 1;
}
.hero {
  text-align: center;
  padding: var(--s6) var(--s3) var(--s5);
}
.hero-title {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: var(--text-hero);
  letter-spacing: 0.12em;
}
.hero-tagline {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  margin-top: var(--s3);
}
.hero-sub {
  color: var(--parchment-dim);
  max-width: 52ch;
  margin: var(--s3) auto var(--s4);
}
.hero-cta { display: inline-block; }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--gold-ghost);
  padding: var(--s3);
  text-align: center;
  color: var(--parchment-dim);
  font-size: var(--text-sm);
}
.footer-links { margin-top: var(--s1); }
.footer-links a { color: var(--parchment-dim); }

/* --- Motion discipline --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
