/* ==========================================================================
   Arden Emil — Author Errant
   "Tears of the Aashahl" / The World of Miljah
   Design system: ember-lit stone, aged gold, parchment.
   Vanilla CSS, no build step, portable to a Weebly custom theme.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Ground */
  --ink:        #0b0907;
  --ink-2:      #100d0a;
  --stone:      #191410;
  --stone-2:    #221b15;
  --stone-3:    #2e251c;

  /* Light */
  --gold:       #c9a227;
  --gold-lit:   #e8cd7d;
  --gold-deep:  #a3831f;   /* 5.1:1 on --ink — used as text, not just borders */
  --ember:      #d4682a;
  --ember-lit:  #f08a45;

  /* Text */
  --parchment:  #efe6d5;
  --text:       #ddd2bd;
  --muted:      #9d8f79;
  --faint:      #8f8169;   /* 4.8:1 on --ink / --stone (WCAG AA) */

  /* Lines */
  --rule:       rgba(201, 162, 39, .26);
  --rule-soft:  rgba(201, 162, 39, .12);

  /* Type */
  --display: "Cinzel", "Trajan Pro", "Optima", Georgia, serif;
  --body:    "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ui:      "Cinzel", Georgia, serif;

  /* Metrics */
  --shell: 1180px;
  --prose: 68ch;
  --nav-h: 68px;
  --r: 3px;

  /* Motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t: .45s var(--ease);
}

/* ---------- 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: clamp(1.02rem, .96rem + .34vw, 1.19rem);
  line-height: 1.72;
  font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-lit); text-decoration: none; }
button { font: inherit; color: inherit; }

/* Ambient grain — sells the "old paper under lamplight" feel. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 3. Typography ------------------------------------------------ */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--parchment);
  line-height: 1.12;
  letter-spacing: .012em;
  margin: 0 0 .6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.3rem, 1.5rem + 3.6vw, 4.15rem); font-weight: 700; }
h2 { font-size: clamp(1.72rem, 1.25rem + 2.1vw, 2.75rem); }
h3 { font-size: clamp(1.2rem, 1.05rem + .7vw, 1.5rem); }
h4 { font-size: 1.02rem; letter-spacing: .09em; text-transform: uppercase; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

/* Eyebrow — small caps label above a heading. */
.eyebrow {
  font-family: var(--ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.1rem;
  display: block;
}

.lede {
  font-size: 1.2em;
  line-height: 1.62;
  color: var(--parchment);
}

.muted { color: var(--muted); }

/* Gilded title — the cover's lettering, in CSS. */
.gilt {
  background: linear-gradient(176deg, #f6e6b4 8%, var(--gold) 42%, #7d6014 72%, var(--gold-lit) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Drop cap for opening passages. */
.dropcap::first-letter {
  font-family: var(--display);
  font-size: 3.5em;
  line-height: .82;
  float: left;
  padding: .08em .1em 0 0;
  color: var(--gold);
}

/* ---------- 4. Layout ---------------------------------------------------- */
.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}
.shell--narrow { width: min(100% - 2.5rem, 800px); }
.prose { max-width: var(--prose); }

section { position: relative; }

.band { padding: clamp(4rem, 9vw, 8rem) 0; }
.band--tight { padding: clamp(2.75rem, 5vw, 4.25rem) 0; }
.band--stone { background: var(--stone); }
.band--ink   { background: var(--ink-2); }

/* Hairline between bands. */
.band + .band::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: min(100% - 2.5rem, var(--shell));
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-soft) 22%, var(--rule) 50%, var(--rule-soft) 78%, transparent);
}

