/*
Theme Name:  הקודקס של השוליים
Theme URI:   https://codex-of-margins.com
Description: תבנית לורקראפטית-יהודית כהה עבור יקום "הקודקס של השוליים" — קומיקס, סיפורות ומשחק.
Author:      נמרוד דוויק
Version:     1.0.0
Text Domain: codex-margins
Tags:        dark, hebrew, rtl, fantasy, lovecraftian
*/

/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --black:       #060402;
  --deep:        #0e0a07;
  --charcoal:    #191209;
  --surface:     #221810;
  --surface-hi:  #2d2015;
  --gold:        #b8962a;
  --gold-dim:    #7a6018;
  --gold-bright: #ddb94a;
  --blood:       #7a1515;
  --blood-hi:    #b02020;
  --parchment:   #c4b49a;
  --parch-dim:   #8a7a62;
  --text:        #c8b89c;
  --text-dim:    #8a7a62;
  --text-faint:  #3e3328;

  --f-display: 'Frank Ruhl Libre', 'Times New Roman', serif;
  --f-body:    'Rubik', sans-serif;
  --f-latin:   'Cinzel', 'Palatino Linotype', serif;
}

html { font-size: 18px; scroll-behavior: smooth; }

/* ===== ACCESSIBILITY ===== */
.skip-link {
  position: absolute; top: -100%; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: var(--black); padding: 0.5rem 1.2rem;
  font-family: var(--f-body); font-weight: 700; font-size: 0.9rem;
  z-index: 9999; text-decoration: none; border-radius: 0 0 4px 4px;
  transition: top 200ms ease; white-space: nowrap;
}
.skip-link:focus { top: 0; }
.a11y-anchor { position: absolute; top: 0; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 2px solid var(--gold) !important;
  outline-offset: 3px !important;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold) !important;
  outline-offset: 3px !important;
}

body {
  background: var(--black);
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 300;
  line-height: 1.9;
  direction: rtl;
  overflow-x: hidden;
}
#page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
/* Film grain overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9000; opacity: 0.45; mix-blend-mode: overlay;
}

/* ===== NAVIGATION ===== */
#site-nav {
  position: fixed; top: 0; width: 100%; z-index: 800;
  padding: 1.4rem 4rem;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(6,4,2,0.92);
  transition: background 400ms, box-shadow 400ms;
}
#site-nav.scrolled { background: rgba(6,4,2,0.97); border-bottom: 1px solid rgba(184,150,42,0.07); }

.nav-logo {
  font-family: var(--f-display); font-size: 1.1rem; font-weight: 700;
  color: var(--gold); letter-spacing: 0.04em; text-decoration: none;
  transition: color 300ms;
}
.nav-logo:hover { color: var(--gold-bright); }

