/* =============================================================
   MMSx Biomechanics Decision Documents
   Stylesheet v11.0 — Editorial / Research-Institute aesthetic
   Mobile-first · Light + Dark themes · RTL-aware
   ============================================================= */

/* -------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------- */
:root {
  /* Brand palette */
  --navy:        #0f2341;
  --navy-deep:   #070d18;
  --navy-soft:   #1a2c4d;
  --gold:        #c9a84c;
  --gold-bright: #d9b85a;
  --cream:       #f8f6f0;
  --cream-warm:  #f1ede2;

  /* Typography */
  --serif: 'EB Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans:  'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Light theme (default) */
  --bg:           #faf8f3;
  --bg-elev:      #ffffff;
  --bg-sunken:    #f1ede2;
  --surface:      #ffffff;
  --surface-2:    #fbf9f4;
  --ink:          #0f2341;
  --ink-2:        #2c3a55;
  --ink-soft:     #5a6478;
  --ink-mute:     #8590a3;
  --line:         #e3dccb;
  --line-soft:    #efeadc;
  --accent:       #0f2341;
  --accent-on:    #ffffff;
  --gold-on:      #6a5512;
  --highlight:    #fff7dc;
  --highlight-2:  #f4ead0;
  --shadow-sm:    0 1px 2px rgba(15, 35, 65, 0.06);
  --shadow-md:    0 10px 30px rgba(15, 35, 65, 0.08);
  --shadow-lg:    0 24px 60px rgba(15, 35, 65, 0.12);
  --topbar-bg:    rgba(15, 35, 65, 0.96);
  --topbar-ink:   #f8f6f0;

  /* Geometry */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --maxw:      1200px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur:  220ms;
}

[data-theme="dark"] {
  --bg:           #07101f;
  --bg-elev:      #0d1a2e;
  --bg-sunken:    #050a14;
  --surface:      #0e1b2f;
  --surface-2:    #14243d;
  --ink:          #f3ead4;
  --ink-2:        #d8d0bd;
  --ink-soft:     #9ba5b8;
  --ink-mute:     #6b7689;
  --line:         #1f3050;
  --line-soft:    #182740;
  --accent:       #c9a84c;
  --accent-on:    #0a1525;
  --gold-on:      #c9a84c;
  --highlight:    #1d2c47;
  --highlight-2:  #243558;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:    0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 24px 60px rgba(0, 0, 0, 0.7);
  --topbar-bg:    rgba(7, 13, 24, 0.94);
  --topbar-ink:   #f3ead4;
}

/* -------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 60%),
    radial-gradient(900px 700px at -10% 20%, color-mix(in srgb, var(--navy) 6%, transparent), transparent 60%),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img, svg { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); color: var(--ink); }

/* -------------------------------------------------------------
   3. TOP BAR
   ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--topbar-bg);
  color: var(--topbar-ink);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 25%, transparent);
}
.topbar-inner {
  width: min(var(--maxw), 100% - 2rem);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  min-height: 52px;
}
.topbar-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--topbar-ink);
  flex: 0 1 auto;
  min-width: 0;
}
.topbar-mark:hover { color: var(--gold-bright); }
.topbar-mark-rule {
  display: inline-block;
  width: 18px; height: 2px;
  background: var(--gold);
  flex: 0 0 auto;
}
.topbar-mark-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .topbar-mark-text {
    /* On very narrow screens, abbreviate */
    font-size: 12px;
    letter-spacing: 0.06em;
  }
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  color: var(--topbar-ink);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.theme-toggle:hover { background: color-mix(in srgb, var(--gold) 15%, transparent); border-color: var(--gold); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Language pill */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  background: color-mix(in srgb, #000 25%, transparent);
}
.lang-btn {
  min-width: 34px; height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--topbar-ink) 70%, transparent);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.lang-btn[data-lang="hi"],
.lang-btn[data-lang="ar"] { font-size: 14px; }
.lang-btn:hover { color: var(--topbar-ink); }
.lang-btn.is-active {
  background: var(--gold);
  color: #1a1304;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 6px rgba(0,0,0,.2);
}

/* -------------------------------------------------------------
   4. PAGE CONTAINER
   ------------------------------------------------------------- */