/* ---------- 5. Skip link ------------------------------------------------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--gold);
  color: var(--ink);
  padding: .7rem 1.2rem;
  font-family: var(--ui);
  font-size: .8rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.skip:focus { left: 1rem; top: 1rem; }

:focus-visible {
  outline: 2px solid var(--gold-lit);
  outline-offset: 3px;
}

/* ---------- 6. Navigation ------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(11, 9, 7, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background var(--t), border-color var(--t);
}
.nav.is-stuck {
  background: rgba(11, 9, 7, .94);
  border-bottom-color: var(--rule-soft);
}

.nav__inner {
  width: min(100% - 2.5rem, 1320px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  font-family: var(--display);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--parchment);
  white-space: nowrap;
  margin-right: auto;
}
.brand__sigil {
  height: 30px;
  width: auto;
  flex: none;
  align-self: center;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.7));
}
.brand > span { display: flex; align-items: baseline; gap: .55rem; }

.brand small {
  font-size: .58rem;
  letter-spacing: .26em;
  color: var(--gold);
  font-weight: 400;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(.4rem, 1.6vw, 1.6rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  position: relative;
  display: block;
  padding: .45rem .15rem;
  font-family: var(--ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .28s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: .1rem;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav__links a:hover,
.nav__links a[aria-current="page"] { color: var(--parchment); }
.nav__links a:hover::after,
.nav__links a[aria-current="page"]::after { transform: scaleX(1); }
.nav__links a[aria-current="page"] { color: var(--gold-lit); }

.nav__toggle {
  display: none;
  width: 42px; height: 42px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  cursor: pointer;
  padding: 0;
  place-items: center;
}
.nav__toggle span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--parchment);
  margin: 3.5px auto;
  transition: transform .3s var(--ease), opacity .2s;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav__toggle { display: grid; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(11, 9, 7, .985);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--rule);
    padding: .5rem 1.25rem 1.5rem;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height .42s var(--ease), visibility .42s;
  }
  .nav__links.is-open {
    max-height: 80vh;
    visibility: visible;
    overflow-y: auto;
  }
  .nav__links a {
    padding: .95rem .25rem;
    font-size: .84rem;
    border-bottom: 1px solid var(--rule-soft);
  }
  .nav__links a::after { display: none; }
}

/* ---------- 7. Buttons --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .82rem 1.7rem;
  font-family: var(--ui);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  border: 1px solid var(--gold-deep);
  border-radius: var(--r);
  color: var(--gold-lit);
  background: transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
/* Gold wipe on hover. */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold-lit) 100%);
  transform: translateY(101%);
  transition: transform .38s var(--ease);
  z-index: -1;
}
.btn:hover {
  color: var(--ink);
  border-color: var(--gold-lit);
  transform: translateY(-2px);
}
.btn:hover::before { transform: translateY(0); }

.btn--solid {
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold-lit) 100%);
  color: var(--ink);
  border-color: var(--gold-lit);
  font-weight: 700;
}
.btn--solid::before { background: linear-gradient(100deg, var(--ember) 0%, var(--ember-lit) 100%); }
.btn--solid:hover { color: #1a0d05; }

.btn--ghost { border-color: var(--rule); color: var(--text); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 2rem;
}

/* Inline text link with underline sweep. */
.link {
  color: var(--gold-lit);
  border-bottom: 1px solid var(--rule);
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.link:hover { border-bottom-color: var(--gold-lit); color: #fff0c4; }

/* Arrow link. */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
}
.arrow-link svg { transition: transform .32s var(--ease); }
.arrow-link:hover { color: var(--gold-lit); }
.arrow-link:hover svg { transform: translateX(5px); }

/* ---------- 8. Hero ------------------------------------------------------ */
.hero {
  position: relative;
  min-height: min(100svh, 940px);
  display: grid;
  align-items: center;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(4rem, 8vw, 7rem);
  overflow: hidden;
  isolation: isolate;
}

.hero__bg {
  position: absolute;
  inset: -8% -2% -2%;
  z-index: -2;
  background-size: cover;
  background-position: center 28%;
  /* Parallax handled in JS via translate3d for GPU compositing. */
  will-change: transform;
}
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 65% at 50% 42%, rgba(11,9,7,.28), rgba(11,9,7,.86) 72%, var(--ink) 100%),
    linear-gradient(180deg, rgba(11,9,7,.82) 0%, rgba(11,9,7,.35) 32%, rgba(11,9,7,.9) 88%, var(--ink) 100%);
}

