/* ==========================================================================
   Tales Zone Publishing — The Illuminated Library
   Shared design system. One file for the whole site.
   Realm themes: set <body class="theme-ai|theme-fantasy|theme-whispers|theme-seed">
   ========================================================================== */

:root {
  /* The room */
  --ink:        #0f0d15;
  --ink-2:      #12101a;
  --ink-3:      #171425;
  --ink-panel:  rgba(18, 16, 26, 0.78);
  --border:     rgba(201, 164, 92, 0.28);
  --border-dim: rgba(201, 164, 92, 0.16);

  /* The light */
  --gold:       #c9a45c;
  --gold-soft:  rgba(201, 164, 92, 0.55);
  --parchment:  #ede4d3;
  --parch-dim:  #cfc4ac;
  --parch-mute: #b6ab93;

  /* Realm foil (default: library gold) */
  --accent:      var(--gold);
  --accent-soft: rgba(201, 164, 92, 0.35);
  --accent-glow: rgba(201, 164, 92, 0.14);

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Newsreader', Georgia, serif;
  --font-label:   'Space Grotesk', 'Segoe UI', sans-serif;
  --font-script:  'Allura', cursive;

  --header-h: 76px;
  --content-w: 1160px;
  --radius: 12px;
}

/* Realm themes — one variable swap lights the whole page */
.theme-ai       { --accent: #7fd4e8; --accent-soft: rgba(127,212,232,0.4);  --accent-glow: rgba(127,212,232,0.13); }
.theme-fantasy  { --accent: #b79ae0; --accent-soft: rgba(183,154,224,0.4);  --accent-glow: rgba(183,154,224,0.13); }
.theme-whispers { --accent: #d98aa6; --accent-soft: rgba(217,138,166,0.4);  --accent-glow: rgba(217,138,166,0.13); }
.theme-seed     { --accent: #9ec98f; --accent-soft: rgba(158,201,143,0.4);  --accent-glow: rgba(158,201,143,0.13); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding-top: var(--header-h);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, var(--accent-glow), transparent 70%),
    var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
}
img { max-width: 100%; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--ink); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }

.label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Header / Nav (injected by js/site.js) ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 0 clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--border);
}
/* Frosted bar painted on a pseudo-layer. Keeping backdrop-filter OFF the
   header itself is deliberate: on the header it would make it a containing
   block for the fixed mobile nav, collapsing the drawer to ~0 height. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(15, 13, 21, 0.92);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}
.brand-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--parchment);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.brand em { font-style: normal; color: var(--gold); }
.brand-divider {
  width: 1px; height: 30px;
  background: linear-gradient(to bottom, transparent, var(--gold-soft), transparent);
}
.brand-sub {
  display: flex; flex-direction: column; line-height: 1.15;
  text-decoration: none;
}
.brand-sub-main {
  font-family: var(--font-label);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
}
.brand-sub small {
  font-family: var(--font-body); font-style: italic;
  font-size: 0.78rem; color: var(--parch-mute);
}
.brand-sub:hover .brand-sub-main { color: var(--parchment); }

.site-nav { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 26px); flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  font-family: var(--font-label);
  font-size: 0.74rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: #c9bda6;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--gold); }
.site-nav > a.active,
.site-nav .dropdown-container.active > .dropdown-trigger {
  color: var(--gold);
  border-bottom-color: var(--gold-soft);
}

/* Dropdowns */
.dropdown-container { position: relative; }
.dropdown-submenu {
  position: absolute;
  top: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 190px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 1200;
}
.dropdown-submenu::before {           /* hover bridge so submenu doesn't vanish */
  content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px;
}
.dropdown-submenu a {
  display: block; padding: 9px 18px;
  letter-spacing: 0.1em;
}
.dropdown-submenu a:hover { background: rgba(201, 164, 92, 0.08); color: var(--gold); }
@media (hover: hover) {
  .dropdown-container:hover .dropdown-submenu,
  .dropdown-container:focus-within .dropdown-submenu {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
  }
}
.dropdown-container.open .dropdown-submenu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gold);
  font-family: var(--font-label);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
}
@media (max-width: 1120px) {
  .brand-sub, .brand-divider { display: none; }
  .nav-toggle { display: inline-block; }
  .site-nav {
    position: fixed;
    top: var(--header-h); right: 0; bottom: 0;
    width: min(320px, 86vw);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 18px 0 40px;
    background: var(--ink-2);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
  .site-nav.open { transform: translateX(0); }
  .site-nav > a,
  .site-nav .dropdown-trigger { display: block; padding: 14px 26px; font-size: 0.82rem; }
  .dropdown-container { width: 100%; }
  .dropdown-submenu {
    position: static; transform: none;
    opacity: 1; visibility: hidden; display: none;
    border: none; border-left: 2px solid var(--border);
    border-radius: 0; box-shadow: none;
    margin: 0 0 6px 26px; padding: 0;
    background: transparent;
  }
  .dropdown-container.open .dropdown-submenu { display: block; visibility: visible; transform: none; }
}

/* ---------- Page hero ---------- */
.page-hero {
  text-align: center;
  padding: clamp(34px, 5vw, 54px) 22px clamp(26px, 4vw, 42px);
  position: relative;
}
.page-hero .label { display: block; margin-bottom: 14px; }
.page-hero h1 {
  margin: 0 auto;
  max-width: 820px;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  color: #f2ead9;
}
.page-hero h1 .init { color: var(--accent); font-size: 1.15em; }
.page-hero .sub {
  font-style: italic;
  font-size: clamp(1.02rem, 2vw, 1.2rem);
  color: var(--parch-dim);
  max-width: 620px;
  margin: 20px auto 0;
}
.page-hero::after {
  content: "";
  display: block;
  width: 130px; height: 1px;
  margin: 22px auto 0;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
.hero-portrait {
  width: 210px; height: 210px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--accent-soft);
  box-shadow: 0 0 0 8px rgba(255,255,255,0.02), 0 18px 50px rgba(0,0,0,0.55), 0 0 34px var(--accent-glow);
  margin-bottom: 26px;
}

/* Gold rule between sections */
.rule {
  border: 0; height: 1px; width: min(72%, 640px);
  margin: clamp(22px, 3.5vw, 36px) auto;
  background: linear-gradient(to right, transparent, var(--accent-soft), transparent);
}

/* ---------- Layout containers ---------- */
.wrap { width: min(var(--content-w), calc(100% - 40px)); margin: 0 auto; }
.section { margin: clamp(26px, 4vw, 44px) auto; }
.section-head { text-align: center; margin-bottom: 22px; }
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  color: #f2ead9;
  margin: 0 0 8px;
}
.section-head .label { display: block; margin-bottom: 12px; }

