/* ── TOKENS ─────────────────────────────────────────── */
:root {
  --gold:        #d4a843;
  --gold-light:  #f0cc74;
  --gold-dark:   #9a7520;
  --ink:         #1a1228;
  --parchment:   #fdf6e3;
  --cream:       #f5ead2;
  --mist:        #e8dfc8;
  --scroll:      #c9b99a;
  --transition: 0.4s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:          #0d0b14;
  --bg2:         #13101e;
  --bg3:         #1c1730;
  --surface:     #1e1a2e;
  --surface2:    #262040;
  --border:      rgba(212,168,67,0.18);
  --text:        #e8dfc8;
  --text-muted:  #9488b0;
  --heading:     #f0cc74;
  --glow:        rgba(212,168,67,0.25);
  --star:        rgba(212,168,67,0.6);
}

[data-theme="light"] {
  --bg:          #fdf6e3;
  --bg2:         #f5ead2;
  --bg3:         #ede0c0;
  --surface:     #fff9ef;
  --surface2:    #fdf0d5;
  --gold-dark:   #7a5c10;
  --border:      rgba(122,92,16,0.3);
  --text:        #3b2d1a;
  --text-muted:  #5c4a2a;
  --heading:     #7a5c10;
  --glow:        rgba(122,92,16,0.15);
  --star:        rgba(122,92,16,0.5);
}

/* ── RESET & BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Lora', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ── STARFIELD ───────────────────────────────────────── */
#stars {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: var(--star);
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes twinkle {
  0%,100% { opacity: .1; transform: scale(1); }
  50%      { opacity: .9; transform: scale(1.4); }
}
[data-theme="light"] #stars { opacity: 0.4; }

/* ── NOISE OVERLAY ───────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  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='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: .6;
}

/* ── NAV ─────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2.5rem;
  background: rgba(13,11,20,0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
[data-theme="light"] nav {
  background: rgba(253,246,227,0.82);
}

.nav-logo {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none;
}
.nav-logo img {
  height: 42px; width: 42px;
  border-radius: 50%;
  object-fit: contain;
  border: 2px solid var(--gold);
  padding: 2px;
}
.logo-placeholder {
  height: 42px; width: 42px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.nav-title {
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .08em;
}

/* Home page: section nav links */
.nav-links {
  display: flex; align-items: center; gap: 2rem;
  list-style: none;
}
.nav-links a {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--text-muted);
  transition: color .25s;
  text-transform: uppercase;
}
.nav-links a:hover { color: var(--gold); }

/* Sub-pages: right group with back link */
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-back {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color .25s;
}
.nav-back:hover { color: var(--gold); }

.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .9rem;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  transition: all .25s;
  display: flex; align-items: center; gap: .4rem;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* ── FOOTER ──────────────────────────────────────────── */
footer {
  position: relative; z-index: 2;
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .82rem;
}
footer a { color: var(--gold); text-decoration: none; }
footer .footer-logo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: .5rem;
}

/* ── SKIP NAV ────────────────────────────────────────── */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--gold);
  color: var(--ink);
  padding: .5rem 1rem;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top .2s;
}
.skip-nav:focus { top: 1rem; }

/* ── LIGHT THEME OVERRIDES (shared elements) ─────────── */
[data-theme="light"] .nav-title,
[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .nav-back:hover,
[data-theme="light"] .theme-toggle:hover,
[data-theme="light"] footer a,
[data-theme="light"] .footer-logo {
  color: var(--gold-dark) !important;
  opacity: 1 !important;
}
[data-theme="light"] .theme-toggle:hover {
  border-color: var(--gold-dark) !important;
}

/* ── RESPONSIVE: Nav ─────────────────────────────────── */
@media (max-width: 768px) {
  nav { padding: 1rem 1.25rem; }
  .nav-links { display: none; }
}
