/* Wiki-page-specific layout: hero, breadcrumb, page body, backlinks rail, graph view, round-robin */

main { padding-top: var(--header-h); }

/* ─── Landing / hero ────────────────────────────────────── */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 80px 40px 48px;
}
.hero-content {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}
.hero-eyebrow { margin-bottom: 24px; }
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 40px; height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 14px;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  margin-top: 28px;
  max-width: 720px;
  line-height: 1.7;
}
.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--tint-bg-hover) 0%, transparent 65%);
}

/* ─── Stats strip ───────────────────────────────────────── */
.stats-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  padding: 28px 40px;
}
.stats-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}
.stat-cell {
  background: var(--bg2);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-val {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--emphasis);
  line-height: 1;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Recent updates strip ──────────────────────────────── */
.section {
  padding: 80px 40px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.recent-list {
  list-style: none;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}
.recent-list li {
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 16px 8px;
  transition: padding-left 0.2s;
}
.recent-list li:hover { padding-left: 14px; }
.recent-list .type-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  min-width: 80px;
}
.recent-list .recent-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--heading);
  flex: 1;
  text-decoration: none;
}
.recent-list .recent-title:hover { color: var(--emphasis); }
.recent-list .recent-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

@media (max-width: 600px) {
  .recent-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 8px;
  }
  .recent-list li:hover { padding-left: 8px; }
  .recent-list .type-badge { min-width: 0; }
  .recent-list .recent-title { font-size: 17px; line-height: 1.3; }
  .recent-list .recent-date { opacity: 0.85; }
}

/* ─── Wiki page layout ──────────────────────────────────── */
.wiki-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 64px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 40px 80px;
}
.wiki-main { min-width: 0; max-width: 720px; }
.wiki-rail {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  font-size: 14px;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 48px; }
  .wiki-rail { position: static; }
}
@media (max-width: 900px) {
  .wiki-layout { padding: 32px 24px 64px; }
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 10px; opacity: 0.5; }

.wiki-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--heading);
  line-height: 1.1;
  margin-bottom: 16px;
}

.frontmatter-chip {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--tint-bg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}
.frontmatter-chip .type { color: var(--accent); }
.frontmatter-chip .sep { opacity: 0.4; }

.firm-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 32px;
  border: 1px solid var(--border);
  background: var(--bg2);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.firm-meta dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.firm-meta dd { color: var(--body); font-size: 14px; }

/* ─── Long-form prose ───────────────────────────────────── */
.prose {
  color: var(--body);
  font-size: 1rem;
  line-height: 1.75;
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-serif);
  color: var(--heading);
  letter-spacing: -0.005em;
  margin-top: 36px;
  margin-bottom: 14px;
  line-height: 1.25;
}
.prose h1 { font-size: clamp(32px, 3.5vw, 44px); font-weight: 600; }
.prose h2 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 600; }
.prose h3 { font-size: 22px; font-weight: 600; }
.prose h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.prose p { margin: 0 0 20px; max-width: 68ch; }
.prose ul, .prose ol { margin: 0 0 20px 24px; }
.prose li { margin-bottom: 8px; }
.prose ul li::marker { color: var(--accent); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent-hover); }
.prose strong { color: var(--cream); font-weight: 600; }
.prose em { color: var(--emphasis); font-style: italic; }
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.source-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 24px;
  border: 1px solid var(--border2);
  padding: 8px 14px;
  border-radius: var(--radius);
}
.source-link:hover { border-color: var(--accent); }

.paywall-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius);
  margin-left: 8px;
}

/* ─── Backlinks rail ────────────────────────────────────── */
.backlinks h4 {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.backlinks h4::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.backlinks-group {
  margin-bottom: 24px;
}
.backlinks-group .group-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.backlinks ul { list-style: none; }
.backlinks li { margin-bottom: 6px; }
.backlinks a {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--body);
  text-decoration: none;
  display: block;
  padding: 4px 0;
  transition: color 0.2s, padding-left 0.2s;
}
.backlinks a:hover { color: var(--accent); padding-left: 4px; }