.page {
  width: min(var(--maxw), calc(100% - 2rem));
  margin: 0 auto;
  padding: 28px 0 80px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* -------------------------------------------------------------
   5. HERO
   ------------------------------------------------------------- */
.hero {
  text-align: left;
  padding: 16px 0 28px;
  max-width: 880px;
}
.hero-rule {
  width: 56px; height: 3px;
  background: var(--gold);
  margin-bottom: 22px;
}
.hero-eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hero-title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.hero-lead {
  margin: 0 0 22px;
  max-width: 65ch;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.65;
  color: var(--ink-2);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  font-feature-settings: "tnum" 1;
}
.hero-meta strong { color: var(--ink); font-weight: 700; }
.hero-meta .sep { color: var(--gold); }

/* -------------------------------------------------------------
   6. TOOLBAR (search command bar)
   ------------------------------------------------------------- */
.toolbar {
  position: sticky;
  top: calc(52px + env(safe-area-inset-top));
  z-index: 30;
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toolbar.is-pinned { box-shadow: var(--shadow-md); }
.toolbar-search {
  position: relative;
  display: flex;
  align-items: center;
}
.toolbar-search-icon {
  position: absolute;
  inset-inline-start: 16px;
  width: 18px; height: 18px;
  color: var(--ink-soft);
  pointer-events: none;
}
.toolbar-search input {
  width: 100%;
  height: 52px;
  padding-inline: 44px 16px;
  font-size: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.toolbar-search input::placeholder { color: var(--ink-mute); }
.toolbar-search input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 20%, transparent);
}

.toolbar-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.toolbar-select {
  position: relative;
  display: flex;
  align-items: center;
}
.toolbar-select select {
  width: 100%;
  height: 48px;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 40px 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-weight: 500;
  font-size: 14.5px;
  outline: none;
  cursor: pointer;
}
.toolbar-select select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 20%, transparent);
}
.toolbar-select svg {
  position: absolute;
  inset-inline-end: 14px;
  width: 16px; height: 16px;
  color: var(--ink-soft);
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 90%, var(--gold) 10%);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--gold); }
.btn-outline {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--bg-elev));
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 30%, transparent);
}

/* Mobile: icon-only buttons for refresh/print to save space */
@media (max-width: 600px) {
  .btn-ghost .btn-label,
  .btn-outline .btn-label { display: none; }
  .btn-ghost, .btn-outline { width: 48px; padding: 0; flex: 0 0 auto; }
}

/* -------------------------------------------------------------
   7. POPULAR COMPARISONS
   ------------------------------------------------------------- */
.popular-wrap {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.popular-head {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.popular-comparisons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.popular-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: start;
  min-height: 56px;
  padding: 12px 16px 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.3;
  transition: all var(--dur) var(--ease);
  overflow: hidden;
}
.popular-chip::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--gold);
  transform: scaleY(0.3);
  transform-origin: center;
  transition: transform var(--dur) var(--ease);
}
.popular-chip:hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--bg-elev));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.popular-chip:hover::before { transform: scaleY(1); }
.popular-chip.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--gold) 12%, var(--bg-elev));
}
.popular-chip.is-active::before { transform: scaleY(1); }

/* -------------------------------------------------------------
   8. MOBILE INDEX TOGGLE
   ------------------------------------------------------------- */
.index-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
}
.index-toggle svg { width: 18px; height: 18px; transition: transform var(--dur) var(--ease); }
.index-toggle.is-open svg { transform: rotate(180deg); }

/* -------------------------------------------------------------
   9. CONTENT: INDEX + DETAIL
   ------------------------------------------------------------- */
.content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* Mobile: index pane is collapsible */
.results-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-height: 0;
  visibility: hidden;
  transition: max-height var(--dur) var(--ease);
}
.results-pane.is-open {
  max-height: 70vh;
  visibility: visible;
  overflow-y: auto;
}

.pane-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--gold) 4%, var(--surface));
}
.pane-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pane-head p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.results-list { display: grid; }
.result-btn {
  display: block;
  width: 100%;
  text-align: start;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 16px 20px;
  transition: background var(--dur) var(--ease);
  color: var(--ink);
}
.result-btn:hover { background: var(--surface-2); }
.result-btn.active {
  background: color-mix(in srgb, var(--gold) 10%, var(--surface));
  box-shadow: inset 4px 0 0 var(--gold);
}
[dir="rtl"] .result-btn.active {
  box-shadow: inset -4px 0 0 var(--gold);
}
.result-id {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.result-title {
  margin: 8px 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.result-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.result-chip, .eyebrow span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--navy) 7%, var(--surface));
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
}
.related-chip {
  background: color-mix(in srgb, var(--gold) 18%, var(--surface));
  color: var(--gold-on);
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
}
.result-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}
.empty-state, .detail-empty { padding: 32px 24px; color: var(--ink-soft); }