.nav-menu { display: flex; gap: 2.2rem; list-style: none; }
.nav-menu a {
  font-family: var(--f-body); color: var(--parch-dim); text-decoration: none;
  font-size: 0.9rem; font-weight: 400; letter-spacing: 0.07em;
  position: relative; transition: color 300ms;
}
.nav-menu a::after {
  content: ''; position: absolute; bottom: -3px; right: 0;
  width: 0; height: 1px; background: var(--gold); transition: width 500ms ease;
}
.nav-menu a:hover, .nav-menu .current-menu-item a { color: var(--gold); }
.nav-menu a:hover::after, .nav-menu .current-menu-item a::after { width: 100%; }
.nav-menu .latin a { font-family: var(--f-latin); font-size: 0.78rem; letter-spacing: 0.12em; }

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: 10rem 4rem 5rem; overflow: hidden;
  background-image: url('images/codex.png');
  background-size: cover; background-position: center center;
}
#particle-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
}
.hero-vignette {
  position: absolute; inset: 0; z-index: 1;
  background:
    rgba(6,4,2,0.72),
    radial-gradient(ellipse 80% 55% at 50% 45%, rgba(122,21,21,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 50% 30% at 50% 90%, rgba(184,150,42,0.06) 0%, transparent 60%),
    linear-gradient(180deg, rgba(6,4,2,0.55) 0%, rgba(6,4,2,0) 25%, rgba(6,4,2,0) 75%, rgba(6,4,2,0.88) 100%);
}
.hero-content {
  position: relative; z-index: 2; max-width: 900px;
  /* soft dark halo behind the lower text for readability */
  background: radial-gradient(ellipse 95% 65% at 50% 68%, rgba(4,2,1,0.62) 0%, rgba(4,2,1,0.30) 55%, transparent 78%);
  padding-bottom: 1rem;
}

.hero-pre {
  font-family: var(--f-latin); font-size: 0.65rem; letter-spacing: 0.38em;
  color: var(--blood); text-transform: uppercase; margin-bottom: 2.5rem;
  opacity: 0; animation: aFadeDown 1s ease 0.4s forwards;
}
/* wrapper handles the entrance; h1 itself is always visible so flicker/pulse work */
.hero-title-wrap { opacity: 0; animation: aReveal 1.3s ease 0.7s forwards; }
.hero-title {
  font-family: var(--f-display); font-size: clamp(4rem, 9vw, 7.5rem);
  font-weight: 900; line-height: 1.02; color: var(--parchment);
  letter-spacing: -0.015em;
}
.hero-rule {
  width: 100px; height: 1px; margin: 2rem auto;
  background: linear-gradient(to left, transparent, var(--gold), transparent);
  opacity: 0; animation: aFade 0.8s ease 1.6s forwards;
}
.hero-tagline {
  font-family: var(--f-display); font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  font-weight: 300; font-style: italic; color: var(--gold-dim); margin-bottom: 1.2rem;
  opacity: 0; animation: aFade 0.8s ease 1.9s forwards;
  text-shadow: 0 1px 8px rgba(4,2,1,0.95), 0 0 24px rgba(4,2,1,0.8);
}
.hero-body {
  font-size: 1.05rem; color: #b8a888; line-height: 2.0;
  max-width: 600px; margin: 0 auto 4.5rem;
  opacity: 0; animation: aFade 0.8s ease 2.2s forwards;
  text-shadow: 0 1px 6px rgba(4,2,1,0.95), 0 0 18px rgba(4,2,1,0.8);
}

/* ===== HOME CARDS ===== */
.cards-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem; max-width: 1100px; margin: 0 auto; padding: 0 2rem;
  position: relative; z-index: 2;
  opacity: 0; animation: aFadeUp 1s ease 2.6s forwards;
}
.card {
  background: rgba(22,16,9,0.85); border: 1px solid rgba(184,150,42,0.1);
  padding: 2.4rem 2rem; cursor: pointer; position: relative; overflow: hidden;
  transition: border-color 450ms, box-shadow 450ms, transform 400ms;
  text-decoration: none; display: flex; flex-direction: column;
}
.card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(122,21,21,0.18) 0%, transparent 70%);
  opacity: 0; transition: opacity 450ms;
}
.card:hover { border-color: rgba(122,21,21,0.5); transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 1px rgba(122,21,21,0.4); }
.card:hover::before { opacity: 1; }
.card .btn { margin-top: auto; align-self: flex-start; }
.card-pre { font-family: var(--f-latin); font-size: 0.62rem; letter-spacing: 0.32em;
  color: var(--blood-hi); text-transform: uppercase; margin-bottom: 1rem; }
.card-title { font-family: var(--f-display); font-size: 1.65rem;
  font-weight: 700; color: var(--parchment); margin-bottom: 0.9rem; }
.card-body { font-size: 0.92rem; color: var(--text-dim); line-height: 1.85; margin-bottom: 1.6rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block; padding: 0.6rem 1.7rem;
  font-family: var(--f-body); font-size: 0.82rem; font-weight: 400;
  letter-spacing: 0.1em; color: var(--gold); background: transparent;
  border: 1px solid rgba(184,150,42,0.35); cursor: pointer;
  text-decoration: none; transition: all 350ms ease;
}
.btn:hover { background: rgba(184,150,42,0.08); border-color: var(--gold); color: var(--gold-bright); }
.btn-blood { background: rgba(122,21,21,0.18); border-color: rgba(122,21,21,0.5); color: var(--parchment); }
.btn-blood:hover { background: rgba(122,21,21,0.32); border-color: var(--blood-hi); }
.btn-ghost { opacity: 0.45; cursor: default !important; pointer-events: none; }
.btn-play { background: rgba(42,120,184,0.18); border-color: rgba(42,120,184,0.5); color: var(--parchment); }
.btn-play:hover { background: rgba(42,120,184,0.32); border-color: #5aaddf; }

/* ===== VIDEO SECTIONS (Animation page) ===== */
.video-section { margin-top: 4rem; }
.video-title {
  font-family: var(--f-display); font-size: 1.6rem;
  color: var(--gold); margin-bottom: 0.8rem; text-align: center;
}
.video-credits {
  text-align: center; font-size: 0.85rem; color: var(--text-dim);
  margin-bottom: 1.5rem; line-height: 1.8;
}
.video-embed {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border: 1px solid rgba(184,150,42,0.15); border-radius: 4px;
}
.video-embed iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}