/* Sun-shaft wash, echoing the cover art. */
.hero__shaft {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(107deg, transparent 26%, rgba(232,205,125,.09) 38%, transparent 47%),
              linear-gradient(97deg, transparent 52%, rgba(212,104,42,.07) 62%, transparent 70%);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (max-width: 880px) {
  .hero__grid { grid-template-columns: 1fr; text-align: center; }
  .hero__cover { order: -1; margin-inline: auto; max-width: 300px; }
  .hero .btn-row { justify-content: center; }
  .hero .rule-runes { margin-inline: auto; }
}

.hero__title {
  margin-bottom: .3em;
  text-shadow: 0 2px 40px rgba(0,0,0,.85);
}
.hero__sub {
  font-family: var(--display);
  font-size: clamp(.92rem, .8rem + .5vw, 1.18rem);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.6rem;
}

.hero__cover {
  position: relative;
  border-radius: 2px;
  box-shadow:
    0 2px 4px rgba(0,0,0,.5),
    0 30px 70px -18px rgba(0,0,0,.95),
    0 0 0 1px rgba(201,162,39,.22),
    0 0 90px -22px rgba(212,104,42,.42);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.hero__cover:hover {
  transform: translateY(-8px) rotate(-.5deg);
  box-shadow:
    0 2px 4px rgba(0,0,0,.5),
    0 44px 90px -18px rgba(0,0,0,.95),
    0 0 0 1px rgba(232,205,125,.4),
    0 0 130px -20px rgba(212,104,42,.6);
}

/* Scroll cue. */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: .6rem;
  font-family: var(--ui);
  font-size: .6rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--faint);
}
.scroll-cue i {
  display: block;
  width: 1px;
  height: 46px;
  background: linear-gradient(var(--gold), transparent);
  animation: cue 2.6s var(--ease) infinite;
  transform-origin: top;
}
@keyframes cue {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(46px); opacity: 0; }
}
@media (max-width: 880px) { .scroll-cue { display: none; } }

/* ---------- 9. Page header (interior pages) ------------------------------ */
.pagehead {
  position: relative;
  padding: clamp(4.5rem, 11vw, 8.5rem) 0 clamp(3rem, 6vw, 5rem);
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--rule-soft);
}
.pagehead__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center 35%;
  opacity: .5;
}
.pagehead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 80% at 30% 40%, rgba(11,9,7,.5), rgba(11,9,7,.93) 70%),
    linear-gradient(180deg, rgba(11,9,7,.9), rgba(11,9,7,.65) 45%, var(--ink) 100%);
}

/* ---------- 10. Rune divider --------------------------------------------- */
.rule-runes {
  /* Source strip is 3114x412 (~7.56:1) — the box keeps that ratio so the
     glyphs render at full size instead of shrinking inside a short box. */
  --runes-w: 340px;
  width: var(--runes-w);
  max-width: 100%;
  aspect-ratio: 7.56 / 1;
  margin: 1.8rem 0;
  background: url("../img/runes-divider.png") center/contain no-repeat;
  opacity: .62;
  /* The source PNG is black-backed; screen drops the black so the runes
     float on whatever band they sit in. */
  mix-blend-mode: screen;
  filter: sepia(.5) saturate(1.3) brightness(1.25) contrast(1.1);
  /* Fade the strip's hard edges into the page. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}
.rule-runes--center { margin-inline: auto; }
.rule-runes--wide { --runes-w: 560px; opacity: .7; }

/* Simple gold hairline + diamond. */
.rule-gold {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 2.4rem 0;
  color: var(--gold);
}
.rule-gold::before, .rule-gold::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule) 50%, transparent);
}
.rule-gold i {
  width: 6px; height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
  flex: none;
}

/* ---------- 11. Section heading ------------------------------------------ */
.sec-head {
  max-width: 60ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.sec-head--center { margin-inline: auto; text-align: center; }

/* ---------- 12. Gateway cards (landing → world) -------------------------- */
.gateways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 1.35rem;
}

.gateway {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.7rem, 3vw, 2.4rem);
  min-height: 300px;
  background: linear-gradient(165deg, var(--stone-2) 0%, var(--stone) 55%, var(--ink-2) 100%);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
  transition: transform .45s var(--ease), border-color .45s var(--ease), box-shadow .45s var(--ease);
}
/* Ember bloom that rises on hover. */
.gateway::before {
  content: "";
  position: absolute;
  inset: auto -30% -70% -30%;
  height: 140%;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 100%, rgba(212,104,42,.24), transparent 66%);
  opacity: 0;
  transform: translateY(28%);
  transition: opacity .5s var(--ease), transform .55s var(--ease);
}
.gateway:hover {
  transform: translateY(-6px);
  border-color: var(--rule);
  box-shadow: 0 28px 55px -26px rgba(0,0,0,.9);
}
.gateway:hover::before { opacity: 1; transform: translateY(0); }

.gateway__num {
  font-family: var(--display);
  font-size: .68rem;
  letter-spacing: .3em;
  color: var(--gold-deep);
  margin-bottom: auto;
}
.gateway h3 { margin: 1.5rem 0 .55rem; }
.gateway p { font-size: .96rem; color: var(--muted); margin-bottom: 1.4rem; }
.gateway .arrow-link { margin-top: auto; }
/* Whole card clickable, link text stays the accessible name. */
.gateway__link::after { content: ""; position: absolute; inset: 0; }

