/**
 * ChinaOps design system
 * Tokens + layout + ESL-friendly components
 * Prefer system fonts (Google often blocked in China)
 */

/* ========== Tokens ========== */
:root {
  /* Foreground */
  --fg-1: #1a202c;
  --fg-2: #4a5568;
  --fg-3: #718096;
  --fg-on-brand: #ffffff;
  --fg-on-critical: #ffffff;

  /* Background / surface */
  --bg-base: #f7fafc;
  --bg-raised: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-brand-soft: #eef2ff;
  --bg-success-soft: #f0fff4;
  --bg-warning-soft: #fffbeb;
  --bg-critical-soft: #fff5f5;
  --bg-info-soft: #f0f7ff;
  --bg-page-gradient: linear-gradient(135deg, #5b6fd8 0%, #6b4f9a 100%);

  /* Border */
  --border-subtle: #edf2f7;
  --border-default: #e2e8f0;
  --border-emphasis: #cbd5e0;

  /* Brand */
  --brand: #5b6fd8;
  --brand-hover: #4c5fc7;
  --brand-deep: #6b4f9a;

  /* Semantic */
  --success: #38a169;
  --success-strong: #2f855a;
  --warning: #d69e2e;
  --warning-strong: #b7791f;
  --critical: #c53030;
  --critical-strong: #9b2c2c;
  --info: #3182ce;

  /* Spacing / radius */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --dur-med: 220ms;

  /* Chrome */
  --sidebar-w: 300px;
  --mobile-bar-h: 56px;
  --shadow-sm: 0 4px 12px rgba(26, 32, 44, 0.06);
  --shadow-md: 0 10px 28px rgba(26, 32, 44, 0.1);
  --content-max: 800px;
  --page-max: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg-1);
  background: var(--bg-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-hover);
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

/* ========== ESL / semantic components ========== */
.plain {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-3);
  line-height: 1.35;
  margin-top: 2px;
}

.bilingual-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bilingual-title .sys {
  font-weight: 700;
  color: var(--fg-1);
}

/* Symptom index search + filters */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.symptom-search-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 var(--space-3);
}

.symptom-search {
  flex: 1 1 220px;
  min-height: 44px;
  font: inherit;
  font-size: var(--text-md);
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--fg-1);
}

.symptom-search:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

.symptom-search-clear {
  min-height: 40px;
}

.symptom-section tr.is-hidden-row {
  display: none;
}

.symptom-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--space-5);
  padding: var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  color: var(--fg-2);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast),
    border-color var(--dur-fast);
}

.filter-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.filter-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--fg-on-brand);
}

.symptom-section.is-hidden {
  display: none;
}

.symptom-count {
  font-size: var(--text-sm);
  color: var(--fg-3);
  margin: 0 0 var(--space-4);
}

/* Plain-English summary (ESL-first block at top of SOPs) */
.plain-summary {
  border-radius: var(--radius-md);
  border: 1px solid #c3dafe;
  background: var(--bg-brand-soft);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-5);
  color: #2a4365;
}

.plain-summary > strong:first-child,
.plain-summary .plain-summary-label {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  margin-bottom: var(--space-2);
}

.plain-summary p {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
  color: #2a4365;
}

.plain-summary p:last-child {
  margin-bottom: 0;
}

.scope-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.15em 0.55em;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--fg-2);
  border: 1px solid var(--border-default);
  margin-right: 6px;
}

/* Callouts */
.callout {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 5px solid var(--border-emphasis);
  background: var(--bg-subtle);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
}

.callout-title {
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 var(--space-2);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-info {
  border-left-color: var(--info);
  background: var(--bg-info-soft);
  color: #2a4365;
}

.callout-info .callout-title {
  color: var(--info);
}

.callout-success {
  border-left-color: var(--success);
  background: var(--bg-success-soft);
  color: #22543d;
}

.callout-success .callout-title {
  color: var(--success-strong);
}

.callout-warning {
  border-left-color: var(--warning);
  background: var(--bg-warning-soft);
  color: #744210;
}

.callout-warning .callout-title {
  color: var(--warning-strong);
}

.callout-critical {
  border-left-color: var(--critical);
  background: var(--bg-critical-soft);
  color: #742a2a;
}

.callout-critical .callout-title {
  color: var(--critical);
}

/* Phrase card: Chinese + pinyin + English */
.phrase-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin: var(--space-3) 0;
  box-shadow: var(--shadow-sm);
}

.phrase-card .zh {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg-1);
  line-height: 1.3;
}

.phrase-card .py {
  font-size: var(--text-sm);
  color: var(--fg-3);
  font-style: italic;
}

.phrase-card .en {
  font-size: var(--text-base);
  color: var(--fg-2);
}

