/* ============================================================
   Dreamz — shared atmosphere & ornaments
   Loaded by blog articles, symbol pages, and the A–Z grimoire.
   Landing page keeps its bespoke hero; this fills everywhere else.
   ============================================================ */

/* Fraunces — bookish variable serif for body copy.
   Kept as a *body* swap so Playfair Display still owns display. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400&display=swap');

:root {
  --veil-bg: #0d1b2a;
  --veil-ink: #f0e6d3;
  --veil-ink-soft: #a89bb0;
  --veil-ink-dim: #6b5f73;
  --veil-gold: #c9a84c;
  --veil-gold-light: #e0c872;
  --veil-violet: #2d1b69;
  --veil-violet-dark: #1a0a2e;
  --veil-font-display: 'Playfair Display', Georgia, serif;
  --veil-font-body: 'Fraunces', 'Source Serif 4', Georgia, serif;
}

/* ============================================================
   Atmosphere layer — apply `class="veil"` to <body>
   Paints a subtle radial pool + hand-placed constellation behind
   the page. Low opacity on purpose; copy stays legible.
   ============================================================ */

body.veil {
  position: relative;
  font-family: var(--veil-font-body);
  font-feature-settings: 'ss01', 'ss02', 'onum';
}

body.veil::before,
body.veil::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body.veil::before {
  background:
    radial-gradient(ellipse 70% 50% at 85% -10%, rgba(45, 27, 105, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 30%, rgba(26, 10, 46, 0.55) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(45, 27, 105, 0.35) 0%, transparent 60%);
}

/* Constellation — asymmetric, hand-placed. No twinkle (hero owns that).
   Nine stars scattered like a fragment of a real star chart. */
body.veil::after {
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%,  rgba(240, 230, 211, 0.55), transparent 60%),
    radial-gradient(1px   1px   at 14% 22%, rgba(240, 230, 211, 0.35), transparent 60%),
    radial-gradient(2px   2px   at 22% 8%,  rgba(240, 230, 211, 0.7),  transparent 60%),
    radial-gradient(1px   1px   at 78% 18%, rgba(240, 230, 211, 0.4),  transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 34%, rgba(240, 230, 211, 0.55), transparent 60%),
    radial-gradient(1px   1px   at 4%  62%, rgba(240, 230, 211, 0.3),  transparent 60%),
    radial-gradient(2px   2px   at 88% 72%, rgba(240, 230, 211, 0.6),  transparent 60%),
    radial-gradient(1px   1px   at 70% 88%, rgba(240, 230, 211, 0.4),  transparent 60%),
    radial-gradient(1.5px 1.5px at 28% 94%, rgba(240, 230, 211, 0.5),  transparent 60%);
  opacity: 0.7;
}

/* Everything on top of the veil */
body.veil > * { position: relative; z-index: 1; }

/* ============================================================
   Ornament divider — place between major sections
   Usage: <div class="ornament" aria-hidden="true"></div>
   Classical editorial mark (❧) flanked by gold hairlines.
   ============================================================ */

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 3rem auto 2.5rem;
  max-width: 360px;
  color: var(--veil-gold);
  font-family: var(--veil-font-display);
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0.85;
}

.ornament::before,
.ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(201, 168, 76, 0.45),
    transparent
  );
}

.ornament::before { background: linear-gradient(to right, transparent, rgba(201, 168, 76, 0.45)); }
.ornament::after  { background: linear-gradient(to left,  transparent, rgba(201, 168, 76, 0.45)); }

.ornament span {
  font-style: italic;
  font-weight: 400;
  transform: translateY(-2px);
}

/* ============================================================
   Drop cap — first letter of the first paragraph
   Usage: <p class="lede">...</p>
   Classical illuminated-manuscript drop, 3 lines tall, gold.
   ============================================================ */

