/* ============================================
   Lantern & Bone — Design System
   A candlelit Victorian library, in CSS.
   ============================================ */

/* ─── CSS Custom Properties (Tokens) ─── */
:root {
  /* Palette */
  --color-bg: #1a1612;
  --color-bg-noise: #1c1814;
  --color-surface: #2a241e;
  --color-surface-raised: #352d26;
  --color-text-primary: #e8dfd1;
  --color-text-secondary: #a89c89;
  --color-text-muted: #7a6f5f;
  --color-accent: #b8995a;
  --color-accent-dim: #8a7344;
  --color-border: #3a3128;
  --color-border-subtle: #2a241e;

  /* Typography */
  --font-display: 'Cormorant Garamond', 'EB Garamond', 'Georgia', serif;
  --font-body: 'Source Serif 4', 'Newsreader', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Type Scale */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1.125rem;   /* 18px */
  --text-lg: 1.25rem;      /* 20px */
  --text-xl: 1.5rem;       /* 24px */
  --text-2xl: 2rem;        /* 32px */
  --text-3xl: 2.5rem;      /* 40px */
  --text-4xl: 3.5rem;      /* 56px */
  --text-5xl: 5rem;        /* 80px */
  --text-6xl: 6rem;        /* 96px */

  /* Line Height */
  --leading-tight: 1.2;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Motion */
  --transition-fast: 200ms ease;
  --transition-base: 400ms ease;
  --transition-slow: 800ms ease;
  --transition-image: 1200ms ease;

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 720px;
  --max-width-wide: 1400px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Grain Overlay ─── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
  margin-bottom: var(--space-6);
  max-width: 70ch;
}

p:last-child {
  margin-bottom: 0;
}

/* Small caps */
.small-caps {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

/* Italic emphasis */
em, i {
  font-style: italic;
}

/* Monospace for metadata */
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* ─── Links ─── */
a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Default link hover: slight warmth shift, no brass.
   Brass is reserved for editorial moments (ampersand, primary CTA,
   focus ring, source citations) — not every link in the document. */
a:hover {
  color: #f4ecdd;
}

/* Hairline underline on hover for text links */
a.underlined {
  position: relative;
}

a.underlined::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-accent);
  transition: width var(--transition-base);
}

a.underlined:hover::after {
  width: 100%;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-variant: small-caps;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--color-text-primary);
  background-color: transparent;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text-primary);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background-color: var(--color-accent-dim);
  border-color: var(--color-accent-dim);
  color: var(--color-bg);
}

/* ─── Form Elements ─── */
input, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  transition: border-color var(--transition-fast);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-muted);
}

/* ─── Layout Utilities ─── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-24) 0;
}

.section-sm {
  padding: var(--space-16) 0;
}

/* ─── Image Treatment ─── */
.image-archive {
  position: relative;
  overflow: hidden;
}

.image-archive img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(15%) saturate(85%) contrast(105%);
  transition: filter var(--transition-image), transform var(--transition-image);
}

.image-archive::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(26, 22, 18, 0) 0%,
    rgba(26, 22, 18, 0.3) 100%
  );
  pointer-events: none;
}

.image-archive:hover img {
  filter: sepia(5%) saturate(95%) contrast(110%);
  transform: scale(1.02);
}

/* ─── Cards ─── */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-8);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--color-border);
}

/* ─── Horizontal Rule ─── */
hr {
  border: none;
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-16) 0;
}

/* ─── Pull Quote ─── */
.pull-quote {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-style: italic;
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  border-left: 1px solid var(--color-accent);
  padding-left: var(--space-6);
  margin: var(--space-12) 0;
}

.pull-quote cite {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

/* ─── Skip Link ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 10000;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-accent);
  color: var(--color-bg);
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

.skip-link:focus {
  top: var(--space-4);
}

/* ─── Focus States ─── */
:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 2px;
}

/* ─── Wordmark — locked visual: full uppercase serif, italic brass ampersand ─── */
.wordmark,
.hero-wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  font-variant: normal;
  letter-spacing: 0.07em;
  color: var(--color-text-primary);
}

.wordmark .ampersand,
.hero-wordmark .ampersand {
  display: inline-block;
  color: var(--color-accent);
  font-style: italic;
  font-variant: normal;
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0.05em;
  animation: candle-flicker 5.3s ease-in-out infinite;
  will-change: opacity, text-shadow;
}

