:root {
  --bg-page: #fafaf8;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f1;
  --bg-sidebar: #131312;
  --fg-primary: #1c1c18;
  --fg-secondary: #4a4a44;
  --fg-muted: #6b6b63;
  --fg-faint: #9b9b93;
  --fg-inverted: #f4f4f1;
  --border: #e8e8e4;
  --border-strong: #d1d1cb;
  --sidebar-border: #2a2a27;
  --sidebar-muted: #7a7a72;
  --accent: #f5b015;
  --accent-strong: #d4920a;
  --accent-soft: #fff8e7;
  --shadow-soft: 0 24px 80px rgba(17, 17, 16, 0.08);
  --font-display: "Lora", Georgia, serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-width: 292px;
}

html[data-theme="dim"] {
  --bg-page: #181815;
  --bg-surface: #20201c;
  --bg-subtle: #272720;
  --fg-primary: #f1efe7;
  --fg-secondary: #d1cfc4;
  --fg-muted: #aaa69a;
  --fg-faint: #7f7a70;
  --border: #333228;
  --border-strong: #4a473a;
  --accent-soft: #2d2617;
  --shadow-soft: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 78% 8%, rgba(245, 176, 21, 0.08), transparent 28rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 24rem),
    var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.menu-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  overflow-y: auto;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--sidebar-border);
  color: #d4d4ce;
}

.sidebar::-webkit-scrollbar,
.main::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #2a2a27;
  border-radius: 99px;
}

.main::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