/* -------------------------------------------------------------
   10. DETAIL PANE
   ------------------------------------------------------------- */
.detail-pane { min-width: 0; }
.detail-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-width: 0;
}
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 14px;
}
.detail-empty-mark {
  width: 64px; height: 64px;
  color: var(--gold);
  opacity: 0.55;
}
.detail-empty-eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.detail-empty-lead {
  margin: 0;
  max-width: 46ch;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* Comparison content (rendered by app.js) */
.comparison-top {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--gold) 4%, var(--surface));
}
.brand-mark { width: 56px; height: 56px; object-fit: contain; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.eyebrow span {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
  line-height: 1.3;
}
.comparison-meta h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.comparison-meta p {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.detail-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px 0;
  flex-wrap: wrap;
}
.detail-actions .action-btn,
.detail-actions .copy-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--sans);
  transition: all var(--dur) var(--ease);
}
.detail-actions .action-btn:hover,
.detail-actions .copy-btn:hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--bg-elev));
}

/* Tables */
.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding: 20px;
}
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td {
  text-align: start;
  vertical-align: top;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.55;
  font-size: 14.5px;
  color: var(--ink-2);
}
th {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-2);
}
td:first-child {
  width: 26%;
  color: var(--ink);
  font-weight: 600;
  background: color-mix(in srgb, var(--gold) 5%, var(--surface));
}

/* Cards inside comparison */
.graph-wrap, .card, .meta-card {
  margin: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.graph-kicker, .meta-eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.section-title, .card h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.graph-sub, .graph-note, .graph-evidence,
.section-copy, .program-note, .card p {
  color: var(--ink-2);
  line-height: 1.65;
}
.graph-canvas-wrap {
  height: 330px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface);
}
.print-chart-img { display: none; width: 100%; height: auto; }
.section-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 18px; }
.mini-title {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.list-block { margin: 0; padding-inline-start: 20px; color: var(--ink-2); line-height: 1.7; }
.list-block li { margin-bottom: 6px; }
.decision-tail { margin-top: 20px; }
.document-meta { display: grid; grid-template-columns: 1fr; gap: 0; }
.citation-text { font-size: 13px; color: var(--ink-2); }
.cc-badge { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--ink); }
.cc-circle, .cc-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px; height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  background: var(--surface);
}

/* -------------------------------------------------------------
   11. FOOTER
   ------------------------------------------------------------- */
.site-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.site-footer a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.site-footer a:hover { color: var(--accent); }

/* =============================================================
   12. PRINT — gold-standard rules preserved from the
       Eccentric Landmine Squat PDF baseline.
       Restores: running header + footer + watermark, single
       muscle chart, proper page-break handling, no hero/topbar
       on printed pages, dark-mode safe.
   ============================================================= */
.print-running-header, .print-running-footer { display: none; }

.print-watermark {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}
.print-watermark img { width: 76%; max-width: 760px; opacity: 0.10; }