/* Hand-tuned irregular keyframes — real flames don't pulse on a clean
   sine wave. Thirteen stops at uneven intervals, varying both opacity
   and the brass-tinted glow radius for warm-light bleed. */
@keyframes candle-flicker {
  0%   { opacity: 1.00; text-shadow: 0 0 8px  rgba(184, 153, 90, 0.45), 0 0 18px rgba(184, 153, 90, 0.18); }
  6%   { opacity: 0.92; text-shadow: 0 0 6px  rgba(184, 153, 90, 0.40), 0 0 14px rgba(184, 153, 90, 0.14); }
  11%  { opacity: 0.97; text-shadow: 0 0 9px  rgba(184, 153, 90, 0.50), 0 0 20px rgba(184, 153, 90, 0.20); }
  19%  { opacity: 0.88; text-shadow: 0 0 5px  rgba(184, 153, 90, 0.35), 0 0 12px rgba(184, 153, 90, 0.12); }
  27%  { opacity: 1.00; text-shadow: 0 0 10px rgba(184, 153, 90, 0.55), 0 0 22px rgba(184, 153, 90, 0.22); }
  34%  { opacity: 0.94; text-shadow: 0 0 7px  rgba(184, 153, 90, 0.40), 0 0 16px rgba(184, 153, 90, 0.16); }
  43%  { opacity: 0.99; text-shadow: 0 0 9px  rgba(184, 153, 90, 0.50), 0 0 19px rgba(184, 153, 90, 0.19); }
  52%  { opacity: 0.85; text-shadow: 0 0 4px  rgba(184, 153, 90, 0.30), 0 0 10px rgba(184, 153, 90, 0.10); }
  61%  { opacity: 0.96; text-shadow: 0 0 8px  rgba(184, 153, 90, 0.45), 0 0 17px rgba(184, 153, 90, 0.18); }
  73%  { opacity: 1.00; text-shadow: 0 0 11px rgba(184, 153, 90, 0.55), 0 0 23px rgba(184, 153, 90, 0.23); }
  84%  { opacity: 0.91; text-shadow: 0 0 6px  rgba(184, 153, 90, 0.38), 0 0 14px rgba(184, 153, 90, 0.14); }
  92%  { opacity: 0.98; text-shadow: 0 0 9px  rgba(184, 153, 90, 0.48), 0 0 19px rgba(184, 153, 90, 0.19); }
  100% { opacity: 1.00; text-shadow: 0 0 8px  rgba(184, 153, 90, 0.45), 0 0 18px rgba(184, 153, 90, 0.18); }
}

/* ─── Lantern Frame ─────────────────────────────────────────────────
   The candlelit equivalent of Cold Light's CRT phosphor frame.
   Where Cold Light renders archival images as cold green surveillance
   monitors, Lantern & Bone renders them as oil paintings hung in a
   library by candlelight: warm sepia/amber colour transform, brass
   drop-shadow bloom, a warm radial vignette, fine grain, and a slow
   irregular brightness wobble that breathes like flame.
   ──────────────────────────────────────────────────────────────────── */

.lantern-frame {
  position: relative;
  overflow: visible;  /* let the outer glow escape the frame */
  background-color: var(--color-bg);
  /* Outer brass picture-frame hairline + dark mat + animated halo.
     The 4th shadow (the big outer one) is what flickers. */
  animation: lantern-halo 9s linear infinite;
  will-change: box-shadow;
}

/* Inner clip layer — overflow: hidden lives here so the image is
   contained, but the .lantern-frame itself can radiate its glow. */
.lantern-frame > img,
.lantern-frame::before,
.lantern-frame::after {
  /* Constrain children to frame bounds via clip-path on each. */
  clip-path: inset(0);
}

.lantern-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Warm-light colour transform — pushed harder than .image-archive so
     the effect is unmistakable. */
  filter:
    sepia(55%)
    saturate(78%)
    contrast(112%)
    brightness(0.92)
    drop-shadow(0 0 18px rgba(184, 153, 90, 0.35));
  /* Layered animation: halo on the parent box-shadow + brightness/spill
     pulse here. Brightness-only filter is cheap (hardware-accelerated). */
  animation: lantern-img-flicker 9s linear infinite;
  will-change: filter;
}