/* Term chip + definition */
.term {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  flex-wrap: wrap;
  max-width: 100%;
}

.term-chip {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.15em 0.55em;
  border-radius: var(--radius-sm);
  background: var(--bg-brand-soft);
  color: var(--brand);
  border: 1px solid #c3dafe;
  vertical-align: middle;
}

.term-def {
  font-size: var(--text-sm);
  color: var(--fg-3);
}

/* What's new (static; no marquee) */
.whats-new {
  text-align: left;
  background: var(--bg-success-soft);
  border: 1px solid #9ae6b4;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-4);
  color: #22543d;
}

.whats-new h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--success-strong);
}

.whats-new ul {
  margin: 0;
  padding-left: 1.2em;
}

.whats-new li {
  margin-bottom: 6px;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.whats-new li:last-child {
  margin-bottom: 0;
}

/* Path cards (home quick links) */
.path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.path-grid.primary-paths {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-4);
}

.path-grid.primary-paths .path-card {
  min-height: 148px;
}

.path-grid.primary-paths .path-title {
  font-size: var(--text-xl);
}

.path-card.tone-critical {
  border-left-width: 6px;
  background: linear-gradient(90deg, var(--bg-critical-soft) 0%, var(--bg-raised) 40%);
}

.path-card.tone-critical .path-title {
  color: var(--critical-strong);
}

.more-paths-wrap {
  margin-bottom: var(--space-7);
}

.more-paths-wrap summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--fg-on-brand);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  list-style: none;
  margin-bottom: var(--space-3);
}

/* Home no longer uses full purple wash — summary on light bg */
.home-body .more-paths-wrap summary {
  color: var(--fg-1);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.more-paths-wrap summary::-webkit-details-marker {
  display: none;
}

.more-paths-wrap summary::after {
  content: " +";
  color: var(--brand);
  font-weight: 800;
}

.more-paths-wrap[open] summary::after {
  content: " −";
}

.home-paths-label {
  color: var(--fg-1);
  margin: 0 0 var(--space-4);
  font-size: var(--text-xl);
  font-weight: 700;
}

.home-paths-label .plain {
  color: var(--fg-3);
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: var(--space-5);
}

.btn-critical {
  background: var(--critical);
  color: var(--fg-on-critical);
}

.btn-critical:hover {
  background: var(--critical-strong);
  color: var(--fg-on-critical);
}

/* Print hub cards */
.print-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.print-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  min-height: 200px;
  transition: box-shadow var(--dur-med), transform var(--dur-med);
}

.print-option:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

.print-option.recommended {
  border: 2px solid var(--critical);
  background: linear-gradient(180deg, var(--bg-critical-soft), var(--bg-raised) 50%);
}

.print-option .badge-rec {
  align-self: flex-start;
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-on-critical);
  background: var(--critical);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.print-option h3 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--fg-1);
}

.print-option p {
  margin: 0;
  color: var(--fg-2);
  font-size: var(--text-sm);
  flex: 1;
}

/* Guide sticky mobile TOC + bottom action bar */
.mobile-toc {
  display: none;
  position: sticky;
  top: var(--mobile-bar-h);
  z-index: 90;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-default);
  padding: 8px 12px;
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
}

.mobile-toc a {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-2);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  min-height: 36px;
}

.mobile-toc a:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.guide-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 95;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  margin: var(--space-6) calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border-default);
  backdrop-filter: blur(8px);
}

.guide-action-bar a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-action-bar .act-symptom {
  background: var(--bg-warning-soft);
  color: var(--warning-strong);
  border: 1px solid #f6e05e;
}

.guide-action-bar .act-print {
  background: var(--bg-critical-soft);
  color: var(--critical-strong);
  border: 1px solid #feb2b2;
}

.guide-action-bar .act-report {
  background: var(--bg-subtle);
  color: var(--fg-2);
  border: 1px solid var(--border-default);
}

/* Sticky symptom filters on mobile */
@media (max-width: 1100px) {
  .symptom-filters {
    position: sticky;
    top: var(--mobile-bar-h);
    z-index: 80;
  }

  .filter-chip {
    min-height: 40px;
    padding: 8px 14px;
  }
}

.path-card {
  display: block;
  background: var(--bg-raised);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--fg-1);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--brand);
  transition: transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.path-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  color: var(--fg-1);
}

.path-card.tone-critical {
  border-left-color: var(--critical);
}

.path-card.tone-success {
  border-left-color: var(--success);
}

.path-card.tone-warning {
  border-left-color: var(--warning);
}

.path-card.tone-event {
  border-left-color: #d53f8c;
}

.path-emoji {
  font-size: 1.75rem;
  margin-bottom: var(--space-2);
  line-height: 1;
}

