:root {
  --bg: #12151c;
  --bg-2: #191d26;
  --panel: #191d26;
  --panel-strong: #212633;
  --line: rgba(255, 255, 255, 0.10);
  --text: #f3f3f3;
  --muted: #adadad;
  --accent: #9d2b2d;
  --accent-2: #fffD00;
  --danger: #e45454;
  --shadow: none;
  --radius: 8px;
  --radius-sm: 8px;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration-color: rgba(255, 253, 0, 0.5); text-underline-offset: 3px; }
a:hover { color: var(--accent-2); text-decoration-color: var(--accent-2); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #1b140b;
  padding: 0.6rem 1rem;
  border-radius: 999px;
}
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; }

.site-header {
  position: relative;
  z-index: 20;
  background: #12151c;
  border-bottom: 1px solid var(--line);
}
.site-header__inner,
.page-shell,
.site-footer {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
  padding: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.brand__copy strong, .brand__copy small { display: block; }
.brand__copy strong { font-size: 1.35rem; letter-spacing: -0.06em; font-weight: 800; text-transform: uppercase; }
.brand__copy strong::first-letter { color: var(--accent); }
.brand__copy small { color: var(--muted); font-size: 0.63rem; letter-spacing: .13em; text-transform: uppercase; }

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.4rem;
  font-size: 0.82rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.top-nav a { text-decoration: none; }
.top-nav a:hover { color: var(--accent-2); }
.top-nav__search { color: var(--accent-2); font-size: 1.5rem; line-height: .6; }
.top-nav__account { color: var(--accent-2); }

.page-shell { padding: 40px 0 4rem; }

.hero, .dashboard-grid, .grid-3, .admin-grid, .taxonomy-grid { display: grid; gap: 1.25rem; }
.hero { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr); align-items: stretch; margin-bottom: 1.25rem; }
.hero__copy, .search-panel, .panel, .feature-card, .age-gate__panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero__copy { padding: 2rem; }
.eyebrow, .age-gate__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent-2);
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 4vw, 2.9rem); font-weight: 300; line-height: 1.05; letter-spacing: -.03em; margin: 0 0 1rem; }
.hero p, .panel p, .author-hero p, .lead { color: var(--muted); }
.hero__actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.75rem 1.15rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.button--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}

.search-panel { padding: 1.5rem; display: grid; gap: 0.8rem; align-content: center; }
.search-panel--compact { padding: 0; background: transparent; border: 0; box-shadow: none; width: min(360px, 100%); }
.search-panel--inline { margin: 1rem 0 1.25rem; }
.search-panel label { color: var(--muted); font-size: 0.92rem; }
.search-panel__row { display: flex; gap: 0.75rem; }
input, select, textarea {
  width: 100%;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0e1117;
  color: var(--text);
  padding: 0.9rem 1rem;
}
textarea { resize: vertical; }

.dashboard-grid { grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.9fr); margin-bottom: 1.25rem; }
.sidebar-stack, .story-stack { display: grid; gap: 1rem; }
.panel { padding: 1.25rem; }
.panel--muted { background: rgba(255, 255, 255, 0.03); }
.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel__head h1, .panel__head h2 { margin: 0; font-size: 1.2rem; }

