/* ================================================
   STORM BLAKE, shared styles
   Cinematic romantasy. Storm Cloud + Deep Purple
   ================================================ */

:root {
  /* Primary palette (per brand guide) */
  --storm-cloud: #374151;
  --deep-purple: #2D1B4E;
  --electric-blue: #3B82F6;
  --steel-gray: #4A5568;
  --silver: #E5E7EB;
  --off-white: #F9FAFB;
  --lightning: #7DD3FC;
  --ice-blue: #7DD3FC;
  --silver-accent: #C8B8DB;
  --gold-original: #FCD34D;

  /* Extended palette for depth */
  --ink: #0B0A14;           /* near-black with purple undertone */
  --midnight: #141326;      /* deeper than deep-purple */
  --fog: #8A8FA3;           /* dim silver for captions */
  --ash: #20202E;

  /* Book accents */
  --b1: #3B82F6;   /* Storm */
  --b1-alt: #7DD3FC;
  --b2: #9CAF88;   /* Wolf */
  --b2-alt: #E8C4A0;
  --b3: #8B1A1A;   /* Hunger */
  --b3-alt: #D4A030;
  --b4: #E25822;   /* Hellfire */
  --b4-alt: #D4A030;
  --b5: #E8B4A0;   /* Dawn */
  --b5-alt: #E5E7EB;

  /* Type */
  --font-display: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Montserrat', -apple-system, 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
}

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

html, body {
  background: var(--ink);
  color: var(--silver);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  /* atmospheric purple-to-ink wash */
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(45, 27, 78, 0.55), transparent 60%),
    radial-gradient(1000px 900px at 10% 20%, rgba(59, 130, 246, 0.10), transparent 55%),
    linear-gradient(180deg, #0B0A14 0%, #0B0A14 60%, #0E0D1B 100%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Type utilities ---------- */

.eyebrow {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.75;
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.02;
  color: var(--off-white);
}

.body-lede {
  font-size: 18px;
  line-height: 1.7;
  color: var(--silver);
  max-width: 58ch;
  opacity: 0.92;
}

.small-caps {
  font-family: var(--font-ui);
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 12px;
}

.lightning-rule {
  width: 56px; height: 1px;
  background: var(--lightning);
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.6);
  display: inline-block;
  vertical-align: middle;
}

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 22px 44px;
  display: flex; align-items: center; justify-content: space-between;
  transition: background 400ms ease, backdrop-filter 400ms ease, border-color 400ms ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(11, 10, 20, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom-color: rgba(229, 231, 235, 0.08);
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--off-white);
  position: relative;
}
.nav__brand::after {
  content: "";
  position: absolute;
  left: 0; right: 30%;
  bottom: -4px;
  height: 1px;
  background: var(--lightning);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 500ms cubic-bezier(.2,.7,.2,1);
}
.nav__brand:hover::after { transform: scaleX(1); }

.nav__links {
  display: flex;
  gap: 34px;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.nav__links a {
  color: var(--silver);
  opacity: 0.78;
  transition: opacity 200ms ease, color 200ms ease;
  position: relative;
  padding: 6px 0;
}
.nav__links a:hover { opacity: 1; color: var(--off-white); }
.nav__links a.active { opacity: 1; color: var(--off-white); }
.nav__links a.active::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--lightning);
  transform: translateX(-50%);
  box-shadow: 0 0 10px var(--lightning);
}