/* ─── Graph view ────────────────────────────────────────── */
.graph-page {
  padding: 32px 40px 0;
  max-width: var(--max-w);
  margin: 0 auto;
}
.graph-canvas-wrap {
  height: calc(100vh - var(--header-h) - 220px);
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--form-radius);
  background: var(--bg2);
  position: relative;
  margin-top: 24px;
}
#graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graph-canvas:active { cursor: grabbing; }
.graph-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg3);
  border: 1px solid var(--accent);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--body);
  display: none;
  z-index: 10;
}
.graph-tooltip .t-type {
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 9px;
  margin-bottom: 4px;
}
.graph-legend {
  display: flex;
  gap: 24px;
  padding: 20px 0;
  flex-wrap: wrap;
}
.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.graph-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.graph-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 8px 0 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.graph-stats:empty { display: none; }
.graph-stats-line { line-height: 1.4; }
.graph-stats-line:first-child { color: var(--accent); font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; font-size: 10px; }
.graph-stats-breakdown { color: var(--body); }
.graph-stats-meta { color: var(--muted); opacity: 0.85; }
@media (max-width: 600px) {
  .graph-stats { gap: 4px 12px; font-size: 10px; }
}

@media (max-width: 700px) {
  .graph-page { padding: 24px 24px 0; }
  .graph-canvas-wrap {
    height: calc(100vh - var(--header-h) - 280px);
    min-height: 560px;
    margin-top: 16px;
  }
  .graph-legend { gap: 12px 16px; padding: 14px 0; }
  .graph-legend-item { font-size: 9.5px; letter-spacing: 0.8px; }
}

/* ─── Round Robin ───────────────────────────────────────── */
.rr-page {
  padding: 32px 40px 80px;
  max-width: 880px;
  margin: 0 auto;
}
.rr-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 24px 0;
}
.rr-status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1.4em;
}
.rr-status.error { color: #E04E4E; text-transform: none; letter-spacing: 0; font-size: 13px; }

.rr-result {
  border: 1px solid var(--border);
  background: var(--bg2);
  padding: 32px 40px;
  margin-top: 32px;
  border-radius: var(--form-radius);
  display: none;
}
.rr-result.visible { display: block; }
.rr-result-meta {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.rr-result-meta .label { color: var(--accent); }
.rr-sources {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 16px;
}
.rr-sources h4 {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.rr-sources ul { list-style: none; padding: 0; }
.rr-sources li {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.rr-sources a { color: var(--body); }
.rr-sources a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .rr-page, .graph-page { padding-left: 24px; padding-right: 24px; }
  .rr-result { padding: 24px; }
}

/* ─── Round Robin progress bar ──────────────────────────────── */
.rr-progress {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px 8px;
  margin: 16px 0 0;
  padding: 0;
  counter-reset: rr-step;
  align-items: start;
}
.rr-progress li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.rr-progress li::before {
  /* connector line to the next step */
  content: '';
  position: absolute;
  left: 50%;
  right: -50%;
  top: 8px;
  height: 1px;
  background: var(--border);
  z-index: 0;
}
.rr-progress li:last-child::before { display: none; }
.rr-progress .rr-step-pip {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg);
  z-index: 1;
  position: relative;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.rr-progress .rr-step-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}
.rr-progress li.active .rr-step-pip {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--tint-bg-hover);
  animation: rr-step-pulse 1.6s ease-in-out infinite;
}
.rr-progress li.active .rr-step-label { color: var(--accent); }
.rr-progress li.done .rr-step-pip {
  background: var(--accent);
  border-color: var(--accent);
}
.rr-progress li.done .rr-step-pip::after {
  content: '';
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(135deg, transparent 50%, var(--accent-hover) 50%);
  border-radius: 50%;
}
.rr-progress li.done .rr-step-label { color: var(--body); }
.rr-progress li::before.done,
.rr-progress li.done::before { background: var(--accent); }
.rr-progress li.error .rr-step-pip {
  background: #E04E4E;
  border-color: #E04E4E;
  animation: none;
}
.rr-progress li.error .rr-step-label { color: #E04E4E; }
@keyframes rr-step-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--tint-bg-hover); }
  50%      { box-shadow: 0 0 0 8px var(--tint-bg); }
}
@media (max-width: 600px) {
  .rr-progress .rr-step-label { font-size: 8.5px; letter-spacing: 0.8px; }
}

/* ─── Article inline view ───────────────────────────────────── */
.article-angle {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--cream);
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin: 24px 0 32px;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ─── Share toast ───────────────────────────────────────────── */
.share-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--accent);
  color: var(--cream);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: share-toast-in 0.2s ease forwards;
}
@keyframes share-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