@keyframes lantern-img-flicker {
  0%   { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  20%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  21%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.62) drop-shadow(0 0 6px  rgba(184, 153, 90, 0.10)); }
  25%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.62) drop-shadow(0 0 6px  rgba(184, 153, 90, 0.10)); }
  26%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  44%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  45%  { filter: sepia(50%) saturate(85%) contrast(110%) brightness(1.32) drop-shadow(0 0 50px rgba(255, 200, 110, 0.85)); }
  49%  { filter: sepia(50%) saturate(85%) contrast(110%) brightness(1.32) drop-shadow(0 0 50px rgba(255, 200, 110, 0.85)); }
  50%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  68%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  69%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.70) drop-shadow(0 0 8px  rgba(184, 153, 90, 0.15)); }
  72%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.70) drop-shadow(0 0 8px  rgba(184, 153, 90, 0.15)); }
  73%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(1.20) drop-shadow(0 0 40px rgba(255, 200, 110, 0.70)); }
  76%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(1.20) drop-shadow(0 0 40px rgba(255, 200, 110, 0.70)); }
  77%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  100% { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.92) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
}

/* Off-canvas candle spill — a warm radial gradient from upper-right,
   as if a candle is sitting just outside the frame casting light onto
   the painting. Combined with the centre-pull vignette below. */
.lantern-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 70% 80% at 85% 15%,
      rgba(232, 178, 96, 0.32) 0%,
      rgba(232, 178, 96, 0.16) 30%,
      rgba(232, 178, 96, 0) 60%
    ),
    radial-gradient(
      ellipse at center,
      rgba(26, 22, 18, 0) 25%,
      rgba(26, 22, 18, 0.55) 75%,
      rgba(26, 22, 18, 0.85) 100%
    );
  mix-blend-mode: normal;
  z-index: 1;
  /* Independent flicker on the candle-spill itself — different period
     from the brightness wobble (3.9s vs 2.7s) so the two desync and
     the room reads as alive. linear timing + sharp snaps. */
  animation: candle-spill-flicker 6.5s linear infinite;
  will-change: opacity;
}

/* Fine warm grain — denser than body grain, reads as aged canvas. */
.lantern-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
  z-index: 2;
}

/* Lantern halo — the headline visible flicker. Box-shadow animation
   (cheap, hardware-accelerated). The frame's outer brass glow pulses
   and snaps in an irregular pattern: long holds, sharp dims, sharp
   bright pops. Brass picture-frame hairline + dark mat are constant;
   only the outer halo flickers. */