/* ===== SECTION SKELETON ===== */
.section-wrap { max-width: 860px; margin: 0 auto; padding: 9rem 4rem 7rem; }
.section-head { text-align: center; margin-bottom: 4rem; }
.s-eyebrow { font-family: var(--f-latin); font-size: 0.62rem; letter-spacing: 0.4em;
  color: var(--blood); text-transform: uppercase; display: block; margin-bottom: 1.8rem; }
.s-title { font-family: var(--f-display); font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 900; line-height: 1.08; color: var(--parchment); margin-bottom: 0.8rem; }
.s-sub { font-family: var(--f-display); font-size: 1.15rem;
  font-weight: 300; font-style: italic; color: var(--gold-dim); }
.ornament { display: flex; align-items: center; gap: 1.2rem; margin: 2.2rem 0; }
.ornament::before, .ornament::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to left, transparent, rgba(184,150,42,0.25)); }
.ornament::after { background: linear-gradient(to right, transparent, rgba(184,150,42,0.25)); }
.ornament-gem { width: 7px; height: 7px; flex-shrink: 0; background: var(--gold-dim); transform: rotate(45deg); }

/* ===== LITERARY TEXT ===== */
.prose { font-size: 1.1rem; line-height: 2.1; color: var(--text); font-weight: 300; }
.prose p { margin-bottom: 1.7em; }
.prose p:first-of-type:not(.story-author)::first-letter {
  font-family: var(--f-display); font-size: 3.8em; font-weight: 900;
  color: var(--gold); float: right; margin-left: 0.12em; margin-top: 0.04em; line-height: 0.8;
}
.prose a { color: var(--parchment); text-decoration: underline; text-decoration-color: rgba(196,180,154,0.3); transition: text-decoration-color 200ms; }
.prose a:hover { text-decoration-color: var(--parchment); }
.prose .blood { color: var(--blood-hi); }
.prose .highlight { color: var(--parchment); font-weight: 400; }

/* ===== STORIES ===== */
.stories-art {
  position: relative; width: 100%; min-height: 42vh;
  margin: -1rem 0 3.5rem; overflow: hidden;
}
.stories-art-bg {
  position: absolute; inset: 0;
  background-image: url('images/Stories.png');
  background-size: cover; background-position: center 20%;
  opacity: 0.42;
}
.stories-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(6,4,2,0.70) 0%, rgba(6,4,2,0.28) 45%, rgba(6,4,2,0.85) 100%);
}
.stories-art-img { display: none; } /* replaced by bg image */
.stories-stack { display: flex; flex-direction: column; gap: 1.6rem; margin-top: 3rem; }
.story-card {
  display: flex; align-items: flex-start; gap: 2rem; padding: 2rem;
  border: 1px solid rgba(184,150,42,0.07); background: rgba(14,10,7,0.7);
  cursor: pointer; position: relative; text-decoration: none;
  transition: border-color 400ms, background 400ms, box-shadow 400ms;
}
.story-card::before {
  content: ''; position: absolute; top: 0; right: 0; width: 0; height: 100%;
  background: var(--blood); opacity: 0.7; transition: width 350ms ease;
}
.story-card:hover { border-color: rgba(122,21,21,0.35); background: rgba(22,16,9,0.95); }
.story-card:hover::before { width: 3px; }
.story-num { font-family: var(--f-latin); font-size: 2rem; font-weight: 900;
  color: rgba(184,150,42,0.12); flex-shrink: 0; width: 2.8rem;
  text-align: center; line-height: 1; margin-top: 0.15rem; }
.story-inner { flex: 1; }
.story-title { font-family: var(--f-display); font-size: 1.45rem;
  font-weight: 700; color: var(--parchment); margin-bottom: 0.5rem; }
.story-blurb { font-size: 0.94rem; color: var(--text-dim); line-height: 1.8; margin-bottom: 1rem; }