/* ---------- 13. Realm cards (heraldry) ----------------------------------- */
.realms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: clamp(1rem, 2.2vw, 1.75rem);
}

.realm {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.9rem 1.1rem 1.5rem;
  background: linear-gradient(180deg, rgba(46,37,28,.5) 0%, rgba(16,13,10,.85) 100%);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: transform .4s var(--ease), border-color .4s var(--ease), background .4s var(--ease);
}
.realm:hover, .realm.is-active {
  transform: translateY(-5px);
  border-color: var(--rule);
  background: linear-gradient(180deg, rgba(58,46,34,.6) 0%, rgba(20,16,12,.9) 100%);
}
.realm.is-active {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 1px rgba(201,162,39,.2), 0 22px 50px -28px rgba(212,104,42,.75);
}

.realm__banner {
  height: clamp(140px, 20vw, 190px);
  width: auto;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.7));
  transition: transform .5s var(--ease), filter .5s var(--ease);
}
.realm:hover .realm__banner,
.realm.is-active .realm__banner {
  transform: translateY(-4px) scale(1.045);
  filter: drop-shadow(0 20px 30px rgba(0,0,0,.8)) brightness(1.1);
}

.realm__name {
  font-family: var(--display);
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--parchment);
}
.realm__tag {
  font-size: .8rem;
  line-height: 1.45;
  color: var(--faint);
  letter-spacing: .04em;
}

/* Expanding lore panel below the grid. */
.realm-panel {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 1.5rem;
  transition: grid-template-rows .5s var(--ease);
}
.realm-panel.is-open { grid-template-rows: 1fr; }
.realm-panel__inner { overflow: hidden; }
.realm-panel__body {
  position: relative;
  display: grid;
  /* Banner + a measure-capped text column, centred as a pair so the panel
     doesn't leave a lopsided gap on the right at wide viewports. */
  grid-template-columns: auto minmax(0, 68ch);
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding: clamp(1.8rem, 4vw, 3rem);
  margin-top: .5rem;
  background: linear-gradient(150deg, var(--stone-2), var(--ink-2));
  border: 1px solid var(--rule);
  border-radius: var(--r);
}
@media (max-width: 720px) {
  .realm-panel__body { grid-template-columns: 1fr; justify-content: stretch; }
  .realm-panel__body img { justify-self: center; }
}
.realm-panel__body img { height: 230px; width: auto; filter: drop-shadow(0 18px 28px rgba(0,0,0,.75)); }
.realm-panel__close {
  position: absolute;
  top: .9rem; right: 1rem;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: none;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  color: var(--muted);
  cursor: pointer;
  transition: color .25s, border-color .25s;
}
.realm-panel__close:hover { color: var(--gold-lit); border-color: var(--rule); }

/* Source-of-truth lore list. Hidden when JS drives the panel; a <noscript>
   rule on the page turns it back on so the prose is never unreachable. */
.realm-lore { display: none; }
.realm-lore h3 { color: var(--gold-lit); margin-top: 2rem; }

/* ---------- 14. Compendium / glossary entries ---------------------------- */
.filter {
  position: relative;
  max-width: 460px;
  margin-bottom: 2.5rem;
}
.filter input {
  width: 100%;
  padding: .9rem 1rem .9rem 2.9rem;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  color: var(--parchment);
  font-family: var(--body);
  font-size: 1rem;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.filter input::placeholder { color: var(--faint); font-style: italic; }
.filter input:focus {
  outline: none;
  border-color: var(--gold-deep);
  background: rgba(0,0,0,.55);
}
.filter svg {
  position: absolute;
  left: 1rem; top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.filter__count {
  margin-top: .6rem;
  font-size: .82rem;
  color: var(--faint);
  letter-spacing: .04em;
}

.entries { display: grid; gap: .7rem; }

.entry {
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  background: rgba(25,20,16,.6);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.entry:hover { border-color: var(--rule); background: rgba(34,27,21,.7); }
.entry[open] { border-color: var(--rule); background: rgba(34,27,21,.75); }

.entry summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 1.3rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--parchment);
}
.entry summary::-webkit-details-marker { display: none; }
.entry summary::after {
  content: "";
  margin-left: auto;
  flex: none;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .35s var(--ease);
}
.entry[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.entry summary .kind {
  font-family: var(--body);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: .18rem .6rem;
  flex: none;
}
.entry__body {
  padding: 0 1.3rem 1.35rem;
  color: var(--muted);
  font-size: .99rem;
  max-width: 78ch;
}
.entry[open] .entry__body { animation: reveal .4s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } }

.no-results {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--faint);
  font-style: italic;
}

