/* ---------- Tokens ---------- */
:root {
  --green-deep: #0d3e32;
  --green-800:  #134b3d;
  --green-700:  #1a5a4a;
  --green-500:  #37876f;
  --green-accent: #d4b673;
  --amber:       #e6a23c;
  --red:         #c2594a;
  --paper:       #f5f2eb;
  --paper-2:     #ece8dd;
  --ink:         #1a1a1a;
  --ink-2:       #3b3b3b;
  --muted:       #8a8a85;
  --line:        #d9d2c0;
  --card:        #fffdf8;
  --radius-lg:   14px;
  --radius-md:   10px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 18px rgba(15,50,40,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper) url("assets/brand/paper_texture.webp");
  background-size: 1024px auto;
  background-repeat: repeat;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 44px; line-height: 1.02; color: var(--green-deep); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.muted { color: var(--muted); font-size: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--green-deep);
  color: #f6efdd;
  border-bottom: 1px solid var(--green-800);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px; font-weight: 600;
}
.brand-mark-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.brand-mkhs { font-weight: 700; color: var(--green-accent); letter-spacing: 0.04em; }
.top-nav { display: flex; gap: 24px; margin-left: 16px; font-size: 13px; }
.top-nav a { color: rgba(246,239,221,0.75); cursor: pointer; padding: 6px 2px; border-bottom: 2px solid transparent; text-decoration: none; }
.top-nav a.active { color: var(--green-accent); border-bottom-color: var(--green-accent); }
.top-nav a:hover { color: #f6efdd; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.lang-switch { display: inline-flex; background: rgba(255,255,255,0.06); border: 1px solid rgba(246,239,221,0.2); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer;
  background: transparent; color: rgba(246,239,221,0.7); border: none;
  letter-spacing: 0.05em; font-weight: 500;
}
.lang-switch button.active { background: var(--green-accent); color: var(--green-deep); font-weight: 700; }
.lang-switch button:hover:not(.active) { color: #f6efdd; }
.btn-ghost, .btn-primary {
  font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; letter-spacing: 0.01em;
}
.btn-ghost { background: transparent; color: #f6efdd; border-color: rgba(246,239,221,0.25); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }
.btn-primary { background: var(--green-accent); color: var(--green-deep); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.05); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 52px);
}
.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  height: calc(100vh - 52px);
  position: sticky; top: 52px;
}
.sidebar-header { display: flex; align-items: baseline; justify-content: space-between; padding: 20px 20px 6px; }
.search-wrap { padding: 0 20px 12px; }
.search-wrap input {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.search-wrap input:focus { outline: 2px solid var(--green-500); outline-offset: -1px; border-color: var(--green-500); }

.horse-list { list-style: none; margin: 0; padding: 0 8px 20px; overflow-y: auto; flex: 1; }
.horse-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; margin: 3px 0; border-radius: var(--radius-md);
  cursor: pointer; position: relative;
  transition: background 140ms ease, transform 140ms ease;
}
.horse-item:hover { background: rgba(255,255,255,0.65); transform: translateX(2px); }
.horse-item.active {
  background: #fff;
  box-shadow: 0 2px 10px rgba(13,60,50,0.06);
  outline: 1px solid var(--line);
}
.horse-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; background: var(--green-accent); border-radius: 3px;
}
.horse-thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 50%;
  border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(13,60,50,0.12);
}
.horse-meta { min-width: 0; }
.horse-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -0.005em; }
.horse-sub {
  font-size: 11px; color: var(--muted); margin-top: 2px; display: inline-flex; align-items: center; gap: 6px;
  text-transform: lowercase;
}
.horse-sub .gait-pip { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green-500); }
.horse-sub .gait-pip.trot { background: #c2871a; }
.horse-sub .gait-pip.canter, .horse-sub .gait-pip.canter_gallop, .horse-sub .gait-pip.gallop { background: #b84931; }
.sev-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.sev-sym { background: #bcd5c9; }
.sev-very-mild { background: #e8d285; }
.sev-mild { background: var(--amber); }
.sev-moderate { background: #d77638; }
.sev-marked { background: var(--red); }

/* ---------- Main content ---------- */
.content {
  padding: 28px 36px 48px;
  max-width: 1280px;
}
.hero-cover {
  position: relative; width: 100%; height: 220px;
  background-size: cover; background-position: center 40%;
  border-radius: var(--radius-lg);
  margin-bottom: -40px; box-shadow: 0 4px 20px rgba(13,60,50,0.14);
  overflow: hidden;
  animation: cardIn 500ms cubic-bezier(.2,.7,.3,1) both;
}
.hero-cover-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(245,242,235,0.2) 65%, var(--paper) 100%);
}
@media (max-width: 800px) { .hero-cover { height: 150px; margin-bottom: -28px; } }

.page-head {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  position: relative; z-index: 1;
}
.page-title.hero { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; }
.hero-portrait { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--card); box-shadow: 0 4px 16px rgba(13,60,50,0.15); }
.page-title h1 { margin-bottom: 2px; }
.page-title .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.page-head .qa { display: flex; gap: 18px; align-items: center; }
.qa-item { text-align: right; }
.qa-num { font-family: 'Fraunces', Georgia, serif; font-size: 22px; line-height: 1.05; color: var(--green-deep); }
.qa-lbl { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Grid sections ---------- */
.grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  animation: cardIn 420ms cubic-bezier(.2, .7, .3, 1) both;
  transition: box-shadow 220ms ease, transform 220ms ease;
}
.card:hover { box-shadow: 0 6px 22px rgba(13,60,50,0.08); }
.page-head { animation: cardIn 380ms cubic-bezier(.2,.7,.3,1) both; }
.card:nth-of-type(1) { animation-delay: 40ms; }
.card:nth-of-type(2) { animation-delay: 110ms; }
.card:nth-of-type(3) { animation-delay: 180ms; }
.card:nth-of-type(4) { animation-delay: 240ms; }
.card:nth-of-type(5) { animation-delay: 300ms; }
.card:nth-of-type(6) { animation-delay: 360ms; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.horse-item { transition: background 120ms ease, outline-color 120ms ease; }
.card h3 { margin-bottom: 14px; }
.card-muted { background: var(--paper-2); border: none; }

/* Overview: horse diagram */
.overview { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.horse-diagram {
  background: linear-gradient(180deg, #fefdf8 0%, #f7f1e1 100%);
  border-radius: var(--radius-md); padding: 12px;
  min-height: 280px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  position: relative;
}
.horse-diagram .horse-img {
  width: 100%; max-width: 380px; height: auto; display: block;
}
.horse-diagram .leg-badges {
  position: absolute; inset: 0; pointer-events: none;
}
.leg-badge {
  position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.16);
  cursor: pointer; transition: transform 120ms ease;
  pointer-events: auto;
}
.leg-badge:hover { transform: scale(1.35); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.leg-badge.none      { background: #b8b09a; color: #fff; opacity: 0.55; }
.leg-badge.very-mild { background: #c2a23c; }
.leg-badge.mild      { background: #d77b1f; }
.leg-badge.moderate  { background: #b94c1f; }
.leg-badge.marked    { background: #9c2e25; }
/* badge positions for the gpt-image-2 horse diagram (left-facing) */
.leg-badge.LF { left: 32%; bottom: 10%; }
.leg-badge.RF { left: 38%; bottom: 14%; }
.leg-badge.LH { left: 70%; bottom: 10%; }
.leg-badge.RH { left: 76%; bottom: 14%; }

/* Findings list */
.findings-list { display: flex; flex-direction: column; gap: 10px; }
.finding {
  display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--paper-2);
}
.finding.none { background: #e1ecda; }
.finding.very-mild { background: #f7eecc; }
.finding.mild { background: #fdddba; }
.finding.moderate { background: #fbc59d; }
.finding.marked { background: #f6bebf; }
.finding-leg {
  width: 42px; height: 42px; border-radius: 10px; background: #fff;
  display: grid; place-items: center;
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 18px;
  color: var(--green-deep); border: 1px solid var(--line);
}
.finding-body { line-height: 1.35; }
.finding-sev { font-weight: 600; font-size: 13px; color: var(--ink); }
.finding-type { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* Polar grid */
.polar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.polar { background: #fbf7ea; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; }
.polar .plot-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; padding: 0 4px; }
.polar .plot-title h4 { color: var(--green-deep); text-transform: none; letter-spacing: 0; font-family: 'Fraunces', serif; font-size: 14px; font-weight: 600; }
.polar canvas { width: 100% !important; display: block; }
.polar-metric { margin-top: 6px; text-align: center; }
.polar-num { font-family: 'Fraunces', Georgia, serif; font-size: 22px; color: var(--green-deep); font-weight: 600; }
.polar-unit { font-size: 11px; color: var(--muted); margin-left: 6px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Videos + frames */
.media-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.video-wrap video { width: 100%; border-radius: var(--radius-md); background: #000; }
.frames { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.frames img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.frames img:hover { transform: scale(1.02); transition: transform 120ms ease; }

/* Metric pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill {
  font-size: 12px; padding: 5px 12px;
  border-radius: 999px; background: var(--paper-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pill.gait-walk { background: #e5f0e6; color: #1b5a3c; border-color: #c2dec8; }
.pill.gait-trot { background: #fbecd4; color: #7b5b14; border-color: #eed8a5; }
.pill.gait-canter, .pill.gait-gallop { background: #f9d8ce; color: #7c2e1d; border-color: #f2b7a6; }
.pill b { font-weight: 600; color: var(--green-deep); }

.stride-plot-img { width: 100%; border-radius: var(--radius-md); cursor: zoom-in; }

/* ----- norm bars / asymmetry badges ----- */
.metrics-grid { grid-template-columns: 0.9fr 1fr 1.2fr; }
@media (max-width: 1100px) { .metrics-grid { grid-template-columns: 1fr; } }
.radar-card .radar-wrap { position: relative; height: 280px; margin-top: 4px; }
@media (max-width: 800px) { .radar-card .radar-wrap { height: 260px; } }

/* ---- Trend history ---- */
.trend-grid { grid-template-columns: 1.6fr 1fr 1fr; }
@media (max-width: 1100px) { .trend-grid { grid-template-columns: 1fr; } }
.trend-card .trend-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.trend-card .trend-wrap { position: relative; height: 240px; margin-top: 10px; }
.trend-empty {
  background: var(--paper-2); border-radius: var(--radius-md);
  padding: 28px 22px; margin-top: 12px; text-align: center;
}
.trend-empty-title { font-family: 'Fraunces', Georgia, serif; font-size: 18px; color: var(--green-deep); margin-bottom: 6px; }
.trend-empty-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; max-width: 420px; margin: 0 auto; }
.trend-stats { display: flex; gap: 18px; }
.ts { display: inline-flex; flex-direction: column; align-items: center; }
.ts-num { font-family: 'Fraunces', serif; font-size: 22px; color: var(--green-deep); font-weight: 600; line-height: 1; }
.ts-lbl { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; margin-top: 2px; }
.trend-arrow.up .ts-num { color: #b84931; }
.trend-arrow.down .ts-num { color: #22663f; }

/* ---- Compensation card ---- */
.comp-alert {
  background: #fceee0; border-left: 3px solid #b84931; padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.comp-head { font-weight: 600; font-size: 13px; color: #7c2e1d; margin-bottom: 4px; }
.comp-text { font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.comp-ok { font-size: 13px; color: #22663f; padding: 10px 12px; background: #e1ecda; border-radius: var(--radius-sm); }

.rhythm { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.rhythm-num { font-family: 'Fraunces', serif; font-size: 24px; color: var(--green-deep); font-weight: 600; }
.rhythm-bar { flex: 1; height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.rhythm-fill { display: block; height: 100%; background: linear-gradient(90deg, #7bbb90, #d8a93f 60%, #b84931); border-radius: 999px; }

/* ---- Notes ---- */
.notes-card { display: flex; flex-direction: column; }
.notes-input { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.notes-input input, .notes-input textarea {
  font: inherit; font-size: 12px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  resize: vertical;
}
.notes-input button { grid-column: span 2; font-size: 12px; padding: 6px 12px; }
.notes-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.note-item { background: var(--paper-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.note-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.note-meta b { color: var(--green-deep); }
.note-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.note-del:hover { color: var(--red); }
.note-text { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }

/* Compare view */
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cmp-card { text-align: center; }
.cmp-select { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 12px; }
.cmp-select label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.cmp-select select {
  font: inherit; font-size: 13px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.cmp-portrait { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; margin: 6px auto; display: block; border: 3px solid var(--card); box-shadow: 0 4px 18px rgba(13,60,50,0.15); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.cmp-table th, .cmp-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.cmp-table th { background: var(--paper-2); font-weight: 600; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; }
.cmp-up { color: #b84931; font-weight: 600; }
.cmp-down { color: #22663f; font-weight: 600; }
.cmp-same { color: var(--muted); }
@media (max-width: 800px) { .cmp-grid { grid-template-columns: 1fr; } }

.ornament {
  height: 28px;
  background-image: url("assets/brand/section_ornament.webp");
  background-repeat: no-repeat; background-position: center;
  background-size: 60% auto;
  opacity: 0.85;
  margin: 18px 0 8px;
}
@media (max-width: 800px) { .ornament { background-size: 100% auto; } }

/* Brand footer */
.brand-footer {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 36px 20px 60px; background: var(--paper-2);
  border-top: 1px solid var(--line);
}
.bf-wordmark { height: 52px; width: auto; opacity: 0.95; margin-bottom: 4px; }
.bf-meta { font-size: 11px; text-align: center; }
.bf-meta a { color: var(--green-deep); text-decoration: underline; }

/* Print / PDF */
@media print {
  .topbar, .sidebar, .top-nav, .top-actions, .hamburger, video, .frames, .hoof-toggles { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .content { max-width: 100%; padding: 0; }
  .card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}
.norm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 6px; }
.norm-leg-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.norm-val { margin: 6px 0 10px; }
.asym-badge {
  display: inline-block; padding: 5px 10px; border-radius: 999px;
  font-weight: 600; font-size: 13px;
}
.badge-norm  { background: #e1ecda; color: #22663f; }
.badge-fine  { background: #edf4e4; color: #415b24; }
.badge-watch { background: #fbecd4; color: #805918; }
.badge-lame  { background: #f9d8ce; color: #7c2e1d; }
.norm-bar {
  position: relative; height: 10px; border-radius: 5px; overflow: hidden;
  background:
    linear-gradient(90deg,
      #7bbb90 0 20%,
      #d8a93f 20% 40%,
      #d8a93f 40% 60%,
      #b84931 60% 80%,
      #b84931 80% 100%);
}
/* Centre line at 0% asym */
.norm-bar::before {
  content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px;
  background: var(--green-deep);
}
.norm-fill {
  position: absolute; top: 2px; bottom: 2px; background: rgba(255,255,255,0.55);
  border-radius: 3px;
}
.norm-tick { position: absolute; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,0.65); }
.norm-tick.healthy { left: 40%; }
.norm-tick.watch   { left: 60%; }
.norm-tick.lame    { left: 80%; }
.norm-px { margin-top: 6px; font-size: 12px; }

.legend-strip {
  margin-top: 16px; display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.legend-strip .lg {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.lg-healthy { background: #7bbb90; }
.lg-watch   { background: #d8a93f; }
.lg-lame    { background: #b84931; }

/* sparklines */
.sparkrow { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.sparkhead { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 2px; }
.sparkhead span:first-child { font-weight: 600; color: var(--ink-2); }
canvas.spark { width: 100%; height: 60px; display: block; }

/* ---- interpretations + help blurbs ---- */
.interp {
  margin-top: 14px; padding: 12px 14px;
  background: #f1ecdd; border-left: 3px solid var(--green-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.interp-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--green-deep); font-weight: 600; margin-bottom: 6px;
}
.interp-body p { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.interp-list { margin: 4px 0 0; padding-left: 16px; }
.interp-list li { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; line-height: 1.45; }

.help {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); line-height: 1.45; font-style: italic;
}

/* Stride toggles: full-width slider switches, one per row */
.hoof-toggles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 0 0 14px; width: 100%;
}
.hoof-switch {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer; user-select: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.hoof-switch:hover { background: #fdfaef; border-color: var(--green-accent); }
.hoof-switch .dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
.hoof-switch .label { font-size: 13px; font-weight: 500; color: var(--ink); }
.hoof-switch .switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.hoof-switch .switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.hoof-switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #d6cfbc; border-radius: 999px;
  transition: background 180ms ease;
}
.hoof-switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px;
  top: 3px; left: 3px; background: #fff; border-radius: 50%;
  transition: transform 180ms ease, background 180ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.hoof-switch input:checked + .slider { background: var(--c); }
.hoof-switch input:checked + .slider::before { transform: translateX(18px); }
.hoof-switch input:not(:checked) ~ .label,
.hoof-switch input:not(:checked) + .label { opacity: 1; }
.hoof-switch:has(input:not(:checked)) { background: #faf6ea; opacity: 0.75; }
.hoof-switch:has(input:not(:checked)) .dot { box-shadow: none; opacity: 0.5; }

.stride-chart-wrap { position: relative; height: 280px; }
@media (max-width: 800px) {
  .hoof-toggles { grid-template-columns: 1fr; gap: 8px; }
  .hoof-switch { padding: 10px 14px; }
  .stride-chart-wrap { height: 220px; }
}

/* ---- hamburger ---- */
.hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: transparent; border: none; cursor: pointer; padding: 6px;
}
.hamburger span {
  width: 22px; height: 2px; background: var(--green-accent); border-radius: 2px;
}

/* ===== Mobile / responsive ===== */
@media (max-width: 1100px) {
  .polar-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .sparkrow { grid-template-columns: 1fr 1fr; }
  .content { padding: 24px 24px 40px; }
}

@media (max-width: 800px) {
  .topbar { padding: 10px 14px; gap: 12px; }
  .hamburger { display: flex; }
  .top-nav { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .btn-ghost { display: none; }
  .top-actions .btn-primary { padding: 6px 10px; font-size: 12px; }
  .brand { font-size: 17px; }
  .brand-mark-img { width: 28px; height: 28px; }

  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 52px; bottom: 0;
    width: 86vw; max-width: 340px;
    transform: translateX(-100%); transition: transform 200ms ease;
    z-index: 50; box-shadow: 4px 0 18px rgba(0,0,0,0.18);
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 16px 14px 28px; }
  h1 { font-size: 30px; }
  .page-head { grid-template-columns: 1fr; gap: 12px; }
  .page-title.hero { grid-template-columns: 76px 1fr; gap: 14px; }
  .hero-portrait { width: 76px; height: 76px; border-width: 2px; }
  .qa { display: flex; gap: 14px; justify-content: flex-start; }
  .qa-item { text-align: left; }
  .qa-num { font-size: 18px; }

  .overview { grid-template-columns: 1fr; gap: 18px; }
  .horse-diagram { min-height: 200px; }
  .polar-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .polar { padding: 8px; }
  .polar .plot-title h4 { font-size: 12px; }
  .polar-num { font-size: 16px; }
  .polar-unit { display: none; }
  .sparkrow { grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .frames { grid-template-columns: repeat(3, 1fr); }
  .norm-row { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 16px; }
  .pills { gap: 6px; }
  .pill { font-size: 11px; padding: 4px 10px; }
}

@media (max-width: 420px) {
  h1 { font-size: 26px; }
  .qa { gap: 10px; }
  .qa-num { font-size: 16px; }
  .frames { grid-template-columns: repeat(2, 1fr); }
  .legend-strip { font-size: 11px; gap: 10px; }
}

/* Lightbox */
.lightbox[hidden] { display: none !important; }
.lightbox {
  position: fixed; inset: 0; background: rgba(13, 30, 26, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 4vh 4vw; backdrop-filter: blur(4px);
}
.lightbox img {
  max-width: 96%; max-height: 96vh;
  border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
#lightbox-close {
  position: absolute; top: 16px; right: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #fff;
  font-size: 28px; line-height: 1; border: none; cursor: pointer;
}
#lightbox-close:hover { background: rgba(255,255,255,0.2); }
#lightbox-caption {
  position: absolute; bottom: 5vh; left: 0; right: 0; text-align: center;
  color: #f6efdd; font-family: 'Fraunces', Georgia, serif; font-size: 16px;
  letter-spacing: 0.02em;
}