/* ===== COMICS ===== */
.comics-hero-wrap { padding: 9rem 4rem 3rem; text-align: center; }
.comic-reader { max-width: 680px; margin: 2rem auto; }
.comic-page-img {
  width: 100%; display: block; margin: 0 auto 1.5rem;
  filter: sepia(15%) brightness(0.88) contrast(1.08);
  border: 1px solid rgba(184,150,42,0.12);
  transition: filter 400ms;
}
.comic-page-img:hover { filter: sepia(5%) brightness(0.95) contrast(1.05); }
.comic-nav { display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 0; border-top: 1px solid rgba(184,150,42,0.08); }
.comic-page-counter { font-family: var(--f-latin); font-size: 0.68rem;
  letter-spacing: 0.3em; color: var(--text-faint); }
.comic-frame {
  max-width: 500px; margin: 3rem auto; padding: 3rem 2.5rem;
  background: rgba(14,10,7,0.8); border: 1px solid rgba(184,150,42,0.18);
  position: relative;
}
.comic-frame::before, .comic-frame::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border-color: var(--gold-dim); border-style: solid;
}
.comic-frame::before { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.comic-frame::after  { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.comic-frame-title { font-family: var(--f-display); font-size: 1.8rem;
  font-weight: 700; color: var(--parchment); margin-bottom: 1.5rem; }

/* ===== GAME ===== */
.game-banner {
  min-height: 55vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: 10rem 4rem 4rem; position: relative; overflow: hidden;
}
.game-banner-bg {
  position: absolute; inset: 0;
  background-image: url('images/ziz.png');
  background-size: cover; background-position: center 30%;
  opacity: 0.40;
}
.game-banner::after {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(to bottom,
    rgba(6,4,2,0.75) 0%, rgba(6,4,2,0.35) 45%, rgba(6,4,2,0.80) 100%);
}
/* page-banner — same layout as game-banner but image supplied inline */
.page-banner {
  min-height: 55vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: 10rem 4rem 4rem; position: relative; overflow: hidden;
}
.page-banner-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 30%;
  opacity: 0.40;
}
.page-banner::after {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(to bottom,
    rgba(6,4,2,0.75) 0%, rgba(6,4,2,0.35) 45%, rgba(6,4,2,0.80) 100%);
}
.game-wrap { position: relative; z-index: 1; }
.game-pre { font-family: var(--f-latin); font-size: 0.62rem; letter-spacing: 0.38em;
  color: var(--blood); text-transform: uppercase; margin-bottom: 1.2rem; }
.game-title-en { font-family: var(--f-latin); font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  font-weight: 900; color: var(--parchment); letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.game-title-heb { font-family: var(--f-display); font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 700; color: var(--parchment); letter-spacing: 0.01em; margin-bottom: 0.4rem; }
.game-title-he { font-family: var(--f-display); font-size: 1.2rem;
  font-weight: 300; font-style: italic; color: var(--gold-dim); margin-bottom: 2.5rem; }
.badge { display: inline-block; padding: 0.3rem 0.9rem;
  font-family: var(--f-latin); font-size: 0.6rem; letter-spacing: 0.3em;
  color: var(--blood); border: 1px solid rgba(122,21,21,0.4);
  background: rgba(122,21,21,0.07); text-transform: uppercase; margin-bottom: 2.5rem; }

/* ===== MONSTER GRID ===== */
.monsters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 1rem; margin-top: 2rem; }

/* ===== REVEAL ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 750ms ease, transform 750ms ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }

/* ===== ANIMATION PAGE ===== */
.anim-episode { margin: 4rem 0; }
.anim-episode-title { font-family: var(--f-display); font-size: 1.5rem; color: var(--gold);
  margin-bottom: 0.8rem; }
.anim-credits { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1.2rem;
  display: flex; gap: 2rem; flex-wrap: wrap; }
.anim-embed { position: relative; width: 100%; padding-bottom: 56.25%; /* 16:9 */
  background: #000; border: 1px solid rgba(184,150,42,0.12); border-radius: 3px;
  overflow: hidden; }
.anim-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ===== FOOTER ===== */
#site-footer { margin-top: auto; padding: 2.8rem 4rem; flex-shrink: 0; border-top: 1px solid rgba(184,150,42,0.07);
  text-align: center; color: var(--text); font-size: 0.82rem; letter-spacing: 0.08em; }
#site-footer a { color: var(--gold-dim); text-decoration: none; }
#site-footer a:hover { color: var(--gold); }
#site-footer .f-logo { font-family: var(--f-display); font-size: 1rem;
  color: var(--gold-dim); margin-bottom: 0.4rem; }