/* ---------- Panels (bio, prose sections) ---------- */
.panel {
  background: var(--ink-panel);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  max-width: 820px;
  margin: 0 auto 28px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.panel h2 {
  margin-top: 0;
  font-size: 1.5rem;
  color: var(--accent);
}
.panel p, .panel li { color: var(--parch-dim); }
.panel strong { color: var(--parchment); }
.panel a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.panel a:hover { color: var(--parchment); border-bottom-color: var(--parchment); }
.panel ul { padding-left: 22px; }
.panel li { margin-bottom: 8px; }

blockquote.mission-quote {
  font-style: italic;
  font-size: 1.2rem;
  color: #f0e8d8;
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 8px 8px 0;
}

.signature {
  text-align: right;
  font-family: var(--font-script);
  font-size: 1.9rem;
  color: var(--accent);
  margin-top: 22px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink);
  background: var(--accent);
  padding: 12px 30px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover { background: transparent; color: var(--accent); box-shadow: 0 0 22px var(--accent-glow); }
.btn-outline {
  background: transparent;
  color: var(--accent);
}
.btn-outline:hover { background: var(--accent); color: var(--ink); }

/* ---------- Book cards ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  justify-content: center;
}
.book-card {
  background: var(--ink-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-soft);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 20px var(--accent-glow);
}
.book-card > a {
  display: flex; gap: 18px; align-items: flex-start;
  text-decoration: none; color: inherit; width: 100%;
}
.book-card img {
  width: 96px; height: auto; flex-shrink: 0;
  border-radius: 4px;
  box-shadow: 4px 6px 18px rgba(0, 0, 0, 0.5);
}
.book-card h3 {
  margin: 0 0 4px;
  font-size: 1.16rem;
  color: #f2ead9;
}
.book-card .byline {
  font-family: var(--font-label);
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--parch-mute);
  display: block; margin-bottom: 8px;
}
.book-card p { margin: 0 0 10px; font-size: 0.95rem; color: var(--parch-dim); line-height: 1.55; }
.book-card .series-tag {
  display: block;
  font-family: var(--font-label);
  font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.book-card .buy {
  font-family: var(--font-label);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
}
.book-card .buy:hover { color: var(--parchment); border-bottom-color: var(--parchment); }
.book-card.coming-soon::after {
  content: "Coming Soon";
  position: absolute;
  top: 12px; right: 12px;
  font-family: var(--font-label);
  font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink);
  background: var(--accent);
  padding: 4px 9px;
  border-radius: 3px;
}
.book-card.coming-soon img { opacity: 0.75; }

/* Genre foil on the library page */
.book-card[data-genre] { border-left: 3px solid transparent; }
.book-card[data-genre="physics"]    { border-left-color: #d8c08a; }
.book-card[data-genre="ai"]         { border-left-color: #7fd4e8; }
.book-card[data-genre="erotica"]    { border-left-color: #d98aa6; }
.book-card[data-genre="fantasy"]    { border-left-color: #b79ae0; }
.book-card[data-genre="scifi"]      { border-left-color: #8fb7e8; }
.book-card[data-genre="philosophy"] { border-left-color: #9ec98f; }

/* Library section headings */
.library-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: #f2ead9;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin: clamp(44px, 7vw, 64px) 0 24px;
}
.library-section h2 .sigil { color: var(--accent); margin-right: 12px; }

/* ---------- Realm shelf (home) ---------- */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--border-dim);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  overflow: hidden;
}
.realm {
  display: block;
  background: var(--ink-2);
  padding: 32px 26px 36px;
  text-decoration: none;
  transition: background 0.3s ease;
}
.realm:hover { background: var(--ink-3); }
.realm .sigil {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--realm-c, var(--gold));
}
.realm h3 {
  font-size: 1.24rem;
  margin: 14px 0 8px;
  color: var(--parchment);
}
.realm p { font-size: 0.94rem; color: var(--parch-mute); margin: 0 0 8px; line-height: 1.55; }
.realm p.whisper { font-style: italic; color: var(--parch-dim); }
.realm .enter {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-label);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--realm-c, var(--gold));
}
.realm:hover .enter { text-decoration: underline; text-underline-offset: 4px; }
.realm.r-ai   { --realm-c: #7fd4e8; }
.realm.r-fan  { --realm-c: #b79ae0; }
.realm.r-whi  { --realm-c: #d98aa6; }
.realm.r-seed { --realm-c: #9ec98f; }
.realm.r-auth { --realm-c: #c9a45c; }

/* ---------- Portal cards (home) ---------- */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.portal-card {
  display: block;
  background: var(--ink-panel);
  border: 1px solid var(--border-dim);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 26px 24px 30px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.portal-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-soft);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), 0 0 18px var(--accent-glow);
}
.portal-card h3 { margin: 0 0 10px; font-size: 1.3rem; color: #f2ead9; }
.portal-card p { margin: 0 0 16px; font-size: 0.94rem; color: var(--parch-mute); }
.portal-card .enter {
  font-family: var(--font-label);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Author cards ---------- */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.author-card {
  --realm-c: var(--gold);
  background: var(--ink-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 32px 24px 30px;
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.author-card:hover {
  transform: translateY(-4px);
  border-color: var(--realm-c);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
}
.author-card img {
  width: 150px; height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--realm-c);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.02), 0 10px 26px rgba(0, 0, 0, 0.5);
  margin-bottom: 18px;
}
.author-card h3 { margin: 0 0 6px; font-size: 1.4rem; color: #f2ead9; }
.author-card .motto { font-size: 0.95rem; color: var(--parch-dim); margin: 0 0 6px; }
.author-card .quote { font-style: italic; font-size: 0.9rem; color: var(--parch-mute); margin: 0 0 16px; }
.author-card a {
  font-family: var(--font-label);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--realm-c);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.author-card a:hover { border-bottom-color: var(--realm-c); }
.author-card.a-whispers { --realm-c: #d98aa6; }
.author-card.a-fantasy  { --realm-c: #b79ae0; }
.author-card.a-ai       { --realm-c: #7fd4e8; }
.author-card.a-seed     { --realm-c: #9ec98f; }

/* ---------- News line (home) ---------- */
.news-bar {
  text-align: center;
  padding: 16px 22px;
  border-top: 1px solid var(--border-dim);
  border-bottom: 1px solid var(--border-dim);
  background: rgba(255, 255, 255, 0.02);
}
.news-bar .label { display: inline-block; margin-right: 14px; }
.news-bar #news-text { display: inline-block; transition: opacity 0.5s ease; font-style: italic; }
.news-bar a { color: var(--parch-dim); text-decoration: none; }
.news-bar a:hover { color: var(--accent); }

/* ---------- Floating whisper/insight button + panel ---------- */
.fab {
  position: fixed;
  bottom: 26px; right: 26px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  height: 56px;
  min-width: 56px;
  padding: 0;
  color: var(--ink);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px var(--accent-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.fab .fab-ico {
  flex: 0 0 56px;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1.55rem; line-height: 1;
}
.fab .fab-label {
  font-family: var(--font-label);
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
  max-width: 0; opacity: 0; padding-right: 0;
  transition: max-width 0.35s ease, opacity 0.28s ease, padding-right 0.35s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55), 0 0 34px var(--accent-soft); }
@media (hover: hover) {
  .fab:hover .fab-label { max-width: 240px; opacity: 1; padding-right: 24px; }
}
.fab-panel {
  display: none;
  position: fixed;
  bottom: 90px; right: 26px;
  z-index: 900;
  width: 280px; max-width: 88vw;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6);
}
.fab-panel.open { display: block; }
.fab-panel h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--accent);
}
.fab-panel .cat {
  font-family: var(--font-label);
  font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--parch-mute);
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 5px;
  margin: 14px 0 8px;
}
.fab-panel .fab-link {
  display: block;
  margin: 7px 0;
  color: var(--parch-dim);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.96rem;
}
.fab-panel .fab-link:hover { color: var(--accent); }

/* ---------- Modals ---------- */
.tz-modal-backdrop {
  position: fixed; inset: 0;
  z-index: 2000;
  background: rgba(8, 6, 12, 0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.tz-modal {
  width: min(860px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 34px 36px 30px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.tz-modal h2 { margin: 0 0 16px; color: var(--accent); font-size: 1.6rem; }
.tz-modal pre {
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--parch-dim);
}
.tz-modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: none; border: none;
  font-size: 1.3rem;
  color: var(--accent);
  cursor: pointer;
  padding: 0 0 0 14px;
}
.tz-modal .btn { margin-top: 18px; }
.tz-modal.center { text-align: center; }

/* ---------- Footer (injected) ---------- */
.site-footer {
  margin-top: clamp(50px, 8vw, 90px);
  border-top: 1px solid var(--border);
  background: var(--ink-2);
  text-align: center;
  padding: 40px 22px 46px;
}
.site-footer .colophon {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 14px;
}
.site-footer p { margin: 6px 0; font-size: 0.95rem; color: var(--parch-mute); }
.site-footer a { color: var(--parch-dim); text-decoration: none; border-bottom: 1px solid var(--border); }
.site-footer a:hover { color: var(--gold); border-bottom-color: var(--gold); }
.site-footer .foot-links { margin-top: 14px; }
.site-footer .foot-links a { margin: 0 8px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; transition-duration: 0.01ms !important; }
}

/* ---------- Utility ---------- */
.center { text-align: center; }
.prose { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.big-quote {
  text-align: center;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--parch-dim);
  max-width: 720px;
  margin: 0 auto;
}

/* AI experiment terminal */
.terminal {
  max-width: 640px;
  margin: 0 auto;
  background: #0b0a10;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.terminal input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.terminal input:focus { outline: none; border-color: var(--accent); }
.terminal .loading { display: none; color: var(--accent); font-style: italic; margin-bottom: 12px; }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ==========================================================================
   THE BOUND CODEX — framed, tiled layout (v2 density pass)
   The whole page lives inside one bordered folio; sections touch,
   separated by hairline gold. Every element confined to its cell.
   ========================================================================== */
.codex {
  width: min(1220px, calc(100% - 28px));
  margin: 14px auto 0;
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.codex > * + * { border-top: 1px solid var(--border-dim); }

/* Section title bars — thin illuminated strips between tiles */
.codex-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(20px, 3.5vw, 44px);
  background: rgba(201, 164, 92, 0.05);
}
.codex-bar .cb-label {
  font-family: var(--font-label);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--gold);
}
.codex-bar h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #f2ead9;
}
.codex-bar .cb-note {
  margin-left: auto;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--parch-mute);
}

/* Hero spread: text folio left, bulletin right */
.codex-hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
}
.codex-hero .hero-text {
  padding: clamp(28px, 4vw, 48px) clamp(20px, 3.5vw, 48px);
}
.codex-hero .hero-text .label { display: block; margin-bottom: 14px; }
.codex-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.08;
  color: #f2ead9;
  max-width: 560px;
}
.codex-hero h1 .init { color: var(--gold); font-size: 1.15em; }
.codex-hero .hero-text .sub {
  font-style: italic;
  color: var(--parch-dim);
  max-width: 520px;
  margin: 0 0 12px;
}
.codex-hero .hero-text .creed {
  font-size: 0.98rem;
  color: var(--parch-mute);
  max-width: 520px;
  margin: 0 0 22px;
}
.codex-hero .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* The Bulletin — news visible without scrolling */
.bulletin {
  border-left: 1px solid var(--border-dim);
  padding: clamp(24px, 3vw, 34px) clamp(20px, 3vw, 34px);
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, var(--accent-glow), transparent 65%),
    var(--ink-2);
  display: flex;
  flex-direction: column;
}
.bulletin .cb-label { margin-bottom: 12px; }
.bulletin .news-item {
  display: block;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.94rem;
  color: var(--parch-mute);
  text-decoration: none;
  transition: color 0.4s ease, padding-left 0.4s ease;
}
.bulletin .news-item:last-of-type { border-bottom: none; }
.bulletin .news-item::before {
  content: "❧";
  color: transparent;
  margin-right: 8px;
  transition: color 0.4s ease;
}
.bulletin .news-item.active { color: var(--parchment); padding-left: 6px; }
.bulletin .news-item.active::before { color: var(--gold); }
.bulletin .news-item:hover { color: var(--gold); }

/* Tile grids — cells touching, hairline dividers (the "shelf feel") */
.tile-grid {
  display: grid;
  gap: 1px;
  background: var(--border-dim);
}
.tg-2 { grid-template-columns: repeat(2, 1fr); }
.tg-3 { grid-template-columns: repeat(3, 1fr); }
.tg-4 { grid-template-columns: repeat(4, 1fr); }
.tile {
  background: var(--ink-2);
  padding: clamp(20px, 2.6vw, 30px) clamp(18px, 2.4vw, 28px);
  text-decoration: none;
  color: inherit;
  transition: background 0.3s ease;
  position: relative;
}
a.tile:hover, .tile.hoverable:hover { background: var(--ink-3); }

/* Shelf inside the codex loses its own chrome */
.codex .shelf { border: none; border-radius: 0; }
.codex .realm { padding: clamp(22px, 2.8vw, 30px) clamp(18px, 2.4vw, 26px); }
.codex .realm .sigil { font-size: 2.2rem; }

/* Portal tiles */
.portal-tile h3 { margin: 0 0 8px; font-size: 1.25rem; color: #f2ead9; }
.portal-tile .glyph { font-size: 1.5rem; color: var(--gold); margin-bottom: 10px; display: block; }
.portal-tile p { margin: 0 0 12px; font-size: 0.92rem; color: var(--parch-mute); line-height: 1.55; }
.portal-tile .enter {
  font-family: var(--font-label);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold);
}
a.tile:hover .enter { text-decoration: underline; text-underline-offset: 4px; }

/* Book cells — same tiling for covers */
.book-cell { display: flex; gap: 16px; align-items: flex-start; }
.book-cell img {
  width: 84px; height: auto; flex-shrink: 0;
  border-radius: 3px;
  box-shadow: 4px 6px 16px rgba(0, 0, 0, 0.5);
}
.book-cell h3 { margin: 0 0 3px; font-size: 1.08rem; color: #f2ead9; }
.book-cell .byline {
  font-family: var(--font-label);
  font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--parch-mute);
  display: block; margin-bottom: 6px;
}
.book-cell p { margin: 0 0 8px; font-size: 0.9rem; color: var(--parch-dim); line-height: 1.5; }
.book-cell .buy {
  font-family: var(--font-label);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
}

/* Author tiles */
.author-tile { text-align: center; --realm-c: var(--gold); }
.author-tile img {
  width: 108px; height: 108px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--realm-c);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.02), 0 8px 22px rgba(0, 0, 0, 0.5);
  margin-bottom: 14px;
}
.author-tile h3 { margin: 0 0 4px; font-size: 1.2rem; color: #f2ead9; }
.author-tile .motto { font-size: 0.88rem; color: var(--parch-mute); margin: 0 0 12px; line-height: 1.5; }
.author-tile .enter {
  font-family: var(--font-label);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--realm-c);
}
.author-tile.a-whispers { --realm-c: #d98aa6; }
.author-tile.a-fantasy  { --realm-c: #b79ae0; }
.author-tile.a-ai       { --realm-c: #7fd4e8; }
.author-tile.a-seed     { --realm-c: #9ec98f; }

/* Codex closing colophon strip */
.codex-colophon {
  text-align: center;
  padding: 22px 30px;
  font-style: italic;
  color: var(--parch-mute);
  background: rgba(201, 164, 92, 0.04);
}

/* Responsive tiling */
@media (max-width: 1020px) {
  .tg-4 { grid-template-columns: repeat(2, 1fr); }
  .tg-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .codex-hero { grid-template-columns: 1fr; }
  .bulletin { border-left: none; border-top: 1px solid var(--border-dim); }
}
@media (max-width: 580px) {
  .tg-4, .tg-3, .tg-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   V3 — COMPRESSION & RELEASE
   The codex frame stays, but the page breathes: open "bands" alternate
   with dense tile grids. Adapters below let every existing page bind
   into the codex without markup surgery.
   ========================================================================== */

/* Open band — the "release" between dense tiling */
.band { padding: clamp(34px, 5vw, 58px) clamp(20px, 4vw, 48px); text-align: center; }
.band .inner { max-width: 780px; margin: 0 auto; }
.band.tint { background: rgba(201, 164, 92, 0.04); }
.band h2 { color: #f2ead9; font-size: clamp(1.5rem, 2.6vw, 1.9rem); margin: 0 0 12px; }
.band .big-quote { font-size: clamp(1.1rem, 2vw, 1.3rem); }

/* Hero spread gets more air (index) */
.codex-hero .hero-text { padding: clamp(40px, 5.5vw, 66px) clamp(22px, 4vw, 52px); }
.codex-hero h1 { font-size: clamp(2.1rem, 3.9vw, 3.25rem); margin-bottom: 16px; }
.codex-hero .hero-text .sub { margin-bottom: 24px; font-size: 1.08rem; }
.bulletin { padding: clamp(30px, 4vw, 44px) clamp(22px, 3.4vw, 38px); }
.bulletin .news-item { padding: 12px 2px; }

/* Slightly roomier tiles */
.tile { padding: clamp(24px, 3vw, 34px) clamp(20px, 2.8vw, 30px); }
.codex .realm { padding: clamp(26px, 3.2vw, 34px) clamp(20px, 2.8vw, 28px); }

/* ---------- Codex adapters: bind existing page structures ---------- */

/* page-hero as the codex's opening band */
.codex .page-hero { padding: clamp(40px, 6vw, 70px) 22px clamp(32px, 4.6vw, 52px); }

/* sections become full-width bands with hairline separation (from .codex > *+*) */
.codex .section { margin: 0; padding: clamp(28px, 4vw, 46px) clamp(20px, 3.5vw, 44px); }
.codex .section.wrap, .codex .wrap { width: 100%; }
.codex .section-head {
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.codex .section-head h2 { font-size: 1.3rem; margin: 0; }
.codex .section-head .label { margin-bottom: 0; font-size: 0.66rem; letter-spacing: 0.26em; }
.codex .rule { display: none; }

/* book cards tile themselves inside the codex */
.codex .book-grid { gap: 1px; background: var(--border-dim); border: 1px solid var(--border-dim); }
.codex .book-grid .book-card {
  border: none;
  border-radius: 0;
  background: var(--ink-2);
  box-shadow: none;
  padding: clamp(20px, 2.6vw, 28px);
}
.codex .book-grid .book-card:hover {
  transform: none;
  background: var(--ink-3);
  box-shadow: none;
  border-color: transparent;
}
.codex .book-grid .book-card[data-genre] { border-left: 3px solid transparent; }
.codex .book-grid .book-card[data-genre="physics"]    { border-left-color: #d8c08a; }
.codex .book-grid .book-card[data-genre="ai"]         { border-left-color: #7fd4e8; }
.codex .book-grid .book-card[data-genre="erotica"]    { border-left-color: #d98aa6; }
.codex .book-grid .book-card[data-genre="fantasy"]    { border-left-color: #b79ae0; }
.codex .book-grid .book-card[data-genre="scifi"]      { border-left-color: #8fb7e8; }
.codex .book-grid .book-card[data-genre="philosophy"] { border-left-color: #9ec98f; }

/* prose pages: panels become stacked bands inside the frame */
.codex .prose { max-width: none; padding: 0; }
.codex .prose > * + * { border-top: 1px solid var(--border-dim); }
.codex .prose .panel {
  border: none;
  border-radius: 0;
  max-width: none;
  margin: 0;
  padding: clamp(30px, 4.5vw, 54px) clamp(20px, 4vw, 48px);
  background: transparent;
  box-shadow: none;
}
.codex .prose .panel:nth-child(even) { background: rgba(201, 164, 92, 0.035); }
.codex .prose .panel > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.codex .prose .panel > *:first-child { margin-top: 0; }
.codex .prose .panel .signature { max-width: 760px; }
.codex .prose .center { padding: clamp(26px, 4vw, 44px) 20px; }

/* author grid + library adapt */
.codex .author-grid { max-width: none; gap: 1px; background: var(--border-dim); border: 1px solid var(--border-dim); }
.codex .author-grid .author-card { border: none; border-radius: 0; background: var(--ink-2); box-shadow: none; }
.codex .author-grid .author-card:hover { transform: none; background: var(--ink-3); }
.codex .library-section { padding: 0 clamp(20px, 3.5vw, 44px) clamp(28px, 4vw, 46px); }
.codex .library-section h2 { margin-top: clamp(30px, 4.6vw, 48px); }

/* terminal + big-quote breathing room inside frame */
.codex .terminal { margin: 0 auto; }
.codex > .big-quote, .codex .prose > .big-quote { padding: clamp(30px, 4.5vw, 50px) 20px; max-width: none; }
.codex > .big-quote { margin: 0; }

/* ==========================================================================
   V4 — THE NIGHT SKY & THE BALANCED HALL
   1) CSS starfield background (no image asset; realm-tinted nebula)
   2) Centered wordmark hero (concept-board layout)
   3) Boxed author panels, larger portraits, candlelight hovers
   4) Board-style card rows ("each its own")
   ========================================================================== */

/* ---------- The night sky ---------- */
body { background: var(--ink); }
body::before {            /* stars + realm-tinted nebula, truly fixed */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 55% 42% at 72% 6%,  var(--accent-glow), transparent 62%),
    radial-gradient(ellipse 45% 38% at 12% 88%, rgba(201, 164, 92, 0.08), transparent 62%),
    radial-gradient(ellipse 30% 26% at 88% 72%, var(--accent-glow), transparent 60%),
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='700' height='700'><g fill='%23ede4d3' opacity='0.55'><circle cx='23' cy='45' r='0.9'/><circle cx='131' cy='189' r='0.7'/><circle cx='311' cy='67' r='1'/><circle cx='439' cy='247' r='0.8'/><circle cx='567' cy='121' r='0.7'/><circle cx='659' cy='341' r='1'/><circle cx='83' cy='403' r='0.8'/><circle cx='239' cy='487' r='0.7'/><circle cx='391' cy='563' r='0.9'/><circle cx='523' cy='449' r='0.7'/><circle cx='611' cy='613' r='0.8'/><circle cx='157' cy='639' r='1'/><circle cx='47' cy='559' r='0.7'/><circle cx='347' cy='391' r='0.7'/><circle cx='481' cy='23' r='0.9'/><circle cx='673' cy='197' r='0.7'/><circle cx='197' cy='293' r='0.8'/><circle cx='279' cy='161' r='0.6'/><circle cx='619' cy='487' r='0.6'/><circle cx='103' cy='97' r='0.6'/></g><g fill='%23c9a45c' opacity='0.5'><circle cx='367' cy='299' r='1.1'/><circle cx='71' cy='251' r='0.9'/><circle cx='541' cy='557' r='1'/><circle cx='251' cy='31' r='0.8'/><circle cx='637' cy='53' r='0.9'/><circle cx='419' cy='659' r='0.8'/></g></svg>") repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='500' height='500'><g fill='%23ede4d3' opacity='0.28'><circle cx='37' cy='83' r='0.6'/><circle cx='127' cy='211' r='0.5'/><circle cx='229' cy='47' r='0.6'/><circle cx='331' cy='173' r='0.5'/><circle cx='433' cy='89' r='0.6'/><circle cx='83' cy='331' r='0.5'/><circle cx='191' cy='419' r='0.6'/><circle cx='307' cy='347' r='0.5'/><circle cx='421' cy='283' r='0.5'/><circle cx='461' cy='439' r='0.6'/><circle cx='271' cy='257' r='0.4'/><circle cx='139' cy='139' r='0.4'/><circle cx='367' cy='467' r='0.5'/><circle cx='29' cy='469' r='0.5'/><circle cx='487' cy='19' r='0.5'/></g></svg>") repeat,
    var(--ink);
}
body::after {             /* soft vignette: draws the eye to the codex */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 80% at 50% 38%, transparent 55%, rgba(8, 6, 12, 0.55));
}

/* ---------- Centered wordmark hero (index) ---------- */
.hero-center {
  text-align: center;
  padding: clamp(48px, 7vw, 88px) 22px clamp(34px, 5vw, 56px);
}
.hero-center .label { display: block; margin-bottom: 20px; }
.hero-center .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5.2rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: #f2ead9;
  margin: 0;
}
.hero-center .wordmark em { font-style: normal; color: var(--gold); }
.hero-center .whisper-line {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  color: var(--parch-dim);
  margin: 18px 0 0;
}
.hero-center .sub {
  font-style: italic;
  color: var(--parch-mute);
  max-width: 560px;
  margin: 16px auto 26px;
}
.hero-center .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-center::after {
  content: "";
  display: block;
  width: 140px; height: 1px;
  margin: 34px auto 0;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

/* Slim rotating news ticker under the hero */
.ticker {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  padding: 13px 20px;
  background: rgba(201, 164, 92, 0.05);
  text-align: center;
}
.ticker #news-text { font-style: italic; transition: opacity 0.45s ease; }
.ticker #news-text a { color: var(--parch-dim); text-decoration: none; }
.ticker #news-text a:hover { color: var(--gold); }

/* ---------- Card rows — "each its own" (concept-board meta cards) ---------- */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}
.card {
  display: block;
  background: #161320;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 26px 26px 28px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-soft);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), 0 0 18px var(--accent-glow);
}
.card .glyph { font-size: 1.5rem; display: block; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 1.28rem; color: #f2ead9; }
.card p { margin: 0 0 14px; font-size: 0.93rem; color: var(--parch-mute); line-height: 1.55; }
.card .enter {
  font-family: var(--font-label);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold);
}
.band .card-row { text-align: left; }

/* ---------- Boxed panels (author bios keep their dedicated box) ---------- */
.codex .prose.boxed-flow { padding: clamp(18px, 3vw, 28px) 20px; }
.codex .prose.boxed-flow > * + * { border-top: none; }
.codex .prose .panel.boxed,
.panel.boxed {
  background: var(--ink-panel);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  max-width: 820px;
  margin: clamp(14px, 2.4vw, 22px) auto;
  padding: clamp(24px, 4vw, 40px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), 0 0 22px var(--accent-glow);
}
.codex .prose .panel.boxed > * { max-width: none; }

/* Larger, brighter author portraits */
.hero-portrait {
  width: 280px; height: 280px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.02),
    0 0 0 7px var(--accent-soft),
    0 20px 55px rgba(0, 0, 0, 0.6),
    0 0 44px var(--accent-glow);
}

/* ---------- Candlelight hovers (subtle life) ---------- */
.tile h3, .codex .book-grid .book-card h3, .realm h3, .card h3 { transition: color 0.3s ease; }
a.tile:hover h3, .codex .book-grid .book-card:hover h3, .card:hover h3 { color: var(--accent); }
.realm:hover h3 { color: var(--realm-c); }
.book-cell img, .book-card img { transition: transform 0.35s ease, box-shadow 0.35s ease; }
a.tile:hover img, .codex .book-grid .book-card:hover img {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 6px 10px 22px rgba(0, 0, 0, 0.6);
}
.author-tile img, .author-card img { transition: transform 0.35s ease, box-shadow 0.35s ease; }
a.tile.author-tile:hover img { transform: scale(1.05); box-shadow: 0 0 0 5px rgba(255,255,255,0.02), 0 10px 26px rgba(0,0,0,0.55), 0 0 26px var(--accent-glow); }

/* ---------- FIX: buttons inside panels were unreadable (gold on gold) ---------- */
.panel a.btn { color: var(--ink); border-bottom: none; }
.panel a.btn:hover { color: var(--accent); border-bottom: none; }
.panel a.btn.btn-outline { color: var(--accent); }
.panel a.btn.btn-outline:hover { color: var(--ink); }

/* ==========================================================================
   V5 — FILLING THE NIGHT
   Two worlds of texture: a vivid star-sky OUTSIDE the codex, a candlelit
   parchment wall with realm watermarks INSIDE it. No flat black anywhere.
   Boxes now glow uniformly on all sides (no left spine).
   ========================================================================== */

/* ---------- 1) Unified glow boxes ---------- */
.panel,
.panel.boxed,
.codex .prose .panel.boxed {
  border: 1px solid var(--accent-soft);
  border-left: 1px solid var(--accent-soft);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 0 26px var(--accent-glow),
    0 14px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 32px var(--accent-glow);
}

/* ---------- 2) OUTSIDE: the living night sky ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    /* vignette on top of the sky, guiding the eye inward */
    radial-gradient(ellipse 95% 85% at 50% 38%, transparent 52%, rgba(8, 6, 12, 0.5)),
    /* nebula washes — no region stays flat black */
    radial-gradient(ellipse 80% 60% at 75% 0%,  rgba(56, 44, 90, 0.5),  transparent 62%),
    radial-gradient(ellipse 70% 55% at 0% 100%, rgba(30, 38, 66, 0.5),  transparent 62%),
    radial-gradient(ellipse 45% 35% at 85% 80%, var(--accent-glow),     transparent 60%),
    radial-gradient(ellipse 55% 40% at 12% 22%, rgba(201, 164, 92, 0.12), transparent 62%),
    /* bright stars with halos */
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='700' height='700'><g fill='%23ede4d3'><circle cx='23' cy='45' r='1.4' opacity='0.9'/><circle cx='131' cy='189' r='1' opacity='0.8'/><circle cx='311' cy='67' r='1.7' opacity='0.9'/><circle cx='311' cy='67' r='4' opacity='0.14'/><circle cx='439' cy='247' r='1.1' opacity='0.8'/><circle cx='567' cy='121' r='0.9' opacity='0.75'/><circle cx='659' cy='341' r='1.5' opacity='0.9'/><circle cx='659' cy='341' r='3.8' opacity='0.13'/><circle cx='83' cy='403' r='1.1' opacity='0.8'/><circle cx='239' cy='487' r='0.9' opacity='0.7'/><circle cx='391' cy='563' r='1.4' opacity='0.88'/><circle cx='523' cy='449' r='1' opacity='0.75'/><circle cx='611' cy='613' r='1.2' opacity='0.8'/><circle cx='157' cy='639' r='1.6' opacity='0.9'/><circle cx='157' cy='639' r='4' opacity='0.13'/><circle cx='47' cy='559' r='0.9' opacity='0.72'/><circle cx='347' cy='391' r='0.9' opacity='0.7'/><circle cx='481' cy='23' r='1.3' opacity='0.85'/><circle cx='673' cy='197' r='0.9' opacity='0.72'/><circle cx='197' cy='293' r='1.1' opacity='0.8'/><circle cx='279' cy='161' r='0.8' opacity='0.66'/><circle cx='619' cy='487' r='0.8' opacity='0.66'/><circle cx='103' cy='97' r='0.8' opacity='0.66'/><circle cx='433' cy='127' r='1' opacity='0.75'/><circle cx='553' cy='657' r='1.2' opacity='0.8'/><circle cx='293' cy='613' r='0.9' opacity='0.7'/></g><g fill='%23c9a45c'><circle cx='367' cy='299' r='1.7' opacity='0.85'/><circle cx='367' cy='299' r='4.2' opacity='0.15'/><circle cx='71' cy='251' r='1.2' opacity='0.75'/><circle cx='541' cy='557' r='1.4' opacity='0.8'/><circle cx='251' cy='31' r='1.1' opacity='0.72'/><circle cx='637' cy='53' r='1.3' opacity='0.78'/><circle cx='637' cy='53' r='3.6' opacity='0.13'/><circle cx='419' cy='659' r='1.1' opacity='0.72'/><circle cx='27' cy='673' r='1.3' opacity='0.75'/><circle cx='497' cy='367' r='1' opacity='0.68'/></g></svg>") repeat,
    /* fine star dust */
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><g fill='%23ede4d3' opacity='0.42'><circle cx='37' cy='83' r='0.7'/><circle cx='127' cy='211' r='0.6'/><circle cx='229' cy='47' r='0.7'/><circle cx='331' cy='173' r='0.6'/><circle cx='83' cy='331' r='0.6'/><circle cx='191' cy='369' r='0.7'/><circle cx='307' cy='347' r='0.6'/><circle cx='371' cy='283' r='0.6'/><circle cx='271' cy='257' r='0.5'/><circle cx='139' cy='139' r='0.5'/><circle cx='29' cy='219' r='0.5'/><circle cx='387' cy='19' r='0.6'/><circle cx='347' cy='391' r='0.6'/><circle cx='61' cy='23' r='0.5'/><circle cx='219' cy='307' r='0.5'/><circle cx='163' cy='31' r='0.5'/></g></svg>") repeat,
    /* lifted base — never pure black */
    linear-gradient(160deg, #151226 0%, #100e1a 45%, #131024 100%);
}
/* twinkle layer — a few stars gently breathe */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='900' height='900'><g fill='%23ede4d3'><circle cx='113' cy='157' r='1.5'/><circle cx='411' cy='83' r='1.3'/><circle cx='727' cy='241' r='1.6'/><circle cx='257' cy='431' r='1.2'/><circle cx='593' cy='523' r='1.5'/><circle cx='821' cy='677' r='1.3'/><circle cx='149' cy='733' r='1.4'/><circle cx='479' cy='811' r='1.2'/><circle cx='677' cy='47' r='1.2'/><circle cx='53' cy='487' r='1.3'/></g><g fill='%23c9a45c'><circle cx='349' cy='641' r='1.5'/><circle cx='863' cy='409' r='1.4'/><circle cx='569' cy='307' r='1.3'/></g></svg>") repeat;
  animation: tz-twinkle 5.5s ease-in-out infinite alternate;
}
@keyframes tz-twinkle {
  from { opacity: 0.25; }
  to   { opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; opacity: 0.6; }
}

/* ---------- 3) INSIDE: candlelit parchment wall + realm watermark ---------- */
.codex {
  position: relative;
  background:
    /* candlelight pooling from above, accent warmth from below */
    radial-gradient(ellipse 75% 26% at 50% 0%,   rgba(201, 164, 92, 0.09), transparent 62%),
    radial-gradient(ellipse 55% 38% at 100% 100%, var(--accent-glow),      transparent 62%),
    radial-gradient(ellipse 45% 30% at 0% 55%,    rgba(201, 164, 92, 0.05), transparent 60%),
    /* real paper grain */
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.93  0 0 0 0 0.89  0 0 0 0 0.82  0 0 0 0.055 0'/></filter><rect width='300' height='300' filter='url(%23n)'/></svg>") repeat,
    #14111d;
}
/* the watermark sigil — embossed into the wall, realm-specific */
.codex::after {
  content: "❧";
  position: absolute;
  bottom: -0.18em;
  right: -0.06em;
  z-index: 0;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(16rem, 34vw, 30rem);
  line-height: 1;
  color: rgba(201, 164, 92, 0.045);
  text-shadow: 0 0 60px rgba(201, 164, 92, 0.03);
}
body.theme-ai       .codex::after { content: "Λ"; color: rgba(127, 212, 232, 0.05); }
body.theme-fantasy  .codex::after { content: "☾"; color: rgba(183, 154, 224, 0.055); }
body.theme-whispers .codex::after { content: "❦"; color: rgba(217, 138, 166, 0.05); }
body.theme-seed     .codex::after { content: "✳"; color: rgba(158, 201, 143, 0.05); }
body[data-page="library"] .codex::after { content: "✦"; }

/* ---------- 4) Translucent surfaces — the wall breathes through ---------- */
.tile,
.codex .realm,
.codex .book-grid .book-card,
.codex .author-grid .author-card {
  background: rgba(17, 14, 25, 0.5);
}
a.tile:hover,
.tile.hoverable:hover,
.codex .realm:hover,
.codex .book-grid .book-card:hover,
.codex .author-grid .author-card:hover {
  background: rgba(26, 21, 40, 0.72);
}
.card { background: rgba(20, 16, 30, 0.62); backdrop-filter: blur(2px); }
.card:hover { background: rgba(26, 21, 40, 0.8); }
.tile-grid, .codex .book-grid, .codex .author-grid { background: rgba(201, 164, 92, 0.14); }
.codex-bar { background: rgba(201, 164, 92, 0.06); }
.band.tint, .codex .prose .panel:nth-child(even), .codex-colophon { background: rgba(201, 164, 92, 0.045); }
.bulletin { background: transparent; }
.panel, .panel.boxed, .codex .prose .panel.boxed { background: rgba(16, 13, 24, 0.55); backdrop-filter: blur(3px); }
.terminal { background: rgba(10, 8, 16, 0.6); }

/* ==========================================================================
   V6 — DEA ARRIVES
   The golden deity of the Zone. Two staging techniques:
   1) .hero-dea — she dissolves into the hero, her light behind the wordmark
   2) .illumination — manuscript-plate figures with script captions
   ========================================================================== */

/* Hero with the goddess — image masked so she melts into the ink */
.hero-dea {
  position: relative;
  overflow: hidden;
  min-height: clamp(440px, 52vw, 600px);
  display: flex;
  align-items: center;
}
.hero-dea .hero-words {
  position: relative;
  z-index: 1;
  max-width: 58%;
  padding: clamp(40px, 5vw, 72px) clamp(24px, 4vw, 56px);
  text-align: left;
}
.hero-dea .hero-words .label { display: block; margin-bottom: 18px; }
.hero-dea .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.7rem, 6.4vw, 4.6rem);
  line-height: 1;
  color: #f2ead9;
  margin: 0;
}
.hero-dea .wordmark em { font-style: normal; color: var(--gold); }
.hero-dea .whisper-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  color: var(--parch-dim);
  margin: 16px 0 0;
}
.hero-dea .sub {
  font-style: italic;
  color: var(--parch-mute);
  max-width: 480px;
  margin: 14px 0 26px;
}
.hero-dea .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dea-figure { position: absolute; top: 0; right: 0; bottom: 0; width: 62%; }
.dea-figure img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 58% 16%;
  -webkit-mask-image: radial-gradient(ellipse 84% 110% at 64% 46%, #000 52%, transparent 78%);
          mask-image: radial-gradient(ellipse 84% 110% at 64% 46%, #000 52%, transparent 78%);
}
.dea-figure::after {   /* her light spills onto the wall */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 62% 72% at 66% 45%, rgba(201, 164, 92, 0.12), transparent 72%);
}
@media (max-width: 860px) {
  .hero-dea { min-height: 480px; }
  .hero-dea .hero-words { max-width: 100%; text-align: center; }
  .hero-dea .hero-actions { justify-content: center; }
  .hero-dea .sub { margin-left: auto; margin-right: auto; }
  .dea-figure { width: 100%; opacity: 0.28; }
}

/* Manuscript plate — a framed illumination with script caption */
.illumination {
  display: block;
  max-width: 940px;
  margin: 0 auto;
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.55),
    0 0 32px var(--accent-glow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.illumination img { display: block; width: 100%; height: auto; }
.illumination figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 34px 24px 16px;
  background: linear-gradient(to top, rgba(8, 6, 12, 0.92), rgba(8, 6, 12, 0));
  text-align: center;
}
.illumination .fig-script {
  display: block;
  font-family: var(--font-script);
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  color: var(--parchment);
  line-height: 1.3;
}
.illumination .fig-label {
  display: block;
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 8px;
}
figure.illumination { margin-left: auto; margin-right: auto; }

/* V7 — the full set of illuminations + the sigil */
.foot-sigil { width: 74px; height: auto; opacity: 0.9; display: inline-block; margin-bottom: 6px; filter: drop-shadow(0 0 14px rgba(201,164,92,0.35)); }
.kept-by { font-family: var(--font-script); font-size: 1.5rem; color: var(--gold); margin: 2px 0 10px; }
.page-404 .codex { text-align: center; }
.page-404 .art-404 img { display: block; width: 100%; height: auto; }
.page-404 .band .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   V8 — TOUCHES
   Author heroes (veil + banner + hover), compact watermark footer
   ========================================================================== */

/* Author hero: Dea barely-there behind the name */
.page-hero { position: relative; overflow: hidden; }
.page-hero > * { position: relative; z-index: 1; }
.hero-veil { position: absolute; inset: 0; z-index: 0 !important; pointer-events: none; }
.hero-veil img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  opacity: 0.15;
  -webkit-mask-image: radial-gradient(ellipse 95% 95% at 50% 32%, #000 35%, transparent 88%);
          mask-image: radial-gradient(ellipse 95% 95% at 50% 32%, #000 35%, transparent 88%);
}

/* Soft banner behind the portrait + hover highlight */
.portrait-frame { position: relative; display: inline-block; margin-bottom: 24px; }
.portrait-frame::before {   /* glow disc */
  content: "";
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 200%; height: 96%;
  background: radial-gradient(ellipse closest-side, var(--accent-glow), transparent 72%);
  z-index: -1;
}
.portrait-frame::after {    /* wide soft banner band */
  content: "";
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(340%, 92vw); height: 34%;
  background: linear-gradient(to right, transparent, var(--accent-glow) 28%, var(--accent-glow) 72%, transparent);
  border-radius: 999px;
  z-index: -1;
}
.portrait-frame .hero-portrait {
  margin-bottom: 0;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
.portrait-frame:hover .hero-portrait {
  transform: scale(1.045);
  border-color: var(--accent);
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.03),
    0 0 0 8px var(--accent-soft),
    0 24px 60px rgba(0, 0, 0, 0.65),
    0 0 70px var(--accent-glow);
}

/* Compact watermark footer */
.site-footer {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 36px 22px 16px;
}
.site-footer .foot-grid {
  width: min(1220px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1.1fr;
  gap: 30px;
  position: relative;
  z-index: 1;
}
.foot-sigil-bg {
  position: absolute;
  right: -34px; bottom: -70px;
  width: 300px;
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
}
.site-footer .colophon { font-size: 1.35rem; margin: 0; }
.site-footer .colophon em { font-style: normal; color: var(--gold); }
.site-footer .kept-by { font-size: 1.35rem; margin: 8px 0 0; }
.foot-h {
  display: block;
  font-family: var(--font-label);
  font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.foot-col a {
  display: block;
  margin: 6px 0;
  font-size: 0.92rem;
  color: var(--parch-mute);
  text-decoration: none;
  border: none;
}
.foot-col a:hover { color: var(--gold); }
.foot-base {
  position: relative;
  z-index: 1;
  width: min(1220px, 100%);
  margin: 26px auto 0;
  border-top: 1px solid var(--border-dim);
  padding-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--parch-mute);
}
.foot-sigil { display: none; }   /* retire the old inline sigil */
@media (max-width: 760px) {
  .site-footer .foot-grid { grid-template-columns: 1fr; gap: 20px; }
  .foot-sigil-bg { width: 220px; right: -40px; bottom: -50px; opacity: 0.1; }
}

/* ==========================================================================
   V9 — THE LOCKUP, THE SEAL, THE VEILS MADE TRUE
   ========================================================================== */

/* Brand lockup: sigil + wordmark, gilded shimmer on hover */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-sigil {
  height: 46px; width: auto;
  filter: drop-shadow(0 0 8px rgba(201, 164, 92, 0.35));
  transition: transform 0.5s ease, filter 0.5s ease;
}
.brand:hover .brand-sigil {
  transform: rotate(5deg) scale(1.08);
  filter: drop-shadow(0 0 16px rgba(255, 232, 176, 0.85));
}
.brand-text { transition: text-shadow 0.4s ease; }
.brand:hover .brand-text {
  background: linear-gradient(100deg, #c9a45c 0%, #f2dfae 30%, #fff7e0 50%, #f2dfae 70%, #c9a45c 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  animation: tz-shimmer 1.15s linear infinite;
}
@keyframes tz-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .brand:hover .brand-text { animation: none; background-position: 50% 0; }
}

/* The seal stands whole behind the brand column of the footer.
   (Alternative — bleeding press-seal in the corner — swap the background line for:
   background: var(--ink-2) url("../images/dea/dea-sigil-faint.png") no-repeat right -60px bottom -80px / 320px auto;) */
.site-footer {
  background: var(--ink-2) url("../images/dea/dea-sigil-faint.png") no-repeat
              left max(20px, calc(50% - 600px)) center / 210px auto;
}

/* Purpose-made hair-veils can afford a touch more presence */
.hero-veil img {
  opacity: 0.22;
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 35%, #000 40%, transparent 92%);
          mask-image: radial-gradient(ellipse 100% 100% at 50% 35%, #000 40%, transparent 92%);
}

/* ============================================================
   BOOK LINE — a single standalone title as a full-width row:
   cover left, copy flush-left filling the width. One soft glow.
   On hover it behaves like the page's book covers (cover grows,
   title lights up) plus a brighter halo. Scoped; affects no grid.
   ============================================================ */
.book-line {
  display: flex;
  align-items: flex-start;
  gap: clamp(18px, 3vw, 32px);
  max-width: var(--content-w);
  margin: 0 auto 22px;
  padding: clamp(22px, 3vw, 32px) clamp(20px, 4vw, 44px);
  background: var(--ink-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35), 0 0 26px var(--accent-glow);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.book-line:hover {
  background: var(--ink-3);
  border-color: var(--accent-soft);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 48px var(--accent-soft);
}
.book-line img {
  width: clamp(84px, 12vw, 116px);
  height: auto;
  flex-shrink: 0;
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.book-line:hover img {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 6px 10px 22px rgba(0,0,0,0.6);
}
.book-line:hover h3 { color: var(--accent); }
.book-line-body {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.book-line h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.12;
  color: #f2ead9;
  margin: 0 0 5px;
  transition: color 0.3s ease;
}
.book-line .bl-sub {
  font-family: var(--font-body);
  color: var(--parch-dim);
  font-size: 0.98rem;
  margin: 0 0 10px;
}
.book-line p {
  color: var(--parch-dim);
  line-height: 1.65;
  font-size: 0.95rem;
  margin: 0 0 12px;
}
.book-line .buy {
  font-family: var(--font-label);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
}
.book-line .buy:hover { color: var(--parchment); border-bottom-color: var(--parchment); }
@media (max-width: 640px) {
  .book-line { flex-direction: column; }
}

/* ==========================================================================
   V11 — THE MEDALLIONS & THE HALL OF PORTALS
   ========================================================================== */

/* Fabs become glass medallions — line work, not filled discs */
.fab {
  background: rgba(15, 13, 21, 0.66);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  overflow: visible;
  box-shadow:
    0 8px 26px rgba(0, 0, 0, 0.45),
    0 0 18px var(--accent-glow),
    inset 0 0 16px var(--accent-glow);
}
.fab::before {                 /* faint dashed outer ring, turns on hover */
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 1px dashed var(--accent-soft);
  opacity: 0.5;
  transition: transform 1.2s ease, opacity 0.4s ease;
  pointer-events: none;
}
.fab .fab-ico { color: var(--accent); text-shadow: 0 0 12px var(--accent-glow); }
.fab .fab-label { color: var(--accent); }
.fab:hover {
  border-color: var(--accent);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.55),
    0 0 30px var(--accent-glow),
    inset 0 0 22px var(--accent-glow);
}
.fab:hover::before { transform: rotate(48deg); opacity: 0.9; }
/* label clipping without overflow:hidden on the ring */
.fab .fab-label { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .fab::before { transition: none; } }

/* Honest laboratory note */
.lab-note {
  margin: 14px 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--parch-mute);
}

/* ---------- The Hall of Portals (Concept B lives here) ---------- */
.nexus {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(46px, 7vw, 78px) clamp(18px, 3.5vw, 44px) clamp(44px, 6vw, 70px);
  background:
    radial-gradient(ellipse 70% 55% at 50% 118%, rgba(79, 216, 255, 0.13), transparent 62%),
    radial-gradient(ellipse 42% 34% at 82% 0%,  rgba(183, 154, 224, 0.10), transparent),
    radial-gradient(ellipse 40% 30% at 8% 12%,  rgba(201, 164, 92, 0.08),  transparent),
    #070a15;
}
.nexus .ring {
  position: absolute;
  left: 50%; bottom: -320px;
  transform: translateX(-50%);
  width: 680px; height: 680px;
  border-radius: 50%;
  border: 1px solid rgba(79, 216, 255, 0.32);
  box-shadow: 0 0 46px rgba(79, 216, 255, 0.2), inset 0 0 70px rgba(79, 216, 255, 0.12);
  pointer-events: none;
}
.nexus .ring::before {
  content: "";
  position: absolute; inset: 26px;
  border-radius: 50%;
  border: 1px dashed rgba(79, 216, 255, 0.2);
}
.nexus > * { position: relative; z-index: 1; }
.nexus h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  color: #eef5ff;
  margin: 0 auto 14px;
  max-width: 760px;
}
.nexus .sub {
  font-style: italic;
  color: #a9c2d8;
  max-width: 620px;
  margin: 0 auto;
}
.gate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-top: clamp(34px, 5vw, 50px);
  text-align: center;
}
.gate {
  --hue: #4fd8ff;
  display: block;
  border-radius: 150px 150px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--hue) 42%, transparent);
  background:
    radial-gradient(ellipse 92% 58% at 50% 0%, color-mix(in srgb, var(--hue) 15%, transparent), transparent 72%),
    rgba(8, 12, 24, 0.72);
  padding: 46px 22px 30px;
  text-decoration: none;
  color: #eaf4ff;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.gate:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--hue) 75%, transparent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 26px color-mix(in srgb, var(--hue) 28%, transparent);
}
.gate .glyph {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem; line-height: 1;
  color: var(--hue);
  margin-bottom: 14px;
  text-shadow: 0 0 16px color-mix(in srgb, var(--hue) 45%, transparent);
}
.gate h3 { font-size: 1.28rem; margin: 0 0 10px; color: #f0f6ff; transition: color 0.3s ease; }
.gate:hover h3 { color: var(--hue); }
.gate p { font-size: 0.92rem; color: #a9c2d8; line-height: 1.55; margin: 0 0 14px; }
.gate .enter {
  font-family: var(--font-label);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--hue);
}

/* V11.1 — gate rows center themselves (architecture wants symmetry) */
.gate-grid { display: flex; flex-wrap: wrap; justify-content: center; }
.gate { flex: 0 1 262px; }


/* V11.2 — pre-flight */
.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;
}
