/* Crown & Coven — shared design tokens & atmosphere.
   Loaded by every C&C page BEFORE its page stylesheet
   (index.html -> style.css, ritual.html -> ritual.css).
   Palette: near-black plum, candle gold, dried rose, aged cream. */

:root {
  --ink: #0e0812;
  --ink-2: #150b1c;
  --ink-3: #1d1026;
  --candle: #d9a45b;
  --candle-bright: #f0c98a;
  --candle-dim: #8a6a3e;
  --wine: #7a3b52;
  --rose: #c98a8a;
  --cream: #ece2d0;
  --cream-dim: #b8ab93;
  --cream-faint: #8d8271;
  --line: rgba(217, 164, 91, 0.22);
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  background-image:
    radial-gradient(ellipse 120% 70% at 50% -10%, #1d1026 0%, transparent 60%),
    radial-gradient(ellipse 90% 50% at 50% 110%, #170d20 0%, transparent 55%);
  color: var(--cream);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px;
  line-height: 1.65;
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- atmosphere ---------- */

.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 50;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 9s steps(6) infinite;
}
@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2%, 1%); }
  40% { transform: translate(1%, -2%); }
  60% { transform: translate(-1%, 2%); }
  80% { transform: translate(2%, -1%); }
}

.glow {
  position: fixed; pointer-events: none; z-index: 0;
  border-radius: 50%; filter: blur(80px);
}
.glow-a {
  width: 60vw; height: 60vw; max-width: 640px; max-height: 640px;
  left: -18vw; top: 8vh;
  background: radial-gradient(circle, rgba(217, 164, 91, 0.10) 0%, transparent 70%);
  animation: breathe 11s ease-in-out infinite;
}
.glow-b {
  width: 55vw; height: 55vw; max-width: 560px; max-height: 560px;
  right: -15vw; bottom: 4vh;
  background: radial-gradient(circle, rgba(122, 59, 82, 0.14) 0%, transparent 70%);
  animation: breathe 13s ease-in-out infinite reverse;
}
@keyframes breathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

/* ---------- screen system ---------- */

.screen { display: none; }
.screen.active { display: block; animation: screen-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- crest ---------- */

.crest {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: clamp(40px, 9vh, 80px);
}
.crest.small { margin-bottom: 32px; }
.crest-rule { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.crest-rule:last-child { background: linear-gradient(90deg, var(--line), transparent); }
.crest-name {
  font-family: Marcellus, serif;
  font-size: 13px; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--candle); white-space: nowrap;
}
.crest-name a { color: inherit; text-decoration: none; }
.crest-name a:hover { color: var(--candle-bright); }

/* ---------- buttons ---------- */

.btn-primary {
  position: relative;
  font-family: Marcellus, serif;
  font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(160deg, var(--candle-bright) 0%, var(--candle) 55%, #b07f3e 100%);
  border: none; border-radius: 3px;
  padding: 18px 42px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(240, 201, 138, 0.35), 0 12px 40px -8px rgba(217, 164, 91, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 0 0 1px rgba(240, 201, 138, 0.5), 0 18px 50px -8px rgba(217, 164, 91, 0.6);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-secondary {
  font-family: Marcellus, serif;
  font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--candle);
  background: transparent;
  border: 1px solid var(--line); border-radius: 3px;
  padding: 13px 26px; cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.btn-secondary:hover { border-color: var(--candle); background: rgba(217, 164, 91, 0.07); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.15s !important; }
}