/* ===== KEYFRAMES ===== */
@keyframes aFade    { from{opacity:0} to{opacity:1} }
@keyframes aFadeDown { from{opacity:0;transform:translateY(-12px)} to{opacity:1;transform:translateY(0)} }
@keyframes aFadeUp  { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
@keyframes aReveal  { from{opacity:0;filter:blur(10px);transform:translateY(14px)} to{opacity:1;filter:blur(0);transform:translateY(0)} }
@keyframes flicker  { 0%,100%{opacity:1} 91%{opacity:1} 92%{opacity:.35} 93%{opacity:1} 95%{opacity:.65} 96%{opacity:1} }
@keyframes pulseGold { 0%,100%{text-shadow:none} 50%{text-shadow:0 0 30px rgba(184,150,42,0.25)} }
.flicker { animation: flicker 9s infinite; }
.pulse   { animation: pulseGold 5s ease-in-out infinite; }
.hr-blood { height:1px; border:none; margin:4rem 0;
  background:linear-gradient(to left, transparent, rgba(122,21,21,0.4), transparent); }

/* ===== STORY READING VIEW ===== */
.story-reading { max-width: 700px; margin: 0 auto; }
.story-reading .story-meta { font-family: var(--f-latin); font-size: 0.65rem;
  letter-spacing: 0.32em; color: var(--blood); text-transform: uppercase; margin-bottom: 3rem; }
.story-reading .story-section-break { text-align: center; color: var(--gold-dim);
  font-size: 1.2rem; letter-spacing: 0.5em; margin: 2.5rem 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 820px) {
  #site-nav { padding: 1.3rem 1.8rem; }
  .nav-menu { gap: 1rem; }
  .nav-menu a { font-size: 0.8rem; }
  .cards-row { grid-template-columns: 1fr; padding: 0 1.5rem; }
  .section-wrap { padding: 7rem 1.8rem 5rem; }
  .hero { padding: 8rem 2rem 4rem; }
  .game-banner, .page-banner { padding: 7rem 2rem 3rem; min-height: 40vh; }
  .game-title-heb { font-size: clamp(2.2rem, 6vw, 4rem); }
  .game-title-he { font-size: 1rem; margin-bottom: 1.8rem; }
  .comic-reader { margin: 2rem 1rem; }
  .monsters-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .monsters-grid { grid-template-columns: 1fr; }
  .nav-menu { gap: 0.7rem; }
  .nav-menu a { font-size: 0.72rem; }
  .game-banner, .page-banner { padding: 5.5rem 1.2rem 2.5rem; min-height: 35vh; }
  .game-pre { font-size: 0.55rem; margin-bottom: 0.8rem; }
  #site-footer { padding: 2rem 1.5rem; }
}

/* ===== CARD SHIMMER (JS-driven: --shimmer-x, --shimmer-y on hover) ===== */
.card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(
    circle 180px at var(--shimmer-x, 50%) var(--shimmer-y, 50%),
    rgba(184,150,42,0.09) 0%, transparent 70%
  );
  opacity: 0; transition: opacity 300ms;
}
.card:hover::after { opacity: 1; }

/* ===== STORY READING VIEW ===== */
.story-wrap { padding-bottom: 6rem; }
.story-reader { max-width: 800px; margin: 0 auto 2.5rem; }
.story-stage {
  padding: 3.5rem 4rem 2.5rem;
  background: rgba(6,4,2,0.9);
  min-height: 420px;
}
.story-header { text-align: center; margin-bottom: 3rem; padding-top: 6rem; }
.story-genre {
  font-family: var(--f-latin); font-size: 0.62rem; letter-spacing: 0.42em;
  color: var(--blood); text-transform: uppercase; display: block; margin-bottom: 1.4rem;
}
.story-title {
  font-family: var(--f-display); font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 900; color: var(--parchment); line-height: 1.1; margin-bottom: 0.7rem;
}
.story-author {
  font-family: var(--f-display); font-size: 1rem; font-weight: 300;
  font-style: italic; color: var(--gold-dim); margin-top: 0.5rem;
}
.story-body { font-size: 1.05rem; line-height: 2.15; color: var(--text); font-weight: 300; }
.story-body p { margin-bottom: 1.6em; }