@media print {
  /* Force light-mode variables on paper, regardless of on-screen theme */
  :root,
  [data-theme="dark"] {
    --bg: #ffffff;
    --bg-elev: #ffffff;
    --bg-sunken: #ffffff;
    --surface: #ffffff;
    --surface-2: #fbf9f4;
    --ink: #0f2341;
    --ink-2: #2c3a55;
    --ink-soft: #5a6478;
    --ink-mute: #8590a3;
    --line: #d7dce5;
    --line-soft: #efeadc;
    --accent: #0f2341;
    --highlight: #fff7dc;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
  }

  /* ----- Page setup -----
     Margins reverted to the proven working geometry (32mm top, 26mm bottom
     same as the gold-standard landmine-squat PDF). Running header & footer
     written into the margin zones via CSS Paged Media margin boxes — this
     is the spec-compliant way and renders correctly in modern Chrome
     print-to-PDF without overlapping body content. Static text only — no
     string-set, no @top-center; those caused layout regressions. */
  @page {
    size: A4;
    margin: 32mm 15mm 26mm;

    @top-left {
      content: "MMSx Authority Institute";
      font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 8.5pt;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #0f2341;
      vertical-align: bottom;
      padding-bottom: 6mm;
    }
    @top-right {
      content: "Page " counter(page);
      font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 8.5pt;
      font-weight: 700;
      color: #0f2341;
      vertical-align: bottom;
      padding-bottom: 6mm;
    }
    @bottom-left {
      content: "MMSx Authority Institute for Movement Mechanics & Biomechanics Research";
      font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
      font-size: 8pt;
      font-style: italic;
      color: #586174;
      vertical-align: top;
      padding-top: 6mm;
    }
    @bottom-right {
      content: "mmsxauthority.org";
      font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 8pt;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: #586174;
      vertical-align: top;
      padding-top: 6mm;
    }
  }

  html, body { background: #fff !important; }
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #0f2341 !important;
    font-family: var(--sans);
  }
  .page { width: 100%; margin: 0; padding: 0; }

  /* Hide all on-screen chrome */
  .topbar,
  .hero,
  .toolbar,
  .popular-wrap,
  .results-pane,
  .index-toggle,
  .site-footer,
  .detail-actions,
  canvas { display: none !important; }

  /* Hide the legacy JS-injected running-header/footer divs;
     @page margin boxes now provide the header/footer on every page. */
  .print-running-header,
  .print-running-footer { display: none !important; }

  .content { display: block; }
  .detail-pane,
  .detail-shell { display: block; border: 0; box-shadow: none; overflow: visible; background: #fff; }
  .detail-shell { position: relative; padding: 2mm 0 3mm; }

  /* Watermark (low-opacity logo) */
  .print-watermark { display: flex; }

  /* Forced page-break helper used by app.js */
  .print-page-break {
    break-before: page;
    page-break-before: always;
    padding-top: 5mm !important;
  }
  .section-block.print-page-break,
  .section-grid.print-page-break,
  .graph-wrap.print-page-break { margin-top: 0 !important; }

  /* Allow tables, .comparison-top, and the body in general to flow naturally
     across page boundaries. ONLY protect smaller logical units from being
     split (individual rows, individual cards, the graph wrap).
     Including <table> in this list pushed the whole feature table off page 1,
     leaving it mostly blank. Removed for that reason. */
  .card, .graph-wrap, .meta-card, tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* Keep header logo + title together with the intro paragraph */
  .comparison-top { break-inside: avoid; page-break-inside: avoid; break-after: auto; }
  /* Tables MUST be allowed to break across pages */
  table { break-inside: auto; page-break-inside: auto; }
  thead { display: table-header-group; } /* repeat header on each page */
  tfoot { display: table-footer-group; }

  /* Comparison header */
  .comparison-top {
    grid-template-columns: 48px 1fr;
    gap: 10px;
    padding: 2mm 0 9mm;
    border-bottom: 0;
    background: transparent !important;
  }
  .brand-mark { width: 42px; height: 42px; }
  .eyebrow { gap: 4px; margin-bottom: 5px; }
  .eyebrow span {
    font-size: 8.5px;
    min-height: auto;
    padding: 2px 5px;
    background: transparent;
    border: 0.5pt solid #d7dce5;
    color: #2c3a55;
    font-family: var(--mono);
    letter-spacing: 0.04em;
  }
  .comparison-meta h2 {
    font-size: 20px;
    line-height: 1.14;
    font-family: var(--serif);
    color: #0f2341;
    font-weight: 500;
  }
  .comparison-meta p { font-size: 10.5px; line-height: 1.45; margin-top: 5px; color: #2c3a55; }

  /* Tables */
  .table-wrap { padding: 0; overflow: visible; }
  table { min-width: 0; font-size: 9.5px; }
  th, td { padding: 7px 8px; line-height: 1.35; color: #2c3a55; }
  th {
    font-size: 9px;
    color: #0f2341;
    font-family: var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: #fbf9f4;
  }
  td:first-child {
    width: 24%;
    color: #0f2341;
    font-weight: 700;
    background: #faf6e8;
    font-family: var(--sans);
  }

  /* Cards / blocks */
  .graph-wrap, .card, .meta-card {
    margin: 0 0 8mm;
    padding: 8mm 7mm;
    border-radius: 8px;
    position: relative;
    z-index: 1;
    background: #fff;
    border: 0.5pt solid #d7dce5;
  }
  .section-grid { display: block; }
  .section-grid .card + .card { margin-top: 6mm; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 8mm; }
  .section-title, .card h3 {
    font-size: 15px;
    margin-bottom: 5px;
    font-family: var(--serif);
    color: #0f2341;
    font-weight: 500;
  }
  .graph-sub, .graph-note, .graph-evidence,
  .section-copy, .program-note,
  .card p, .list-block { font-size: 10px; line-height: 1.45; color: #2c3a55; }
  .mini-title { font-size: 8.5px; color: #0f2341; font-family: var(--mono); }
  .graph-kicker, .meta-eyebrow { font-family: var(--mono); color: #c9a84c; }

  /* Single muscle graph (canvas hidden globally above; show static image) */
  .graph-canvas-wrap { height: auto; padding: 0; border: 0; background: transparent; }
  .print-chart-img { display: block !important; max-height: 74mm; object-fit: contain; width: 100%; height: auto; }

  .document-meta { display: block; }
  .citation-text { font-size: 10px; color: #2c3a55; }
  .cc-circle, .cc-version { border-color: #d7dce5; }

  a { color: inherit; text-decoration: underline; }

  /* V9 watermark hard-override: ensure logo renders behind every page */
  .print-watermark {
    display: flex !important;
    position: fixed !important;
    inset: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    z-index: 20 !important;
    opacity: 1 !important;
    background: transparent !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-watermark img {
    display: block !important;
    width: 170mm !important;
    max-width: 82% !important;
    max-height: 82% !important;
    object-fit: contain !important;
    opacity: 0.052 !important;
    filter: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-running-header,
  .print-running-footer { z-index: 9999 !important; }
}

/* -------------------------------------------------------------
   13. TABLET BREAKPOINT (≥ 640px)
   ------------------------------------------------------------- */
@media (min-width: 640px) {
  .page { padding-top: 36px; }
  .hero { padding: 28px 0 36px; }
  .toolbar-row {
    grid-template-columns: 1fr auto auto auto;
  }
  .popular-comparisons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-meta { grid-template-columns: 1.2fr 1fr; }
  .section-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .comparison-top { grid-template-columns: 78px 1fr; gap: 22px; padding: 28px; }
  .brand-mark { width: 78px; height: 78px; }
}

/* -------------------------------------------------------------
   14. DESKTOP BREAKPOINT (≥ 960px)
   ------------------------------------------------------------- */
@media (min-width: 960px) {
  .topbar-mark { font-size: 14px; }
  .hero { padding: 40px 0 48px; }
  .hero-rule { width: 72px; height: 4px; }
  .hero-meta { font-size: 14px; }
  .popular-comparisons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .index-toggle { display: none; }
  .content {
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 22px;
  }
  .results-pane {
    max-height: calc(100vh - 140px);
    visibility: visible;
    overflow-y: auto;
    position: sticky;
    top: calc(72px + 116px);
  }
}

/* -------------------------------------------------------------
   15. WIDE BREAKPOINT (≥ 1200px)
   ------------------------------------------------------------- */
@media (min-width: 1200px) {
  .hero-title { font-size: clamp(48px, 5.5vw, 72px); }
  .content { grid-template-columns: 400px minmax(0, 1fr); }
}

/* -------------------------------------------------------------
   16. RTL ADJUSTMENTS (body[dir="rtl"] is set by app.js for Arabic)
   ------------------------------------------------------------- */
[dir="rtl"] .topbar-mark-rule {
  /* keep gold rule on the same side it visually anchors */
}
[dir="rtl"] .popular-chip::before {
  inset-inline-start: auto;
  inset-inline-end: 0;
}
[dir="rtl"] .toolbar-search-icon { left: auto; right: 16px; }
[dir="rtl"] .toolbar-search input { padding: 0 44px 0 16px; }
[dir="rtl"] .toolbar-select svg { right: auto; left: 14px; }
[dir="rtl"] .hero,
[dir="rtl"] .hero-title,
[dir="rtl"] .hero-lead {
  text-align: right;
}
[dir="rtl"] .hero-title {
  /* Arabic looks better slightly less tight */
  letter-spacing: 0;
}

/* -------------------------------------------------------------
   17. FOCUS RING (accessibility — visible only for keyboard)
   ------------------------------------------------------------- */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 65%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* -------------------------------------------------------------
   18. REDUCED MOTION
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}