/* ---------- Nav socials ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav__links { flex: 1; justify-content: center; }
.nav__socials {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav__socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  color: var(--silver);
  opacity: 0.7;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: all 200ms ease;
}
.nav__socials a:hover {
  color: var(--lightning);
  opacity: 1;
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(125, 211, 252, 0.06);
}
@media (max-width: 900px) {
  .nav__socials { gap: 8px; }
  .nav__socials a { width: 28px; height: 28px; }
  .nav__socials svg { width: 14px; height: 14px; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 16px 26px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 280ms cubic-bezier(.2,.7,.2,1);
  position: relative;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--off-white);
  color: var(--ink);
}
.btn--primary:hover {
  background: var(--lightning);
  box-shadow: 0 0 40px rgba(125, 211, 252, 0.35);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--silver);
  border-color: rgba(229, 231, 235, 0.32);
}
.btn--ghost:hover {
  border-color: var(--lightning);
  color: var(--off-white);
}
.btn__arrow {
  display: inline-block;
  transition: transform 280ms ease;
}
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ---------- Layout ---------- */

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 44px;
}
.section {
  padding: 140px 0;
  position: relative;
}
@media (max-width: 768px) {
  .section { padding: 80px 0; }
  .container { padding: 0 24px; }
  .nav { padding: 16px 24px; }
  .nav__links { display: none; }
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms cubic-bezier(.2,.7,.2,1), transform 900ms cubic-bezier(.2,.7,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
body[data-motion="off"] .reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid rgba(229, 231, 235, 0.08);
  padding: 60px 0 40px;
  margin-top: 60px;
  color: var(--fog);
  font-size: 13px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 44px;
}
.footer__col h4 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: 18px;
}
.footer__col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer__col a { transition: color 200ms ease; }
.footer__col a:hover { color: var(--lightning); }
.footer__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--off-white);
  margin-bottom: 14px;
}
.footer__tag {
  font-style: italic;
  color: var(--silver);
  opacity: 0.72;
  max-width: 28ch;
}
.footer__base {
  border-top: 1px solid rgba(229, 231, 235, 0.06);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
@media (max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Ambient atmospherics ---------- */
.atmo-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  overflow: hidden;
  mix-blend-mode: screen;
}
.atmo-clouds::before,
.atmo-clouds::after {
  content: "";
  position: absolute;
  inset: -20% -20%;
  background:
    radial-gradient(60% 40% at 20% 40%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(50% 40% at 80% 60%, rgba(45, 27, 78, 0.6), transparent 60%);
  animation: drift 60s linear infinite;
}
.atmo-clouds::after {
  animation-duration: 90s;
  animation-direction: reverse;
  opacity: 0.7;
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(3%, -2%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
body[data-motion="off"] .atmo-clouds { display: none; }
body[data-motion="subtle"] .atmo-clouds { opacity: 0.35; }

/* Lightning pulse behind hero (atmospheric only) */
.atmo-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(40% 30% at 70% 30%, rgba(125, 211, 252, 0.18), transparent 70%);
  opacity: 0;
  animation: flash 11s ease-in-out infinite;
}
body[data-motion="off"] .atmo-flash,
body[data-motion="subtle"] .atmo-flash { display: none; }
@keyframes flash {
  0%, 85%, 100% { opacity: 0; }
  86% { opacity: 0.9; }
  87% { opacity: 0.1; }
  88% { opacity: 0.7; }
  91% { opacity: 0; }
}

/* ---------- Portal ring SVG reused as background ornament ---------- */
.portal-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.25);
  box-shadow:
    0 0 80px rgba(59, 130, 246, 0.18),
    inset 0 0 60px rgba(45, 27, 78, 0.4);
  pointer-events: none;
}

.tweaks-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(11, 10, 20, 0.85);
  border: 1px solid rgba(125, 211, 252, 0.4);
  color: var(--silver);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  backdrop-filter: blur(10px);
  transition: all 200ms ease;
}
.tweaks-fab:hover {
  border-color: var(--lightning);
  color: var(--lightning);
}
.tweaks-fab span { color: var(--lightning); font-size: 14px; }
.tweaks.open ~ .tweaks-fab { display: none; }

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 100;
  background: rgba(11, 10, 20, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px 22px;
  border-radius: 4px;
  min-width: 260px;
  font-family: var(--font-ui);
  color: var(--silver);
  font-size: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: none;
}
.tweaks.open { display: block; }
.tweaks h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--off-white);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.tweaks__group { margin-bottom: 16px; }
.tweaks__group:last-child { margin-bottom: 0; }
.tweaks__label {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fog);
  margin-bottom: 8px;
}
.tweaks__opts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tweaks__opt {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid rgba(229, 231, 235, 0.18);
  color: var(--silver);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: all 200ms ease;
  white-space: nowrap;
}
.tweaks__opt:hover { border-color: rgba(125, 211, 252, 0.5); color: var(--off-white); }
.tweaks__opt.active {
  background: var(--lightning);
  border-color: var(--lightning);
  color: var(--ink);
  font-weight: 600;
}