.path-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: 2px;
}

.path-plain {
  font-size: var(--text-sm);
  color: var(--fg-3);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.path-desc {
  color: var(--fg-2);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ========== Home page ========== */
.home-body {
  /* Calm reading surface; brand accent bar instead of full purple wash */
  background: var(--bg-base);
  min-height: 100vh;
  padding: var(--space-7) var(--space-4);
  border-top: 6px solid var(--brand);
}

.home-wrap {
  max-width: var(--page-max);
  margin: 0 auto;
}

.home-header,
.home-section,
.home-footer {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

.home-header {
  text-align: center;
}

.home-header h1 {
  margin: 0 0 var(--space-2);
  color: var(--brand);
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.home-tagline {
  font-size: var(--text-lg);
  color: var(--fg-2);
  margin: 0 0 var(--space-3);
}

.home-lead {
  color: var(--fg-2);
  max-width: 42rem;
  margin: var(--space-4) auto 0;
  line-height: 1.65;
  font-size: var(--text-md);
}

.version-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: var(--fg-on-brand);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
}

.home-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.stat {
  text-align: center;
  min-width: 88px;
}

.stat-number {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--fg-3);
  font-size: var(--text-sm);
}

.section-title {
  font-size: var(--text-2xl);
  color: var(--brand);
  margin: 0 0 var(--space-4);
  border-bottom: 3px solid var(--brand);
  padding-bottom: var(--space-3);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-title .plain {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 4px;
}

.section-kicker {
  color: var(--fg-2);
  margin: 0 0 var(--space-4);
  font-size: var(--text-md);
}

.guides-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.guides-table th {
  background: var(--bg-subtle);
  padding: var(--space-3);
  text-align: left;
  font-weight: 700;
  color: var(--fg-1);
  border-bottom: 2px solid var(--border-default);
}

.guides-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-2);
  vertical-align: top;
}

.guides-table a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.guides-table a:hover {
  text-decoration: underline;
}

.guides-table tr:hover td {
  background: #fafbff;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.table-scroll .guides-table {
  min-width: 520px;
}

.cat-heading {
  color: var(--brand);
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
}

.cat-heading .plain {
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

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

.btn-brand {
  background: var(--brand);
  color: var(--fg-on-brand);
}

.btn-brand:hover {
  background: var(--brand-hover);
  color: var(--fg-on-brand);
}

.btn-success {
  background: var(--success);
  color: var(--fg-on-brand);
}

.btn-success:hover {
  background: var(--success-strong);
  color: var(--fg-on-brand);
}

.btn-dark {
  background: var(--fg-1);
  color: var(--fg-on-brand);
}

.btn-dark:hover {
  background: #2d3748;
  color: var(--fg-on-brand);
}

.btn-critical {
  background: #d53f8c;
  color: var(--fg-on-brand);
}

/* home-paths-label defined with primary-paths block above */

.home-footer {
  text-align: center;
}

.home-footer p {
  color: var(--fg-2);
  margin: 8px 0;
}

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--brand);
  color: var(--fg-on-brand);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-med), visibility var(--dur-med),
    background var(--dur-fast);
  z-index: 1000;
  border: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--brand-deep);
}

.tool-card {
  padding: var(--space-4);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}

.tool-card h4 {
  margin: 0 0 var(--space-2);
  color: var(--brand);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

/* ========== Guide / docs layout ========== */
.docs-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--fg-1);
}

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-raised);
  border-right: 1px solid var(--border-default);
  position: fixed;
  left: 0;
  top: 0;
  padding: var(--space-6) var(--space-4);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  display: block;
  margin-bottom: var(--space-5);
  letter-spacing: -0.02em;
}

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

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}

.nav-section,
.nav-group {
  margin-bottom: var(--space-5);
}

.nav-title,
.nav-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-2);
}

.nav-label .plain,
.nav-title .plain {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--fg-3);
}

.guide-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-nav-list li {
  margin-bottom: 2px;
}

.guide-nav-list a,
.nav-link {
  display: block;
  padding: 7px 10px;
  font-size: var(--text-sm);
  color: var(--fg-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  line-height: 1.35;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.guide-nav-list a:hover,
.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--brand);
}

.nav-link.active {
  background: var(--bg-brand-soft);
  color: var(--brand);
  font-weight: 600;
}

#toc-container {
  list-style: none;
  margin: 0;
  padding: 0;
}

#toc-container li {
  margin-bottom: 8px;
}

#toc-container a {
  font-size: var(--text-sm);
  color: var(--fg-2);
  text-decoration: none;
  display: block;
  line-height: 1.4;
}

#toc-container a:hover {
  color: var(--brand);
}

#toc-container .toc-h2 {
  font-weight: 600;
}