@keyframes lantern-halo {
  /* Steady warm glow */
  0%   {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  22%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  /* Sharp dim (air current) */
  23%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.40),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.18),
      0 0 18px 2px rgba(232, 178, 96, 0.10),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  28%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.40),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.18),
      0 0 18px 2px rgba(232, 178, 96, 0.10),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  /* Recover */
  29%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  /* Bright pop (wax catches) — unmistakable */
  44%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  45%  {
    box-shadow:
      0 0 0 2px rgba(232, 178, 96, 0.80),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(232, 178, 96, 0.55),
      0 0 130px 30px rgba(232, 178, 96, 0.55),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  49%  {
    box-shadow:
      0 0 0 2px rgba(232, 178, 96, 0.80),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(232, 178, 96, 0.55),
      0 0 130px 30px rgba(232, 178, 96, 0.55),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  50%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  /* Quick double-jitter */
  62%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  63%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.30),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.12),
      0 0 12px 0px rgba(232, 178, 96, 0.06),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  65%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.30),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.12),
      0 0 12px 0px rgba(232, 178, 96, 0.06),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  66%  {
    box-shadow:
      0 0 0 2px rgba(232, 178, 96, 0.75),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(232, 178, 96, 0.50),
      0 0 60px 14px rgba(232, 178, 96, 0.40),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  69%  {
    box-shadow:
      0 0 0 2px rgba(232, 178, 96, 0.75),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(232, 178, 96, 0.50),
      0 0 60px 14px rgba(232, 178, 96, 0.40),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  70%  {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(184, 153, 90, 0.55),
      inset 0 0 0 6px rgba(26, 22, 18, 0.85),
      inset 0 0 0 7px rgba(184, 153, 90, 0.30),
      0 0 40px 8px rgba(232, 178, 96, 0.22),
      0 12px 50px rgba(0, 0, 0, 0.55);
  }
}

/* Candlelight flicker — hold-and-jolt pattern, NOT smooth wobble.
   Adjacent keyframes 1-2% apart create near-instant snaps; longer gaps
   create holds. Real flames hold steady, then jolt; they don't sine-wave.
   Brightness 0.78 → 1.18, bloom 8px → 36px. Big amplitude, sharp edges. */
@keyframes candlelight-breathe {
  /* Steady warm */
  0%   { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  10%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  /* Sharp dim — air current */
  11%  { filter: sepia(60%) saturate(75%) contrast(115%) brightness(0.78) drop-shadow(0 0 8px  rgba(184, 153, 90, 0.18)); }
  16%  { filter: sepia(60%) saturate(75%) contrast(115%) brightness(0.78) drop-shadow(0 0 8px  rgba(184, 153, 90, 0.18)); }
  /* Recover */
  17%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  29%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  /* Sharp brighten — wax catches */
  30%  { filter: sepia(50%) saturate(82%) contrast(110%) brightness(1.18) drop-shadow(0 0 36px rgba(232, 178, 96, 0.65)); }
  33%  { filter: sepia(50%) saturate(82%) contrast(110%) brightness(1.18) drop-shadow(0 0 36px rgba(232, 178, 96, 0.65)); }
  /* Settle */
  34%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(1.02) drop-shadow(0 0 22px rgba(184, 153, 90, 0.42)); }
  47%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  /* Quick double-jitter */
  48%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.82) drop-shadow(0 0 10px rgba(184, 153, 90, 0.22)); }
  50%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.82) drop-shadow(0 0 10px rgba(184, 153, 90, 0.22)); }
  51%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(1.10) drop-shadow(0 0 30px rgba(232, 178, 96, 0.55)); }
  53%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(1.10) drop-shadow(0 0 30px rgba(232, 178, 96, 0.55)); }
  54%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  /* Long steady */
  72%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  /* Slow dim */
  73%  { filter: sepia(58%) saturate(76%) contrast(113%) brightness(0.86) drop-shadow(0 0 14px rgba(184, 153, 90, 0.28)); }
  82%  { filter: sepia(58%) saturate(76%) contrast(113%) brightness(0.86) drop-shadow(0 0 14px rgba(184, 153, 90, 0.28)); }
  /* Sharp bright pop */
  83%  { filter: sepia(50%) saturate(82%) contrast(110%) brightness(1.15) drop-shadow(0 0 32px rgba(232, 178, 96, 0.60)); }
  86%  { filter: sepia(50%) saturate(82%) contrast(110%) brightness(1.15) drop-shadow(0 0 32px rgba(232, 178, 96, 0.60)); }
  87%  { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
  100% { filter: sepia(55%) saturate(78%) contrast(112%) brightness(0.95) drop-shadow(0 0 18px rgba(184, 153, 90, 0.35)); }
}

/* Candle spill flicker — independent period (2.7s vs the brightness
   3.9s) so the two desync. Just opacity, irregular sharp snaps. */
@keyframes candle-spill-flicker {
  0%   { opacity: 1.00; }
  18%  { opacity: 1.00; }
  19%  { opacity: 0.55; }
  22%  { opacity: 0.55; }
  23%  { opacity: 1.00; }
  41%  { opacity: 1.00; }
  42%  { opacity: 1.25; }
  45%  { opacity: 1.25; }
  46%  { opacity: 0.85; }
  60%  { opacity: 0.85; }
  61%  { opacity: 1.00; }
  74%  { opacity: 1.00; }
  75%  { opacity: 0.65; }
  77%  { opacity: 0.65; }
  78%  { opacity: 1.10; }
  82%  { opacity: 1.10; }
  83%  { opacity: 1.00; }
  100% { opacity: 1.00; }
}

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

  html {
    scroll-behavior: auto;
  }
}

/* ─── Print Styles ─── */
@media print {
  body {
    background: white;
    color: black;
  }

  body::before {
    display: none;
  }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  :root {
    --text-base: 1.0625rem;  /* 17px */
    --text-5xl: 3rem;        /* 48px */
    --text-3xl: 1.75rem;     /* 28px */
  }

  .section {
    padding: var(--space-16) 0;
  }

  .container, .container-narrow, .container-wide {
    padding: 0 var(--space-4);
  }
}