/* ---------- 15. Excerpt / manuscript block ------------------------------- */
.manuscript {
  position: relative;
  padding: clamp(2rem, 5vw, 3.6rem) clamp(1.5rem, 5vw, 4rem);
  background:
    linear-gradient(150deg, rgba(46,37,28,.42), rgba(11,9,7,.72));
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  max-width: 74ch;
}
/* Gold corner ticks. */
.manuscript::before, .manuscript::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid var(--gold-deep);
}
.manuscript::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.manuscript::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.manuscript p { color: var(--text); }
.manuscript .attrib {
  margin-top: 1.8rem;
  font-family: var(--ui);
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

/* Collapsible long excerpt. */
.excerpt-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s var(--ease); }
.excerpt-more.is-open { grid-template-rows: 1fr; }
.excerpt-more > div { overflow: hidden; }

/* Pull quote. */
.pullquote {
  font-family: var(--display);
  font-size: clamp(1.25rem, 1rem + 1.4vw, 2rem);
  line-height: 1.44;
  color: var(--parchment);
  text-align: center;
  max-width: 22ch;
  margin: 0 auto;
  text-wrap: balance;
}
.pullquote em { color: var(--gold-lit); font-style: italic; }

/* ---------- 16. Works / status list -------------------------------------- */
.works { display: grid; gap: .55rem; }

.work {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.2rem;
  padding: 1.15rem 1.4rem;
  border: 1px solid var(--rule-soft);
  border-left: 2px solid var(--stone-3);
  border-radius: var(--r);
  background: rgba(25,20,16,.5);
  transition: border-left-color .35s var(--ease), transform .35s var(--ease), background .35s var(--ease);
}
.work:hover { transform: translateX(4px); background: rgba(34,27,21,.65); }
.work--out { border-left-color: var(--gold); }
.work--soon { border-left-color: var(--ember); }

.work__title {
  font-family: var(--display);
  font-size: 1.03rem;
  font-weight: 600;
  color: var(--parchment);
  letter-spacing: .03em;
}
.work__sub { font-size: .86rem; color: var(--faint); margin-top: .18rem; }

.pill {
  flex: none;
  font-family: var(--ui);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: .35rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--rule-soft);
  color: var(--muted);
  white-space: nowrap;
}
.pill--out { border-color: var(--gold-deep); color: var(--gold-lit); background: rgba(201,162,39,.09); }
.pill--soon { border-color: rgba(212,104,42,.45); color: var(--ember-lit); background: rgba(212,104,42,.08); }

@media (max-width: 560px) {
  .work { grid-template-columns: 1fr; }
  .pill { justify-self: start; }
}

/* ---------- 17. Split feature (image + text) ----------------------------- */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.split--portrait { grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); }
@media (max-width: 820px) { .split--portrait { grid-template-columns: 1fr; } }

.framed {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 26px 60px -24px rgba(0,0,0,.9), 0 0 0 1px var(--rule-soft);
}
.framed img { width: 100%; transition: transform .8s var(--ease); }
.framed:hover img { transform: scale(1.035); }
.framed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(190deg, transparent 45%, rgba(11,9,7,.55));
  pointer-events: none;
}

/* ---------- 18. Buy links ------------------------------------------------ */
.buy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: .8rem;
  margin-top: 2rem;
}
.buy a {
  display: grid;
  gap: .2rem;
  padding: 1rem 1.3rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  background: rgba(0,0,0,.28);
  transition: border-color .3s var(--ease), transform .3s var(--ease), background .3s var(--ease);
}
.buy a:hover { border-color: var(--gold-deep); transform: translateY(-3px); background: rgba(201,162,39,.07); }
.buy strong {
  font-family: var(--display);
  font-size: .95rem;
  letter-spacing: .06em;
  color: var(--parchment);
}
.buy span { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

/* ---------- 19. Tale cards ----------------------------------------------- */
.tales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 1.35rem;
}
.tale {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.6rem, 3vw, 2.2rem);
  background: linear-gradient(168deg, var(--stone-2), var(--ink-2));
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  transition: transform .4s var(--ease), border-color .4s var(--ease);
}
.tale:hover { transform: translateY(-5px); border-color: var(--rule); }
.tale__sigil {
  width: 46px; height: 46px;
  object-fit: contain;
  opacity: .8;
  margin-bottom: 1.2rem;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.6));
}
.tale h3 { font-size: 1.12rem; margin-bottom: .35rem; }
.tale .work__sub { margin-bottom: 1rem; }
.tale p { font-size: .93rem; color: var(--muted); }
.tale .pill { align-self: flex-start; margin-top: auto; }