.lede::first-letter {
  font-family: var(--veil-font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 4.2rem;
  line-height: 0.9;
  float: left;
  padding: 0.25rem 0.75rem 0 0;
  margin-top: 0.2rem;
  color: var(--veil-gold);
  text-shadow: 0 2px 18px rgba(201, 168, 76, 0.25);
}

/* ============================================================
   Scenario roman numerals (symbol pages)
   Usage: <div class="scenario" data-numeral="I">
   Replaces the generic h3 title bar with a book-chapter cue.
   ============================================================ */

.scenario {
  position: relative;
}

.scenario[data-numeral]::before {
  content: attr(data-numeral);
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-family: var(--veil-font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--veil-gold);
  opacity: 0.6;
}

/* ============================================================
   Icon glyphs — gold monoline, 28×28
   Used in place of emoji feature icons on landing.
   Classes: .glyph-lock .glyph-mic .glyph-sparkle .glyph-export
            .glyph-archive .glyph-moon
   Each is an inline SVG ref via mask-image for single-color fill.
   ============================================================ */

.glyph {
  display: inline-block;
  width: 32px;
  height: 32px;
  background-color: var(--veil-gold);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.glyph-lock     { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='10' width='16' height='11' rx='1.5'/><path d='M8 10V7a4 4 0 0 1 8 0v3'/><circle cx='12' cy='15.5' r='1.1' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='10' width='16' height='11' rx='1.5'/><path d='M8 10V7a4 4 0 0 1 8 0v3'/><circle cx='12' cy='15.5' r='1.1' fill='black'/></svg>"); }

.glyph-mic      { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='3' width='6' height='12' rx='3'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/><path d='M9 21h6'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='3' width='6' height='12' rx='3'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/><path d='M9 21h6'/></svg>"); }

.glyph-sparkle  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v4M12 18v4M2 12h4M18 12h4M5 5l3 3M16 16l3 3M19 5l-3 3M8 16l-3 3'/><circle cx='12' cy='12' r='2.2' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v4M12 18v4M2 12h4M18 12h4M5 5l3 3M16 16l3 3M19 5l-3 3M8 16l-3 3'/><circle cx='12' cy='12' r='2.2' fill='black'/></svg>"); }

.glyph-export   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M4 13v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5'/><path d='M12 3v13'/><path d='M7 8l5-5 5 5'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M4 13v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5'/><path d='M12 3v13'/><path d='M7 8l5-5 5 5'/></svg>"); }

.glyph-archive  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4h14l-1 4H6L5 4z'/><rect x='5' y='8' width='14' height='12' rx='1.5'/><path d='M10 13h4'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4h14l-1 4H6L5 4z'/><rect x='5' y='8' width='14' height='12' rx='1.5'/><path d='M10 13h4'/></svg>"); }

.glyph-moon     { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M20 14.5A8 8 0 1 1 9.5 4a6 6 0 0 0 10.5 10.5z'/><circle cx='16' cy='7' r='0.8' fill='black'/><circle cx='19' cy='10.5' r='0.5' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M20 14.5A8 8 0 1 1 9.5 4a6 6 0 0 0 10.5 10.5z'/><circle cx='16' cy='7' r='0.8' fill='black'/><circle cx='19' cy='10.5' r='0.5' fill='black'/></svg>"); }

/* ============================================================
   A–Z grimoire hub — illuminated chapter layout
   Used by /blog/dream-symbol/index.html (rebuilt by gen:hub)
   ============================================================ */

.grimoire-hub {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.grimoire-hub > header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.grimoire-hub h1 {
  font-family: var(--veil-font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
  color: var(--veil-ink);
}

.grimoire-hub h1 em {
  font-style: italic;
  color: var(--veil-gold);
}

.grimoire-hub .subtitle {
  color: var(--veil-ink-soft);
  font-style: italic;
  font-family: var(--veil-font-display);
  max-width: 520px;
  margin: 0 auto;
  font-size: 1.05rem;
}

.chapter {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
}

.chapter:last-child { border-bottom: none; }

.chapter-letter {
  font-family: var(--veil-font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 6rem;
  line-height: 0.8;
  color: var(--veil-gold);
  text-shadow: 0 2px 20px rgba(201, 168, 76, 0.3);
  user-select: none;
  align-self: start;
  position: sticky;
  top: 1rem;
}

.chapter-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.chapter-entries li { margin: 0; }

.chapter-entries a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.5rem 0.5rem 0;
  color: var(--veil-ink);
  text-decoration: none;
  border-radius: 10px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.chapter-entries a:hover {
  background: rgba(201, 168, 76, 0.06);
  transform: translateX(3px);
}

.chapter-entries .thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 168, 76, 0.25);
}

.chapter-entries .thumb.placeholder {
  background: linear-gradient(135deg, var(--veil-violet-dark), var(--veil-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--veil-gold);
  font-family: var(--veil-font-display);
  font-style: italic;
  font-size: 1.2rem;
}

.chapter-entries .label {
  font-family: var(--veil-font-body);
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--veil-ink);
  letter-spacing: 0.005em;
}

.chapter-entries a:hover .label { color: var(--veil-gold); }

@media (max-width: 640px) {
  .chapter {
    grid-template-columns: 68px 1fr;
    gap: 1.25rem;
    padding: 1.5rem 0;
  }
  .chapter-letter { font-size: 4rem; }
  .chapter-entries {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .chapter-entries .thumb { width: 36px; height: 36px; }
}

/* ============================================================
   Reading progress — 2px gold rail along the left edge.
   Pure CSS via scroll-driven animation (progressive enhancement;
   falls back silently in unsupported browsers).
   ============================================================ */

@supports (animation-timeline: scroll()) {
  body.veil::before {
    /* keep the existing ambient gradient — progress rail added via a
       dedicated element to avoid stacking against the ::before layer */
  }
  body.veil .scroll-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--veil-gold), transparent);
    transform-origin: top;
    transform: scaleY(0);
    animation: scrollRail linear both;
    animation-timeline: scroll();
    z-index: 5;
    pointer-events: none;
    opacity: 0.5;
  }
  @keyframes scrollRail {
    to { transform: scaleY(1); }
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  body.veil .scroll-rail { display: none; }
}