.brand {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand__wordmark {
  display: block;
  color: #f4f4f1;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-decoration: none;
}

.brand__tagline {
  margin: 7px 0 0;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.sidebar__top {
  display: flex;
  gap: 5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__top a,
.sidebar__top button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8b8b82;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar__top a:hover,
.sidebar__top button:hover {
  background: #1f1f1c;
  color: #f4f4f1;
}

.progress-card {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.progress-card__labels {
  display: flex;
  justify-content: space-between;
  color: var(--sidebar-muted);
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 7px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2a27;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 350ms ease;
}

.sidebar__search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__search label {
  display: block;
  margin-bottom: 7px;
  color: #6b6b63;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar__search input {
  width: 100%;
  border: 1px solid #2a2a27;
  border-radius: 7px;
  background: #0f0f0e;
  color: #f4f4f1;
  outline: 0;
  padding: 10px 11px;
  font-size: 0.82rem;
}

.sidebar__search input:focus {
  border-color: rgba(245, 176, 21, 0.72);
  box-shadow: 0 0 0 3px rgba(245, 176, 21, 0.13);
}

.series-nav {
  flex: 1 0 auto;
  padding: 10px 0 24px;
}

.sidebar__footer {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
  padding: 12px 14px 16px;
}

.sidebar__footer a {
  border-radius: 5px;
  color: #8b8b82;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 7px 8px;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar__footer a:hover {
  background: #1f1f1c;
  color: #f4f4f1;
}

.series-nav__section {
  margin: 0 0 6px;
}

.series-nav__label {
  padding: 10px 18px 5px;
  color: #4a4a44;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.series-nav__link {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 4px;
  margin: 0 6px;
  border-radius: 5px;
  color: #83837a;
  padding: 7px 10px;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.series-nav__section[hidden],
.series-nav__link[hidden] {
  display: none !important;
}

.series-nav__link:hover,
.series-nav__link.is-active {
  background: #252521;
  color: #d4d4ce;
}

.series-nav__link.is-active .series-nav__num {
  color: var(--accent);
}

.series-nav__num {
  color: #55554c;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding-top: 2px;
}

.series-nav__title {
  font-size: 0.78rem;
  line-height: 1.42;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  outline: none;
}

.menu-button {
  display: none;
}

.page {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 54px 40px 88px;
}

.reader-page {
  max-width: 800px;
}

.static-section {
  border-top: 1px solid var(--border);
  scroll-margin-top: 18px;
}

.static-section .reader-header h2 {
  max-width: 13ch;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 52px;
  align-items: end;
  min-height: 520px;
  padding: 26px 0 52px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--fg-primary);
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  text-wrap: pretty;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(3.2rem, 8vw, 7rem);
  font-weight: 700;
  line-height: 0.96;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.15;
}

h3 {
  margin: 34px 0 12px;
  font-size: 1.28rem;
  line-height: 1.3;
}

h4 {
  margin: 28px 0 10px;
  font-size: 1.06rem;
}

.lede {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--fg-secondary);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.72;
  text-wrap: pretty;
}

.home-card,
.article-card,
.visual-map-card,
.closing-panel {
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.home-card {
  position: relative;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.home-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  border-radius: 16px 16px 0 0;
  background: var(--accent);
}

.home-card p {
  margin: 0 0 18px;
  color: var(--fg-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}

.stats-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 0;
}

.stats-list div {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.stats-list dt {
  color: var(--fg-faint);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stats-list dd {
  margin: 4px 0 0;
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 11px 18px;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--fg-primary);
  color: var(--bg-page);
}

.button--secondary {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg-primary);
}

.text-link {
  color: var(--fg-secondary);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent-strong);
}

.section-band {
  border-top: 1px solid var(--border);
  padding: 48px 0;
}

.section-copy {
  max-width: 720px;
  margin: 0 0 22px;
  color: var(--fg-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.section-copy a {
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.section-band--intro {
  padding-top: 54px;
}

.section-heading-row {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.reader-grid,
.article-grid,
.visual-map-grid {
  display: grid;
  gap: 14px;
}

.reader-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reader-grid div {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.reader-grid strong,
.reader-grid span {
  display: block;
}

.reader-grid strong {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.reader-grid span {
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.article-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-card {
  display: flex;
  flex-direction: column;
  min-height: 178px;
  border-radius: 14px;
  color: inherit;
  padding: 20px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.article-card:hover,
.visual-map-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  transform: translateY(-2px);
}

.article-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.article-card__title {
  margin: auto 0 10px;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
}

.article-card__excerpt {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--fg-secondary);
  font-size: 0.85rem;
  padding: 10px 14px;
}

.faq-list {
  display: grid;
  gap: 12px;
  max-width: 860px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-surface);
  padding: 18px 20px;
}

.faq-item summary {
  cursor: pointer;
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--fg-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}

.contact-form {
  display: grid;
  gap: 14px;
  max-width: 680px;
}

.contact-form label {
  display: grid;
  gap: 7px;
}

.contact-form span {
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--fg-primary);
  font: inherit;
  padding: 12px 13px;
}

.contact-form textarea {
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent-strong);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(245, 176, 21, 0.14);
}

.contact-form button {
  justify-self: start;
  border: 0;
  cursor: pointer;
}

.visual-map-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.visual-map-card {
  min-height: 120px;
  border-radius: 14px;
  color: inherit;
  padding: 18px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.visual-map-card span {
  display: block;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.visual-map-card strong {
  display: block;
  margin-top: 26px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.3;
}

.closing-panel {
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 30px;
}

.closing-panel p:not(.eyebrow) {
  color: var(--fg-secondary);
  line-height: 1.7;
  max-width: 720px;
}

.reader-header {
  padding-bottom: 24px;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  color: var(--fg-faint);
  font-size: 0.82rem;
}

.breadcrumb a {
  text-decoration: none;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 16px;
}

.badge {
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--fg-faint);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 5px 9px;
  text-transform: uppercase;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.reader-actions button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
}

.prose {
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.prose p,
.prose li {
  color: var(--fg-primary);
  font-size: 1.045rem;
  line-height: 1.83;
}

.prose p {
  margin: 0 0 1.35em;
  text-wrap: pretty;
}

.prose h3 {
  margin: 2.2em 0 0.85em;
  color: var(--fg-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prose h4 {
  color: var(--fg-secondary);
  font-family: var(--font-display);
}

.prose ul,
.prose ol {
  margin: 0 0 1.5em;
  padding-left: 1.25em;
}

.prose li {
  padding-left: 0.15em;
}

.prose strong {
  font-weight: 800;
}

.prose em {
  font-family: var(--font-display);
}

.prose a {
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 32px 0;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  padding: 20px 24px;
}

.prose blockquote p {
  margin: 0;
  color: var(--fg-secondary);
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-style: italic;
}

.prose pre {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 28px 0;
  padding: 18px;
}

.prose code {
  border-radius: 4px;
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 0.87em;
  padding: 0.13em 0.36em;
}

.table-scroll {
  overflow-x: auto;
  margin: 28px 0;
}

.prose table,
.visual-block table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border) !important;
  background: var(--bg-surface) !important;
  color: var(--fg-primary) !important;
  font-family: var(--font-body) !important;
  font-size: 0.9rem !important;
}

.prose th,
.prose td,
.visual-block th,
.visual-block td {
  border-bottom: 1px solid var(--border) !important;
  padding: 12px 14px !important;
  text-align: left !important;
  vertical-align: top !important;
  color: var(--fg-primary) !important;
}

.prose th,
.visual-block th {
  background: var(--bg-subtle) !important;
  color: var(--fg-secondary) !important;
  font-size: 0.76rem !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.visual-block {
  margin: 34px 0;
}

.visual-block figure {
  margin: 0 !important;
  font-family: var(--font-body) !important;
}

.visual-block p:first-child {
  color: var(--fg-faint) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  margin: 0 0 10px !important;
  text-transform: uppercase !important;
}

.visual-block figcaption {
  color: var(--fg-muted) !important;
  font-size: 0.86rem !important;
  font-style: italic !important;
  line-height: 1.55 !important;
  margin-top: 10px !important;
}

.visual-block tr:nth-child(even) td {
  background: color-mix(in srgb, var(--bg-subtle) 65%, transparent) !important;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 46px 0;
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding-top: 24px;
}

.post-nav a {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  min-height: 90px;
  padding: 16px;
  text-decoration: none;
}

.post-nav a:last-child {
  text-align: right;
}

.post-nav span {
  display: block;
  color: var(--fg-faint);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.post-nav strong {
  font-family: var(--font-display);
  line-height: 1.25;
}

.loading-state,
.error-state,
.empty-state {
  max-width: 620px;
  margin: 0 auto;
  padding: 90px 40px;
}

.empty-state {
  color: #6b6b63;
  font-size: 0.82rem;
}

.error-state {
  color: var(--fg-secondary);
}

.error-state code {
  background: var(--bg-subtle);
  border-radius: 4px;
  padding: 0.2em 0.4em;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--fg-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 26px;
  font-size: 0.82rem;
}

@media (max-width: 1040px) {
  .home-hero,
  .reader-grid,
  .visual-map-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-button {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 30;
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--fg-primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 9px 13px;
    box-shadow: var(--shadow-soft);
  }

  .page {
    padding-top: 72px;
  }

  .home-hero {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .page {
    padding-inline: 22px;
  }

  .article-grid,
  .post-nav {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(2.65rem, 15vw, 4.2rem);
  }

  .home-card,
  .closing-panel {
    padding: 18px;
  }

  .stats-list {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .menu-button,
  .reader-actions,
  .post-nav {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  .page {
    max-width: 760px;
    padding: 0;
  }
}