.story-card {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}
.story-card h3 { font-size: 1.1rem; line-height: 1.25; margin: .45rem 0 .35rem; }
.story-card p { color: var(--muted); margin: 0; font-size: .86rem; line-height: 1.55; }
.compact-item span { color: var(--muted); margin: 0; }
.story-card__meta, .story-card__footer, .story-meta, .chapter-nav, .pager, .chip-row, .feature-list, .kv {
  display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem;
}
.story-card__meta { color: var(--muted); font-size: .72rem; }
.story-card__footer { justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: .7rem; }
.pill, .chip, .chapter-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  background: rgba(157, 43, 45, .16);
  border: 1px solid rgba(157, 43, 45, .38);
  text-decoration: none;
}
.chapter-nav { margin-top: 1.25rem; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.reader-actions form { margin: 0; }
.reader-callout { margin-top: 1.25rem; color: var(--muted); }
.chapter-nav a.active { background: rgba(255, 186, 105, 0.18); border-color: rgba(255, 186, 105, 0.35); }

.compact-list { display: grid; gap: 0.85rem; }
.compact-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
}
.compact-item--chapter { grid-template-columns: 72px minmax(0, 1fr); align-items: center; }
.compact-item__copy { display: grid; gap: .15rem; min-width: 0; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.feature-list { list-style: none; padding: 0; margin: 0; color: var(--muted); }
.feature-list li { padding-left: 1.1rem; position: relative; }
.feature-list li::before { content: "•"; color: var(--accent); position: absolute; left: 0; }
.archive-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.taxonomy-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.taxonomy-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
}
.taxonomy-card span { color: var(--muted); }
.pagination { margin-top: 1rem; }
.pager {
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  margin-top: 1rem;
}
.pager a { text-decoration: none; }
.empty-state {
  display: grid;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.story-page__layout { display: grid; grid-template-columns: minmax(0, 760px) 240px; gap: 2rem; margin: 1.5rem auto 0; justify-content: center; }
.story-page__head { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.story-page__crumbs { color: var(--muted); display: flex; gap: 0.5rem; flex-wrap: wrap; }
.story-meta { color: var(--muted); font-size: 0.92rem; margin-top: 1rem; }
.story-images { display: grid; gap: 1rem; margin: 1.5rem 0; }
.story-inline-image { margin: 0; }
.story-inline-image img { width: 100%; max-height: 720px; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg-2); }
.story-inline-image figcaption { color: var(--muted); font-size: .85rem; margin-top: .4rem; }
.series-banner {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: rgba(122, 225, 200, 0.08);
  color: var(--accent-2);
}
.story-page__content .prose { font-size: 1.08rem; color: #f3f7ff; }
.prose p { margin-bottom: 1rem; max-width: 68ch; }
.kv { display: grid; grid-template-columns: 140px 1fr; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.metric strong { font-size: 2rem; display: block; }
.metric span { color: var(--muted); }
.editor-form { display: grid; gap: 1rem; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.editor-grid label, .form-actions { display: grid; gap: 0.45rem; }
.inline-check { display: flex !important; align-items: center; gap: 0.7rem; }
.inline-check input { width: auto; }
.form-actions { justify-content: start; }
.admin-utility { display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem; max-width: var(--max); margin: 1rem auto -0.5rem; padding: 0 1.25rem; }
.admin-utility form { margin: 0; }
.admin-utility button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.admin-utility a, .admin-utility button { text-decoration: underline; text-underline-offset: 0.2rem; }
.form-error { color: #ffaba3; }
.seo-preview {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: 18px;
  background: rgba(122, 225, 200, 0.05);
  border: 1px solid rgba(122, 225, 200, 0.18);
}
.seo-preview__url {
  color: var(--accent-2);
  font-size: 0.88rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
}
.seo-preview h3 { margin: 0.2rem 0 0.35rem; font-size: 1.25rem; }
.seo-preview p { margin-bottom: 0.9rem; }
.taxonomy-admin-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.taxonomy-admin-card {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}
.bulk-actions { display: grid; gap: 1rem; }
.bulk-actions__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.bulk-actions__toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}
.compact-item--selectable {
  text-align: left;
  cursor: pointer;
}
.compact-item__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.compact-item__row input {
  width: auto;
  flex: 0 0 auto;
}
.chapter-admin-row {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.chapter-admin-row form {
  display: grid;
  gap: 0.5rem;
}
.chapter-admin-row input,
.chapter-admin-row textarea {
  width: 100%;
}
.chapter-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.8rem 0.4rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); color: var(--muted); }
.table th { color: var(--text); }

.site-footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .82rem;
}
.footer-links { display: flex; gap: 1rem; align-items: center; }

.age-gate {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 11, 0.78);
  backdrop-filter: blur(12px);
  display: none;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}
.age-gate.is-visible { display: grid; }
.age-gate__panel {
  width: min(460px, 100%);
  padding: 1.5rem;
  text-align: center;
}

.admin-page .site-header, .admin-page .site-footer { display: none; }
.admin-page .page-shell { padding-top: 1rem; }

/* Homepage: text-only directory layout */
.home-directory { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.home-sidebar { color: var(--muted); font-size: .86rem; }
.home-sidebar h1 { color: var(--text); font-size: 1.35rem; margin: 0 0 1.5rem; }
.home-sidebar h2 { color: var(--text); font-size: .9rem; margin: 1.35rem 0 .45rem; }
.home-sidebar nav, .home-sidebar__group { display: grid; gap: .25rem; }
.home-sidebar a { color: var(--muted); text-decoration: none; }
.home-sidebar a:hover { color: var(--text); text-decoration: underline; }
.home-main { min-width: 0; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.section-title h2, .discovery-strip h2, .home-about h2 { margin: 0; font-size: 1.25rem; font-weight: 600; }
.section-title a { color: var(--accent-2); font-size: .82rem; text-decoration: none; }
.story-grid { display: grid; grid-template-columns: 1fr; }
.latest-section .pagination { margin-top: 30px; }
.load-more { display: flex; justify-content: center; min-height: 52px; margin-top: 28px; color: var(--muted); }
.load-more span { align-self: center; font-size: .86rem; }
.load-more.is-loading { opacity: .72; }
.discovery-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 64px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.discovery-strip h2 { margin-bottom: 15px; }
.home-about { width: min(720px, 100%); margin: 48px auto 10px; text-align: center; }
.home-about p { color: var(--muted); line-height: 1.8; }
.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; }

@media (max-width: 1080px) {
  .hero, .dashboard-grid, .story-page__layout, .grid-3, .archive-grid, .editor-grid, .metric-grid { grid-template-columns: 1fr; }
  .site-header__inner, .site-footer { flex-direction: column; align-items: stretch; }
  .top-nav { justify-content: flex-start; }
  .story-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .page-shell { width: min(var(--max), calc(100% - 1rem)); }
  .hero__copy, .panel, .search-panel { padding: 1rem; }
  .search-panel__row { flex-direction: column; }
  h1 { font-size: 2.15rem; }
  .story-card__footer, .pager { flex-direction: column; align-items: flex-start; }
  .kv { grid-template-columns: 1fr; }
  .taxonomy-grid { grid-template-columns: 1fr; }
  .site-header__inner { min-height: 0; padding: 1rem 0; }
  .top-nav { gap: .85rem; font-size: .7rem; }
  .home-directory { grid-template-columns: 1fr; gap: 1rem; }
  .home-sidebar { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
  .home-sidebar__group { display: inline-flex; flex-wrap: wrap; margin-right: 1rem; }
  .home-sidebar__group h2 { width: 100%; }
}