#toc-container .toc-h3 {
  padding-left: 12px;
  font-size: var(--text-xs);
  color: var(--fg-3);
}

.main-content {
  margin-left: var(--sidebar-w);
  padding: var(--space-8) var(--space-8);
  flex: 1;
  background: var(--bg-raised);
  min-height: 100vh;
  width: 100%;
}

.guide-container,
.docs-container {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Markdown content typography */
.guide-container h1,
.docs-container h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--fg-1);
  margin: 0 0 var(--space-5);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.guide-container h2,
.docs-container h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--fg-1);
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 10px;
}

.guide-container h3,
.docs-container h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg-2);
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

.guide-container p,
.docs-container p,
.guide-container li,
.docs-container li {
  font-size: var(--text-lg);
  color: var(--fg-2);
  margin-bottom: var(--space-3);
}

.guide-container ul,
.guide-container ol,
.docs-container ul,
.docs-container ol {
  margin-bottom: var(--space-5);
  padding-left: 1.4em;
}

.guide-container table,
.docs-container table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-5) 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: var(--text-base);
}

.guide-container th,
.docs-container th {
  background: var(--bg-subtle);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  font-weight: 700;
  color: var(--fg-2);
}

.guide-container td,
.docs-container td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-2);
}

.guide-container tr:last-child td,
.docs-container tr:last-child td {
  border-bottom: none;
}

.guide-container blockquote,
.docs-container blockquote {
  border-left: 5px solid var(--brand);
  background: var(--bg-info-soft);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: #2a4365;
}

.guide-container hr,
.docs-container hr {
  border: 0;
  border-top: 2px solid var(--border-subtle);
  margin: var(--space-7) 0;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-default);
  font-size: var(--text-xs);
  color: var(--fg-3);
}

.sidebar-foot a {
  color: var(--brand);
  text-decoration: none;
}

/* Mobile chrome */
.mobile-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bar-h);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-default);
  z-index: 200;
  align-items: center;
  padding: 0 var(--space-3);
  gap: var(--space-3);
}

.mobile-bar-title {
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  font-size: var(--text-md);
}

.menu-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--fg-1);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 32, 44, 0.45);
  z-index: 150;
}

body.nav-open .sidebar-backdrop {
  display: block;
}

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

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .path-card:hover,
  .btn:hover {
    transform: none;
  }
}

/* Responsive: docs */
@media (max-width: 1100px) {
  .mobile-bar {
    display: flex;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform var(--dur-med) var(--ease-out);
    z-index: 180;
    box-shadow: var(--shadow-md);
  }

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

  .main-content {
    margin-left: 0;
    padding: calc(var(--mobile-bar-h) + 24px) var(--space-4) var(--space-6);
  }
}

@media (max-width: 768px) {
  .home-body {
    padding: var(--space-4) var(--space-3);
  }

  .home-header,
  .home-section,
  .home-footer {
    padding: var(--space-5);
  }

  .home-header h1 {
    font-size: 1.75rem;
  }

  .home-stats {
    gap: var(--space-4);
  }

  .path-grid,
  .path-grid.primary-paths {
    grid-template-columns: 1fr;
  }

  .path-grid.primary-paths .path-card {
    min-height: 0;
  }

  /* Guide library: card stack instead of horizontal tables */
  .table-scroll {
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .guides-table {
    min-width: 0 !important;
    border: 0;
  }

  .guides-table thead {
    display: none;
  }

  .guides-table tr {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
  }

  .guides-table tr:hover td {
    background: transparent;
  }

  .guides-table td {
    display: block;
    border: 0;
    padding: 2px 0;
  }

  .guides-table td:first-child {
    font-size: var(--text-md);
    margin-bottom: 4px;
  }

  .guides-table td:nth-child(2) {
    color: var(--fg-2);
    font-size: var(--text-sm);
    line-height: 1.45;
  }

  .guides-table td:nth-child(3) {
    margin-top: 6px;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
  }

  .guides-table td:nth-child(3)::before {
    content: "⏱ ";
  }

  .mobile-toc {
    display: block;
  }

  .main-content {
    padding-bottom: 88px;
  }

  .guide-action-bar {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    margin-bottom: calc(-1 * var(--space-6));
  }
}

@media (min-width: 1101px) {
  .guide-action-bar {
    margin-left: 0;
    margin-right: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .mobile-toc {
    display: none !important;
  }
}

/* Print */
@media print {
  .sidebar,
  .mobile-bar,
  .back-to-top,
  .sidebar-backdrop,
  .menu-toggle,
  .guide-action-bar,
  .mobile-toc {
    display: none !important;
  }

  .main-content {
    margin: 0;
    padding: 0;
  }
}
