/* Star Bathing — shared design system (index + Article 01+)
   Tokens from project handoff; gold #c8a45c is canonical. */

:root {
  --void: #06080f;
  --deep: #0b0e1a;
  --ink: #111627;
  --dusk: #1a2035;
  --slate: #2a3150;

  --star: #d4dce8;
  --moonlight: #8b9bc0;
  --silver: #6b7a9e;
  --whisper: #4a5678;

  --teal: #5b9e97;
  --gold: #c8a45c;
  --violet: #8b7aad;
  --rose: #b07a7a;

  --font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-body: "Libre Baskerville", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --column-width: 38rem;
  --column-wide: 48rem;
  /* Comfortable reading gutters (articles + hero) */
  --read-inline: clamp(1.25rem, 4.5vw, 2.25rem);

  --space-xs: 0.35rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3.5rem;
  --space-4xl: 5rem;

  --text-xs: 0.7rem;
  --text-sm: 0.85rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  --ease-breathe: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--star);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1a2744 0%, var(--void) 55%, #040508 100%);
  min-height: 100vh;
  /* Allow full-bleed article strips; suppress stray x-scroll on narrow viewports */
  overflow-x: clip;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
}

a:hover {
  color: #7ec4bc;
}

/* --- Keyframes (index hero + article hero) --- */

@keyframes breatheIn {
  from {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(4px);
  }
  50% {
    filter: blur(1px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Article hero copy: starts fading in on paint (short stagger, no long delays). */
@keyframes heroTextFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathePulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.85;
    transform: scaleY(1.08);
  }
}

/* --- Scroll reveals --- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 1.4s var(--ease-breathe),
    transform 1.6s var(--ease-breathe);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Reading progress --- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 2000;
  background: linear-gradient(90deg, var(--teal), #7ec8c0);
  pointer-events: none;
}

/* --- Article nav + drawer --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem var(--space-lg);
  background: rgba(6, 8, 15, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(91, 158, 151, 0.2);
  opacity: 0;
  animation: fadeIn 2.5s var(--ease-breathe) 2.5s forwards;
}

.nav__home {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--moonlight);
  text-decoration: none;
}

.nav__home:hover {
  color: var(--star);
}

.nav__toggle {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(139, 154, 192, 0.35);
  border-radius: 8px;
  background: rgba(17, 22, 39, 0.9);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav__toggle span {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: var(--star);
  border-radius: 1px;
}

.drawer__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1590;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-breathe);
}

.drawer__overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(22rem, 92vw);
  height: 100vh;
  z-index: 1600;
  background: linear-gradient(180deg, #12182a 0%, var(--deep) 100%);
  border-left: 1px solid rgba(91, 158, 151, 0.25);
  padding: var(--space-xl) var(--space-lg);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-breathe);
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__title {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: var(--space-lg);
}

.drawer__link {
  display: block;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(42, 49, 80, 0.6);
  text-decoration: none;
  color: var(--moonlight);
}

.drawer__link:hover {
  color: var(--star);
}

.drawer__link.is-current {
  border-left: 3px solid var(--teal);
  padding-left: var(--space-sm);
}

.drawer__link-number {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--whisper);
  display: block;
}

.drawer__link-title {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  display: block;
  margin-top: 2px;
}

/* --- Hero (article) --- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  padding: 5rem max(var(--read-inline), env(safe-area-inset-right)) var(--space-3xl)
    max(var(--read-inline), env(safe-area-inset-left));
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  padding-inline: max(0.5rem, env(safe-area-inset-left), env(safe-area-inset-right));
}

.hero__kicker {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: heroTextFadeIn 0.55s ease-out 0s forwards;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  color: var(--star);
  line-height: 1.2;
  margin: 0 0 var(--space-lg);
  opacity: 0;
  animation: heroTextFadeIn 0.55s ease-out 0.06s forwards;
}

.hero__subtitle {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--moonlight);
  line-height: 1.65;
  margin: 0;
  opacity: 0;
  animation: heroTextFadeIn 0.55s ease-out 0.12s forwards;
}

.hero__scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  animation: fadeIn 0.5s ease-out 0.2s forwards;
}

.hero__scroll-cue span {
  display: block;
  width: 1px;
  height: 48px;
  margin: 0 auto;
  background: linear-gradient(to bottom, transparent, var(--silver), transparent);
  animation: breathePulse 3.5s var(--ease-in-out) infinite;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .hero__kicker,
  .hero__title,
  .hero__subtitle {
    opacity: 1;
    animation: none;
    transform: none;
  }

  .hero__scroll-cue {
    opacity: 1;
    animation: none;
    transform: translateX(-50%);
  }

  .hero__scroll-cue span {
    animation: none;
  }
}

@media print {
  .progress,
  .nav,
  .drawer,
  .drawer__overlay,
  .hero__canvas,
  .index-hero__canvas,
  .atmosphere__canvas {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
