:root {
  --paper: #f8f7f4;
  --surface: #ffffff;
  --subtle: #f1efe9;
  --line: #e5e2d9;
  --line-strong: #d4cfc3;
  --ink: #14161a;
  --muted: #5b6068;
  --brand: #14532d;
  --brand-hover: #0f3f22;
  --brand-soft: #e7f3ec;
  --signal-live: #15803d;
  --signal-live-bg: #dcfce7;
  --signal-warn: #9a3412;
  --signal-warn-bg: #ffedd5;
  --shadow: 0 1px 2px rgb(20 22 26 / 4%), 0 14px 32px -20px rgb(20 22 26 / 16%);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.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;
}

.site-shell {
  width: min(1220px, calc(100% - 48px));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgb(248 247 244 / 94%);
  backdrop-filter: blur(8px);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.nav a {
  padding: 7px 11px;
  border-radius: 7px;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: var(--subtle);
  color: var(--ink);
}

.nav a[aria-current="page"] {
  font-weight: 600;
}

.nav .nav-ext {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 11px;
}

/* Typography & Shared Elements */
.eyebrow {
  margin: 0;
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.inline-link {
  color: var(--brand);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.inline-link:hover {
  color: var(--brand-hover);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--brand);
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.button-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  transition: background 0.15s ease;
  white-space: nowrap;
}

.button-secondary:hover {
  background: var(--subtle);
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 22px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  align-items: center;
  gap: 56px;
  padding: 58px 0 64px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  margin: 16px 0 0;
  font-size: clamp(38px, 4.8vw, 60px);
  line-height: 1.06;
  max-width: 16ch;
}

.hero-intro {
  margin: 20px 0 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.68;
}

.hero-note {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* System Ledger Card */
.ledger-panel {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--signal-live);
  font-weight: 600;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--signal-live);
}

.ledger-rows {
  padding: 4px 20px;
}

.ledger-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.ledger-row:last-child {
  border-bottom: 0;
}

.ledger-key {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.ledger-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.ledger-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  text-align: right;
  white-space: nowrap;
}

.ledger-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ink);
  color: #f8f7f4;
  font-family: var(--font-mono);
  font-size: 11px;
}

.ledger-foot span:first-child {
  opacity: 0.72;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Metrics Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  margin: 40px 0 0;
  overflow: hidden;
}

.metric-cell {
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.metric-cell:last-child {
  border-right: 0;
}

.metric-num {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

.metric-title {
  margin: 6px 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.metric-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Sections */
.section {
  padding: 60px 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 10px 0 0;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.15;
}

.section-lead {
  margin: 10px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15px;
}

/* 4-Step Workflow */
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.workflow-step {
  padding: 24px;
  border-right: 1px solid var(--line);
}

.workflow-step:last-child {
  border-right: 0;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.14em;
}

.workflow-step h3 {
  margin: 12px 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.workflow-step p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Category Pill Navigation */
.hub-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}

.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hub-pill:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.hub-pill[aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.hub-pill-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

/* Page Hero (Subpages) */
.page-hero {
  padding: 36px 0 36px;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  margin: 12px 0 0;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.12;
  max-width: 24ch;
}

.page-hero-lead {
  margin: 14px 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 16px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Filter Toolbar (Progressive Enhancement) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-input,
.filter-select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
}

.filter-input {
  width: 240px;
  max-width: 100%;
}

.filter-reset {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--subtle);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.filter-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Directory Data Table */
.table-shell {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table.dir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
  min-width: 760px;
}

.dir-table th {
  padding: 12px 16px;
  background: var(--subtle);
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.dir-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.dir-table tbody tr:last-child td {
  border-bottom: 0;
}

.dir-table tbody tr:hover {
  background: #faf9f6;
}

.dir-name {
  font-weight: 600;
  color: var(--ink);
}

.dir-domain {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.mono-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.badge-tier-s {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.badge-tier-a {
  background: var(--brand-soft);
  border-color: rgb(20 83 45 / 22%);
  color: var(--brand);
}

.badge-dofollow {
  background: var(--signal-live-bg);
  border-color: rgb(21 128 61 / 25%);
  color: var(--signal-live);
}

.badge-paid {
  background: var(--signal-warn-bg);
  border-color: rgb(154 52 18 / 25%);
  color: var(--signal-warn);
}

.submit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

.submit-link:hover {
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--subtle);
  font-family: var(--font-mono);
  font-size: 12px;
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
}

.page-link:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.page-link[aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.page-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Editorial Cards & Research Strips */
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.editorial-panel {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.editorial-panel h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.editorial-panel p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Research Article Layout */
.article-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  padding: 40px 0 64px;
  border-bottom: 1px solid var(--line);
}

.toc-box {
  position: sticky;
  top: 88px;
  align-self: start;
  border-left: 2px solid var(--line-strong);
  padding-left: 16px;
}

.toc-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.toc-list a {
  color: var(--muted);
}

.toc-list a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.article-body {
  min-width: 0;
  max-width: 74ch;
}

.article-body h2 {
  margin: 40px 0 12px;
  font-size: 28px;
  line-height: 1.2;
  scroll-margin-top: 88px;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  margin: 26px 0 8px;
  font-size: 20px;
  scroll-margin-top: 88px;
}

.article-body p,
.article-body li {
  color: #2b3038;
  font-size: 15.5px;
  line-height: 1.75;
}

.article-body ul,
.article-body ol {
  padding-left: 20px;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--subtle);
  border: 1px solid var(--line);
}

.callout-box {
  margin: 22px 0;
  padding: 18px 20px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
}

.callout-box p {
  margin: 0;
  font-size: 14.5px;
}

/* FAQ Section */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.faq-item {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  padding: 22px;
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.3;
}

.faq-item p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Brand Kit */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.brand-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

.brand-tile img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: contain;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  flex: none;
}

/* Footer */
.site-footer {
  padding: 48px 0 56px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.footer-brand p {
  margin: 12px 0 0;
  max-width: 42ch;
  font-size: 14px;
  color: var(--muted);
}

.footer-col h3 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 42px 0; }
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-cell:nth-child(2) { border-right: 0; }
  .metric-cell:nth-child(1),
  .metric-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
  .workflow-grid { grid-template-columns: repeat(2, 1fr); }
  .workflow-step:nth-child(2) { border-right: 0; }
  .workflow-step:nth-child(1),
  .workflow-step:nth-child(2) { border-bottom: 1px solid var(--line); }
  .three-col-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 28px; }
  .toc-box { position: static; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .site-shell { width: calc(100% - 32px); }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .nav { width: 100%; flex-wrap: wrap; gap: 4px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .metrics-strip,
  .workflow-grid,
  .two-col-grid,
  .faq-grid,
  .footer-grid { grid-template-columns: 1fr; }
  .metric-cell,
  .workflow-step { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-cell:last-child,
  .workflow-step:last-child { border-bottom: 0; }
  .actions { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