/* Title marks (Full Draw etc.) are dark wood-and-ember art — they vanish on
   the near-black ground, so give them a warm bloom to sit against. */
.tale-mark {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  isolation: isolate;
}
.tale-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 70% 80% at 50% 50%, rgba(212,104,42,.20), rgba(201,162,39,.06) 55%, transparent 75%);
}
.tale-mark img {
  filter: brightness(1.45) saturate(1.25) drop-shadow(0 6px 18px rgba(0,0,0,.8));
}

/* ---------- 20. Author portrait ------------------------------------------ */
.portrait {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 30px 70px -26px rgba(0,0,0,.95), 0 0 0 1px var(--rule-soft);
}
.portrait img { width: 100%; filter: saturate(.9) contrast(1.04); }
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(212,104,42,.1), transparent 40%, rgba(11,9,7,.5));
  pointer-events: none;
}

.influences {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.6rem;
  padding: 0;
  list-style: none;
}
.influences li {
  font-size: .82rem;
  font-style: italic;
  color: var(--muted);
  padding: .35rem .9rem;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
}

/* ---------- 21. Contact strip -------------------------------------------- */
.contact-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: .8rem;
  margin-top: 1.8rem;
  padding: 0;
  list-style: none;
}
.contact-links a {
  display: block;
  padding: .9rem 1.2rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  font-size: .92rem;
  color: var(--text);
  transition: border-color .3s var(--ease), color .3s var(--ease), transform .3s var(--ease);
}
.contact-links a:hover { border-color: var(--gold-deep); color: var(--gold-lit); transform: translateY(-2px); }
.contact-links span { display: block; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); margin-bottom: .15rem; }

/* ---------- 22. Footer --------------------------------------------------- */
.footer {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 2.5rem;
  background: var(--ink);
  border-top: 1px solid var(--rule-soft);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
  margin-bottom: 3rem;
}
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr; gap: 2rem; } }

.footer h4 { color: var(--gold); margin-bottom: 1.1rem; font-size: .7rem; letter-spacing: .22em; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.footer a { color: var(--muted); font-size: .95rem; transition: color .25s; }
.footer a:hover { color: var(--gold-lit); }

.footer__sigil {
  height: 54px;
  width: auto;
  margin-bottom: 1rem;
  opacity: .9;
}

.footer__mark {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--parchment);
  margin-bottom: .5rem;
}
.footer__blurb { font-size: .92rem; color: var(--faint); max-width: 34ch; }

.footer__base {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.8rem;
  border-top: 1px solid var(--rule-soft);
  font-size: .76rem;
  letter-spacing: .09em;
  color: var(--faint);
}

.socials { display: flex; gap: .55rem; }
.socials a {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
  color: var(--muted);
  transition: color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.socials a:hover { color: var(--gold-lit); border-color: var(--gold-deep); transform: translateY(-2px); }

/* ---------- 23. Scroll reveal -------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }
/* Stagger children of a revealed group. */
[data-reveal-group] > * { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal-group].is-in > * { opacity: 1; transform: none; }
[data-reveal-group].is-in > *:nth-child(1) { transition-delay: .00s; }
[data-reveal-group].is-in > *:nth-child(2) { transition-delay: .07s; }
[data-reveal-group].is-in > *:nth-child(3) { transition-delay: .14s; }
[data-reveal-group].is-in > *:nth-child(4) { transition-delay: .21s; }
[data-reveal-group].is-in > *:nth-child(5) { transition-delay: .28s; }
[data-reveal-group].is-in > *:nth-child(6) { transition-delay: .35s; }
[data-reveal-group].is-in > *:nth-child(7) { transition-delay: .42s; }
[data-reveal-group].is-in > *:nth-child(8) { transition-delay: .49s; }

/* ---------- 24. Reduced motion ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  [data-reveal], [data-reveal-group] > * { opacity: 1 !important; transform: none !important; }
  .scroll-cue i { display: none; }
}

/* ---------- 25. Print ---------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .nav, .footer, .scroll-cue, body::after { display: none; }
}