/* Story-specific page-flip animations — more dramatic than comic reader */
.story-page { transform-origin: center center; }
.story-page.cv-exit-left  { animation: spExitL  0.45s ease forwards; }
.story-page.cv-exit-right { animation: spExitR  0.45s ease forwards; }
.story-page.cv-enter-left { animation: spEnterL 0.55s ease forwards; }
.story-page.cv-enter-right{ animation: spEnterR 0.55s ease forwards; }
@keyframes spExitL  { to   { opacity: 0; transform: translateX(-6%) rotateY(28deg); } }
@keyframes spExitR  { to   { opacity: 0; transform: translateX(6%)  rotateY(-28deg); } }
@keyframes spEnterL { from { opacity: 0; transform: translateX(6%)  rotateY(-28deg); } to { opacity: 1; transform: none; } }
@keyframes spEnterR { from { opacity: 0; transform: translateX(-6%) rotateY(28deg);  } to { opacity: 1; transform: none; } }
.story-body p:first-of-type::first-letter {
  font-family: var(--f-display); font-size: 3.8em; font-weight: 900;
  color: var(--gold); float: right; margin-left: 0.12em; margin-top: 0.04em; line-height: 0.8;
}
.story-break {
  text-align: center; color: var(--gold-dim); font-size: 0.85rem;
  letter-spacing: 0.55em; margin: 3rem 0; opacity: 0.55;
}
.story-footer { margin-top: 5rem; text-align: center; }
.story-toolbar { background: rgba(6,4,2,0.96); }

/* ===== STORY READING MODE ===== */
.story-reader.reading-mode {
  background: #f4efe4;
  border-color: rgba(120,90,40,0.3);
}
.story-reader.reading-mode .story-stage {
  background: #f4efe4;
}
.story-reader.reading-mode .story-body {
  color: #1c1206; font-size: 1.1rem; line-height: 2.25;
}
.story-reader.reading-mode .story-body p { color: #2a1d0d; }
.story-reader.reading-mode .story-break { color: #7a5c22; }
.story-reader.reading-mode .story-body p:first-of-type::first-letter { color: #7a1515; }
.story-reader.reading-mode .cv-nav { background: #ede5d5; border-top-color: rgba(120,90,40,0.2); }
.story-reader.reading-mode .cv-btn { color: #3a2810; border-color: rgba(60,40,15,0.35); }
.story-reader.reading-mode .cv-btn:hover { background: rgba(60,40,15,0.08); }
.story-reader.reading-mode .cv-counter { color: #7a6230; }
.story-reader.reading-mode .cv-toolbar,
.story-reader.reading-mode .story-toolbar { background: #ede5d5; border-top-color: rgba(120,90,40,0.2); }
.story-reader.reading-mode .cv-btn-fs { color: #3a2810; border-color: rgba(60,40,15,0.25); }

/* Fullscreen reading */
.story-reader:fullscreen, .story-reader:-webkit-full-screen {
  max-width: 100%; width: 100%; height: 100%;
  display: flex; flex-direction: column; background: #f4efe4; overflow-y: auto;
}
.story-reader:fullscreen .story-stage, .story-reader:-webkit-full-screen .story-stage {
  flex: 1; background: #f4efe4; padding: 5rem min(8rem, 10vw) 3rem;
}
.story-reader:fullscreen .story-body, .story-reader:-webkit-full-screen .story-body {
  color: #1c1206; font-size: 1.15rem; line-height: 2.3;
  max-width: 700px; margin: 0 auto;
}
.story-reader:fullscreen .story-body p, .story-reader:-webkit-full-screen .story-body p { color: #2a1d0d; }
.story-reader:fullscreen .story-body p:first-of-type::first-letter,
.story-reader:-webkit-full-screen .story-body p:first-of-type::first-letter { color: #7a1515; }
.story-reader:fullscreen .cv-nav, .story-reader:-webkit-full-screen .cv-nav { background: #ede5d5; }
.story-reader:fullscreen .cv-btn, .story-reader:-webkit-full-screen .cv-btn { color: #3a2810; border-color: rgba(60,40,15,0.3); }
.story-reader:fullscreen .cv-counter, .story-reader:-webkit-full-screen .cv-counter { color: #7a6230; }
.story-reader:fullscreen .story-toolbar, .story-reader:-webkit-full-screen .story-toolbar { background: #ede5d5; }
.story-reader:fullscreen .cv-btn-fs, .story-reader:-webkit-full-screen .cv-btn-fs { color: #3a2810; }

/* ===== NAV SCROLL STATE (shadow reinforcement) ===== */
#site-nav.scrolled {
  box-shadow: 0 2px 28px rgba(0,0,0,0.55);
}

/* Tablet story reading (820px first, then 640px overrides below) */
@media (max-width: 820px) {
  .story-prose { padding: 7rem 1.8rem 5rem; }
  .story-stage { padding: 2.5rem 1.8rem 2rem; }
  .cv-reader.story-reader { margin: 0 1rem 2rem; }
}

/* Mobile story reading — overrides the 820px rules above */
@media (max-width: 640px) {
  .story-header { padding-top: 5rem; margin-bottom: 1.5rem; }
  .cv-reader.story-reader { margin: 0 0.6rem; }
  .story-stage { padding: 2rem 1.2rem 1.5rem; }
  .story-body { font-size: 1rem; line-height: 2.05; }
  .story-reader.reading-mode .story-body { font-size: 1.05rem; }
  .story-reader .cv-nav { padding: 0.5rem 0.8rem; gap: 0.5rem; }
  .story-reader .cv-btn { min-height: 44px; padding: 0 1rem; font-size: 0.78rem; }
  .story-reader .cv-counter { font-size: 0.75rem; }
  .story-toolbar { flex-wrap: wrap; gap: 0.6rem; padding: 0.6rem 1rem; }
  .story-card { gap: 1rem; padding: 1.4rem; }
  .story-num { font-size: 1.5rem; width: 2rem; }
  .story-title { font-size: 1.2rem; }
  .story-blurb { font-size: 0.88rem; }
}

/* ===== LORE / AL-HAYEKUM SECTION ===== */
.lore-section { max-width: 800px; margin: 0 auto; padding: 5rem 4rem; }
.lore-section .s-eyebrow { display: block; text-align: center; margin-bottom: 1.6rem; }
.lore-section .ornament { max-width: 300px; margin: 0 auto 3rem; }
.lore-section .prose { font-size: 1rem; line-height: 2.2; }
@media (max-width: 820px) { .lore-section { padding: 4rem 1.8rem; } }

/* ===== COMIC BOOK READER ===== */
.cv-reader {
  background: #000; max-width: 800px; margin: 2.5rem auto;
  border: 1px solid rgba(184,150,42,0.15); position: relative;
}
.cv-reader:fullscreen, .cv-reader:-webkit-full-screen {
  max-width: 100%; width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: center; background: #000;
}
.cv-reader:fullscreen .cv-stage, .cv-reader:-webkit-full-screen .cv-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.cv-reader:fullscreen .cv-stage img, .cv-reader:-webkit-full-screen .cv-stage img {
  max-height: calc(100vh - 110px); width: auto; max-width: 100%;
}
.cv-stage { position: relative; overflow: hidden; cursor: pointer; }
.cv-page { display: none; }
.cv-page img {
  width: 100%; display: block;
  filter: sepia(8%) brightness(0.92) contrast(1.06);
}
.cv-exit-left  { animation: cvExitL  0.28s ease forwards; }
.cv-exit-right { animation: cvExitR  0.28s ease forwards; }
.cv-enter-left { animation: cvEnterL 0.38s ease forwards; }
.cv-enter-right{ animation: cvEnterR 0.38s ease forwards; }
@keyframes cvExitL  { to { opacity:0; transform: perspective(900px) translateX(-5%) rotateY(18deg); } }
@keyframes cvExitR  { to { opacity:0; transform: perspective(900px) translateX(5%)  rotateY(-18deg);} }
@keyframes cvEnterL { from { opacity:0; transform: perspective(900px) translateX(5%)  rotateY(-18deg);} to { opacity:1; transform: none; } }
@keyframes cvEnterR { from { opacity:0; transform: perspective(900px) translateX(-5%) rotateY(18deg); } to { opacity:1; transform: none; } }
.cv-nav {
  display: flex; justify-content: center; align-items: center; gap: 2.5rem;
  padding: 0.9rem 1.2rem;
  background: rgba(10,8,5,0.95); border-top: 1px solid rgba(184,150,42,0.09);
}
.cv-btn { background: transparent; border: 1px solid rgba(184,150,42,0.28);
  color: var(--gold); font-family: var(--f-body); font-size: 0.82rem;
  padding: 0.45rem 1.3rem; cursor: pointer; letter-spacing: 0.1em; transition: all 300ms; }
.cv-btn:hover { background: rgba(184,150,42,0.08); border-color: var(--gold); }
.cv-btn:disabled { opacity: 0.25; cursor: default; pointer-events: none; }
.cv-counter { font-family: var(--f-latin); font-size: 0.72rem; letter-spacing: 0.3em; color: var(--text-dim); }
.cv-toolbar {
  display: flex; justify-content: center; align-items: center; gap: 1.2rem;
  padding: 0.7rem 1.2rem; border-top: 1px solid rgba(184,150,42,0.06);
  background: rgba(8,6,3,0.95);
}
.cv-btn-fs { background: transparent; border: 1px solid rgba(184,150,42,0.14);
  color: var(--text-dim); font-family: var(--f-body); font-size: 0.76rem;
  padding: 0.38rem 0.9rem; cursor: pointer; letter-spacing: 0.1em; transition: all 300ms; }
.cv-btn-fs:hover { color: var(--gold); border-color: rgba(184,150,42,0.3); }
@media (max-width: 820px) { .cv-reader { margin: 1.5rem 1rem; } }

/* ===== 404 PAGE ===== */
.page-404 {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 8rem 2rem;
}
.err-img { max-width: 480px; width: 100%; margin-bottom: 3rem;
  filter: brightness(0.88) sepia(8%) contrast(1.04); }
.err-pre { font-family: var(--f-latin); font-size: 0.62rem; letter-spacing: 0.42em;
  color: var(--blood-hi); text-transform: uppercase; margin-bottom: 1rem; }
.err-title { font-family: var(--f-display); font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900; color: var(--parchment); margin-bottom: 1.2rem; }
.err-body { color: var(--text-dim); font-size: 1rem; line-height: 1.9;
  max-width: 400px; margin: 0 auto 2.5rem; }

/* ===== MOBILE HAMBURGER + OVERLAY ===== */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 4px; z-index: 900; flex-shrink: 0;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--gold); margin: 5px 0; transition: all 300ms ease;
}
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: translateX(-8px); }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-overlay {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(6,4,2,0.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 350ms ease;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.nav-overlay.open { opacity: 1; pointer-events: all; }
.nav-overlay .nav-overlay-menu {
  flex-direction: column; align-items: center; gap: 2.8rem;
  list-style: none;
}
.nav-overlay .nav-overlay-menu a {
  font-family: var(--f-display); font-size: 1.6rem; font-weight: 700;
  color: var(--parchment); text-decoration: none;
  letter-spacing: 0.06em; transition: color 250ms;
}
.nav-overlay .nav-overlay-menu a:hover { color: var(--gold); }
.nav-overlay-close {
  position: absolute; top: 1.5rem; left: 1.5rem;
  background: none; border: none; color: var(--parchment);
  font-size: 1.5rem; cursor: pointer; opacity: 0.55;
  transition: opacity 200ms; line-height: 1; padding: 0.3rem;
}
.nav-overlay-close:hover { opacity: 1; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  #site-nav .nav-menu { display: none; }
}

/* ===== NEWSLETTER STICKY BAR ===== */
.newsletter-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9500;
  background: rgba(8,5,2,0.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(184,150,42,0.15);
  padding: 0.8rem 3rem;
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  transform: translateY(100%); transition: transform 420ms cubic-bezier(.22,.8,.4,1);
}
.newsletter-bar.visible { transform: translateY(0); }
.newsletter-label {
  font-family: var(--f-body); font-size: 0.82rem;
  color: var(--parchment); letter-spacing: 0.07em; white-space: nowrap;
}
.newsletter-form { display: flex; gap: 0.6rem; align-items: center; }
.newsletter-form input[type="email"] {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(184,150,42,0.25);
  color: var(--parchment); font-family: var(--f-body); font-size: 0.82rem;
  padding: 0.45rem 1rem; width: 220px;
  transition: border-color 250ms;
}
.newsletter-form input[type="email"]:focus { border-color: rgba(184,150,42,0.55); }
.newsletter-form input[type="email"]::placeholder { color: var(--text-faint); }
.newsletter-success {
  font-family: var(--f-body); font-size: 0.85rem;
  color: var(--gold); letter-spacing: 0.05em;
}
.newsletter-dismiss {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-faint);
  font-size: 1rem; cursor: pointer; transition: color 200ms; line-height: 1; padding: 0.3rem;
}
.newsletter-dismiss:hover { color: var(--parchment); }
@media (max-width: 640px) {
  .newsletter-bar { flex-direction: column; gap: 0.6rem; padding: 1rem 2.5rem 1rem 1rem; }
  .newsletter-form { width: 100%; }
  .newsletter-form input[type="email"] { width: 100%; flex: 1; }
  .newsletter-label { font-size: 0.78rem; }
}

/* ===== FULLSCREEN SCROLL LOCK ===== */
body.fs-lock { overflow: hidden !important; }
