/* v64startlista.se – main stylesheet
   Palette and tokens from design-reference/design-tokens.css */
:root {
  color-scheme: light;
  --navy: #17243d;
  --navy-2: #22334f;
  --ice: #f4f7fb;
  --coral: #ff765f;
  --coral-2: #f0644d;
  --sky: #dceaf4;
  --sky-2: #e9f1f8;
  --muted: #5b6b82;
  --line: #d8e2ef;
  --card: #fff;
  --link: #0f5fa8;
  --focus: #126cba;
  --radius: 8px;
  --page-max: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --font: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(23, 36, 61, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--navy);
  background: var(--ice);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
svg { display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { line-height: 1.1; font-weight: 800; letter-spacing: -.03em; margin: 0 0 .4em; }
h1 { font-size: clamp(34px, 4.7vw, 64px); }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: clamp(20px, 2vw, 24px); }
h4 { font-size: 18px; }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
input, select { font: inherit; }
ul, ol { margin: 0; padding: 0; }
.list-reset { list-style: none; }

.container { width: min(calc(100% - 2 * var(--gutter)), var(--page-max)); margin-inline: auto; }
.section { padding-block: 32px; }
.section-tight { padding-block: 16px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.number, .distance, .payout, .tabular { font-variant-numeric: tabular-nums; }
.eyebrow {
  display: block; margin-bottom: 10px; color: var(--coral-2);
  font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.eyebrow-muted { color: var(--muted); }
.lead { font-size: clamp(18px, 2vw, 22px); color: var(--muted); max-width: 40ch; }

/* Skip link */
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 10px 14px; background: var(--coral); color: var(--navy); border-radius: var(--radius); font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header { color: #fff; background: var(--navy); position: relative; z-index: 20; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.brand svg { width: 42px; height: 28px; }
.brand:focus-visible { outline-color: var(--coral); }
.site-nav ul { display: flex; gap: 8px; list-style: none; }
.site-nav a {
  display: inline-block; padding: 22px 12px 18px; color: #fff; text-decoration: none; font-weight: 700;
  border-bottom: 4px solid transparent;
}
.site-nav a:hover { border-bottom-color: rgba(255, 255, 255, .5); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--coral); }
.site-nav a[aria-current="page"]::after { content: ""; }
.site-nav a:focus-visible { outline-color: var(--coral); outline-offset: -4px; }
.menu-toggle {
  display: none; align-items: center; justify-content: center; width: 48px; height: 48px;
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: var(--radius);
}
.menu-toggle svg { width: 26px; height: 26px; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle:focus-visible { outline-color: var(--coral); }

/* Footer */
.site-footer { color: #fff; background: var(--navy); margin-top: 40px; padding-block: 28px; }
.site-footer .container { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
.site-footer nav ul { display: flex; gap: 20px; list-style: none; justify-content: center; flex-wrap: wrap; }
.site-footer a { color: #fff; }
.site-footer nav a { text-decoration: none; font-weight: 600; }
.site-footer nav a:hover { text-decoration: underline; }
.site-footer a:focus-visible { outline-color: var(--coral); }
.footer-meta { text-align: right; font-size: 14px; line-height: 1.5; border-left: 1px solid rgba(255, 255, 255, .25); padding-left: 24px; }
.footer-note { grid-column: 1 / -1; color: rgba(255, 255, 255, .78); font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 14px; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--radius); font-weight: 750;
  text-decoration: none; border: 1px solid transparent; transition: background-color .18s, border-color .18s, transform .18s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--coral); color: var(--navy); }
.btn-primary:hover { background: var(--coral-2); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--sky-2); }
.btn-soft { background: var(--sky); color: var(--navy); }
.btn-soft:hover { background: #cfe1ef; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.text-link { font-weight: 700; }
.external::after {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .3em; vertical-align: -.05em;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Cards */
.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.card-flush { padding: 0; overflow: hidden; }
.card-head { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.card-body { padding: 24px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 24px; border-top: 1px solid var(--line); }
.card-soft { background: var(--sky-2); border-color: var(--sky); }
.stack > * + * { margin-top: 16px; }

/* Badges / chips */
.badge {
  display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--sky); color: var(--navy);
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.badge-neutral { background: #e6ebf2; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); margin-bottom: 20px; }
.meta-row .sep { color: var(--line); }
.meta-row svg { width: 18px; height: 18px; color: var(--navy); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); }

/* Breadcrumbs */
.breadcrumbs { margin: 20px 0 14px; font-size: 14px; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; }
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* Hero */
.hero-wrap { background: var(--ice); position: relative; overflow: hidden; isolation: isolate; }
.hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; padding-block: 48px; }
.hero-copy .actions { margin-top: 28px; }
.hero-art-wrap { position: relative; }
.hero-art { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 72% center; border-radius: var(--radius); }
.hero-art-wrap::before {
  content: ""; position: absolute; inset: -48px -100vw -48px 0; background: var(--sky-2); z-index: -1;
  clip-path: polygon(6% 0, 100% 0, 100% 100%, 0 100%);
}
.artwork { display: block; width: 100%; height: auto; border-radius: var(--radius); object-fit: cover; }
.artwork-banner { aspect-ratio: 21 / 6; object-fit: cover; object-position: center 40%; }
.artwork-square { aspect-ratio: 4 / 5; object-fit: cover; }
.full-bleed { width: 100%; max-height: 360px; object-fit: cover; object-position: center 35%; border-radius: 0; }
figure { margin: 0; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Race tabs */
.race-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 20px 0 16px; }
.race-tab {
  display: grid; place-items: center; min-width: 0; min-height: 48px; padding: 10px 6px; color: var(--navy); background: var(--sky);
  border: 2px solid transparent; border-radius: var(--radius); font-weight: 800; transition: background-color .18s;
}
.race-tab:hover { background: #cfe1ef; }
.race-tab[aria-selected="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.race-tab .tab-state { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.race-tab[aria-selected="true"] .tab-state { color: var(--coral); }

/* Leg cards (race detail bottom) */
.leg-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.leg-card {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  color: var(--navy); text-decoration: none; font-size: 14px; line-height: 1.45;
}
.leg-card strong { display: block; font-size: 17px; margin-bottom: 4px; }
.leg-card:hover { border-color: var(--navy); }
.leg-card[aria-current="page"] { background: var(--coral); border-color: var(--coral); }
.leg-card[aria-current="page"] .current-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.current-label { display: none; }

/* Leg panel */
.leg-panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.leg-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 18px 24px; background: var(--sky-2); border-bottom: 1px solid var(--line); }
.leg-panel-head .leg-title { font-size: clamp(22px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.03em; margin: 0; }
.leg-panel-head .leg-facts { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-weight: 600; }
.leg-panel-head .leg-facts .sep { color: var(--line); }

/* Toolbar (search + sort) */
.toolbar { display: flex; gap: 12px 16px; flex-wrap: wrap; align-items: end; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; }
.field-search { flex: 1 1 260px; }
.field-sort { flex: 0 1 220px; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type="search"], input[type="text"], select {
  width: 100%; min-height: 48px; color: var(--navy); background: #fff; padding: 10px 12px;
  border: 1px solid #8c9bb0; border-radius: var(--radius);
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.input-wrap input[type="search"] { padding-left: 40px; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317243d' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
.status-line { padding: 10px 24px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); min-height: 20px; }
.status-line:empty { display: none; }
.empty-state { padding: 28px 24px; text-align: center; color: var(--muted); font-weight: 600; }

/* Desktop table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table caption { text-align: left; padding: 12px 24px; font-size: 14px; color: var(--muted); }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { background: var(--sky-2); font-size: 14px; font-weight: 700; }
.data-table th:first-child, .data-table td:first-child { padding-left: 24px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 24px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .col-nr { width: 84px; }
.data-table .col-dist { width: 130px; }
.data-table .col-more { width: 64px; text-align: right; }
.data-table .horse-name { font-weight: 800; }
.data-table tr.is-expanded td { background: var(--sky-2); border-bottom-color: transparent; }
.data-table tr.detail-row td { background: var(--sky-2); padding: 0 24px 16px; }
.number {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 7px;
  background: var(--sky); font-weight: 800; font-size: 18px;
}
.number-winner { background: var(--coral); }
.number-lg { min-width: 52px; height: 52px; font-size: 22px; }

/* Disclosure buttons */
.disclosure {
  display: inline-grid; place-items: center; width: 44px; height: 44px; background: transparent; color: var(--navy);
  border: 1px solid transparent; border-radius: 7px;
}
.disclosure:hover { background: var(--sky); }
.disclosure svg { width: 20px; height: 20px; transition: transform .18s; }
.disclosure[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Detail panel (inside expanded row / card) */
.detail-panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.detail-panel dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 0; }
.detail-panel dt { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.detail-panel dd { margin: 0; font-weight: 700; }
.detail-panel .note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.unknown { color: var(--muted); font-weight: 500; font-style: italic; }

/* Mobile rows (also used on race-detail "Loppets hästar" list) */
.mobile-rows { display: none; list-style: none; }
.horse-list { list-style: none; }
.horse-row { border-bottom: 1px solid var(--line); }
.horse-row:last-child { border-bottom: 0; }
.horse-row-main { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 44px; gap: 12px; align-items: center; padding: 12px 24px; }
.horse-row-main .horse-name { font-weight: 800; display: block; }
.horse-row-main .driver { display: block; color: var(--muted); }
.horse-row-main .distance { color: var(--muted); font-weight: 600; white-space: nowrap; }
.horse-row.is-expanded .horse-row-main { background: var(--sky-2); }
.horse-row .details { padding: 0 24px 16px; background: var(--sky-2); }

/* Unavailable notice */
.notice { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 18px 20px; border: 1px solid #f3c9bf; border-left: 5px solid var(--coral); border-radius: var(--radius); background: #fff6f3; }
.notice svg { width: 24px; height: 24px; color: var(--coral-2); margin-top: 2px; }
.notice h3, .notice h4 { margin-bottom: 4px; font-size: 18px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px 24px; margin: 0; padding: 20px 24px; }
.summary-grid dt { font-size: 13px; color: var(--muted); }
.summary-grid dd { margin: 0; font-weight: 800; font-size: 18px; }
.summary-grid dd .sub { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }

/* Facts strip (race detail) */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; }
.facts > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.facts > div:last-child { border-right: 0; }
.facts dt { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; order: 2; }
.facts dd { margin: 0 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

/* Layout helpers */
.data-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.two-col > *, .data-layout > *, .hero > * { min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.editorial-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.link-list { list-style: none; }
.link-list li { border-top: 1px solid var(--line); }
.link-list li:first-child { border-top: 0; }
.link-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; color: var(--navy); text-decoration: none; font-weight: 800; }
.link-list a:hover { color: var(--link); }
.link-list svg { width: 20px; height: 20px; flex: none; }

/* Guide link cards (home) */
.guide-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.guide-link {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--navy); text-decoration: none; font-weight: 800; box-shadow: var(--shadow);
}
.guide-link:hover { border-color: var(--navy); }
.guide-link .ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; color: var(--navy); }
.guide-link .ico svg { width: 28px; height: 28px; }
.guide-link .chev { margin-left: auto; width: 20px; height: 20px; flex: none; }

/* Guide hub */
.guide-cards { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0 8px; }
.guide-card { min-width: 0; }
.guide-card-link { display: flex; align-items: flex-start; gap: 14px; height: 100%; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--navy); text-decoration: none; box-shadow: var(--shadow); }
.guide-card-link:hover { border-color: var(--navy); }
.guide-card-link .ico { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 8px; background: var(--sky); }
.guide-card-link .ico svg { width: 26px; height: 26px; }
.guide-card-body { display: grid; gap: 4px; }
.guide-card-body strong { font-size: 19px; }
.guide-card-body span { color: var(--muted); font-size: 15px; }
.guide-card-link .chev { margin-left: auto; width: 20px; height: 20px; flex: none; align-self: center; }
@media (max-width: 760px) { .guide-cards { grid-template-columns: 1fr; } }

/* Topic cards (archive) */
.topic-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; color: var(--navy); text-decoration: none; }
.topic-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.topic-card .topic-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; font-weight: 800; font-size: 18px; }
.topic-card .topic-title svg { width: 20px; height: 20px; flex: none; }
.topic-card:hover { border-color: var(--navy); }

/* Results */
.winning-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--sky-2); border: 1px solid var(--line); margin: 0; }
.winning-chip { padding: 12px 8px; border-radius: 7px; background: #fff; text-align: center; border: 1px solid var(--line); }
.winning-chip dt { display: block; font-size: 14px; font-weight: 700; color: var(--muted); }
.winning-chip dd { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.result-list { list-style: none; display: grid; gap: 12px; margin-top: 16px; }
.result-item { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; padding: 14px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.result-item .leg-meta { border-right: 1px solid var(--line); padding-right: 16px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.result-item .leg-meta strong { display: block; font-size: 18px; color: var(--navy); }
.result-item .winner { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.result-item .winner strong { display: block; font-size: 20px; }
.result-item .winner span { color: var(--muted); }
.payouts { display: grid; gap: 12px; list-style: none; }
.payout-card { padding: 16px 20px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.payout-card .label { display: block; font-weight: 700; }
.payout-card .payout { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.payout-card .note { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.aside-card { padding: 20px; border-radius: var(--radius); background: var(--sky-2); border: 1px solid var(--sky); }
.aside-card h2, .aside-card h3 { font-size: 20px; }
.info-box { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 18px 20px; border-radius: var(--radius); background: var(--sky-2); border: 1px solid var(--sky); }
.info-box .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 7px; background: #fff; color: var(--navy); }
.info-box .ico svg { width: 22px; height: 22px; }
.info-box p { margin: 4px 0 0; color: var(--muted); }
.info-box strong { font-size: 17px; }

/* Archive */
.filter-form { padding: 20px 24px; }
.filter-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px; align-items: end; }
.filter-fields .field-actions { display: flex; gap: 8px; }
.round-card .round-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 20px 24px; }
.round-card .round-head h3 { font-size: clamp(22px, 2.6vw, 30px); margin: 0 0 6px; }
.round-card .round-venue { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 800; font-size: 20px; }
.winner-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.winner-chips dt { font-weight: 600; color: var(--muted); margin-right: 4px; }
.winner-chips dd { margin: 0; }
.legs-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 0 24px; border-top: 1px solid var(--line); }
.legs-grid > div { padding: 16px 12px 16px 0; border-right: 1px solid var(--line); margin-right: 12px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.legs-grid > div:last-child { border-right: 0; margin-right: 0; }
.legs-grid strong { display: block; font-size: 16px; color: var(--navy); margin-bottom: 4px; }
.count-heading { margin: 28px 0 16px; }

/* Guide */
.article { max-width: 760px; }
.article p, .article li { max-width: 68ch; }
.article h2 { margin-top: 40px; font-size: clamp(22px, 2.6vw, 30px); }
.article h3 { margin-top: 24px; }
.steps { list-style: none; display: grid; gap: 12px; margin: 24px 0; }
.step { display: grid; grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.step .step-no { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--sky); font-size: 26px; font-weight: 800; }
.step h3 { margin: 0 0 4px; font-size: 20px; }
.step p { margin: 0; color: var(--muted); max-width: none; }
.step .step-ico { width: 48px; height: 48px; color: var(--navy); }
.step .step-ico svg { width: 48px; height: 48px; }
.toc { position: sticky; top: 16px; }
.toc h2 { font-size: 18px; margin-bottom: 12px; }
.toc ol { list-style: none; display: grid; gap: 8px; color: var(--muted); font-size: 15px; }
.toc li { padding-left: 12px; border-left: 3px solid transparent; }
.toc li.is-current { border-left-color: var(--coral); color: var(--navy); font-weight: 700; }
.faq { display: grid; gap: 12px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; font-weight: 800; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .18s; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details > div { padding: 0 20px 16px; color: var(--navy); }
.faq details > div p { margin: 0; }
.example-table th, .example-table td { padding: 12px 16px; }
.cta-center { display: flex; justify-content: center; margin-top: 32px; }

.article-list { padding-left: 20px; display: grid; gap: 6px; }
.article-list li { max-width: 68ch; }

/* News empty state */
.news-empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }

/* Error page */
.error-page { padding-block: 64px; text-align: center; }

/* Status badges (data-driven) */
.badge-upcoming { background: var(--sky); }
.badge-ongoing { background: var(--coral); color: var(--navy); }
.badge-settled { background: #e6ebf2; }
.badge-cancelled { background: #f3d3cc; }
.badge-unconfirmed { background: #fff0c2; }
.badge-scratched { background: #f3d3cc; font-size: 12px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; }
.number-scratched { background: #e6ebf2; color: var(--muted); text-decoration: line-through; }
tr.is-scratched .horse-name, .horse-row.is-scratched .horse-name { color: var(--muted); text-decoration: line-through; }
tr.is-scratched .badge-scratched, .horse-row.is-scratched .badge-scratched { text-decoration: none; }
.update-status { margin: 6px 0 0; }
.update-warning { color: #9a2f1c; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.link-list .link-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; color: var(--muted); }
.year-nav { margin: 16px 0 0; }
.year-nav ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.year-nav a { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--navy); text-decoration: none; font-weight: 700; }
.year-nav a[aria-current="page"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.is-refreshing { transition: opacity .18s; opacity: .6; }
.live-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: var(--radius); background: var(--navy); color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.log-pre { max-height: 420px; overflow: auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; line-height: 1.4; white-space: pre-wrap; }
.log-list { list-style: none; display: grid; gap: 6px; padding: 0 24px 20px; font-size: 13px; }
.admin-warning .facts dd:first-child { color: #9a2f1c; }

/* Media queries */
@media (max-width: 1024px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div:nth-child(2n) { border-right: 0; }
  .facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .legs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legs-grid > div:nth-child(3n) { border-right: 0; }
  .leg-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editorial-grid, .guide-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-fields .field-actions { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--navy); border-top: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 12px 24px rgba(0, 0, 0, .25); }
  .site-nav:not(.is-open) { display: none; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px; }
  .site-nav a { display: block; padding: 14px 8px; border-bottom: 0; border-left: 4px solid transparent; }
  .site-nav a[aria-current="page"] { border-left-color: var(--coral); background: rgba(255, 255, 255, .06); }
  .hero, .data-layout, .two-col { grid-template-columns: 1fr; }
  .hero { gap: 24px; padding-block: 28px 0; }
  .hero-art-wrap { order: 2; margin-inline: calc(-1 * var(--gutter)); }
  .hero-art-wrap::before { display: none; }
  .hero-art { border-radius: 0; aspect-ratio: 4 / 3; object-position: 60% center; }
  .site-footer .container { grid-template-columns: 1fr; text-align: left; }
  .site-footer nav ul { justify-content: flex-start; gap: 12px 20px; }
  .footer-meta { text-align: left; border-left: 0; padding-left: 0; }
  .toc { position: static; }
}

@media (max-width: 760px) {
  .section { padding-block: 24px; }
  .race-tab .tab-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .card { padding: 16px; }
  .card-head, .card-body, .card-foot, .leg-panel-head, .toolbar, .status-line, .filter-form, .round-card .round-head { padding-left: 16px; padding-right: 16px; }
  .race-tabs, .winning-strip, .leg-cards, .legs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legs-grid { padding: 0 16px; }
  .legs-grid > div:nth-child(3n) { border-right: 0; }
  .toolbar, .filter-fields, .actions { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .toolbar .field-search, .toolbar .field-sort { flex: none; }
  .actions .btn { width: 100%; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .card-foot .actions { width: 100%; }
  .desktop-table { display: none; }
  .mobile-rows { display: block; }
  .horse-row-main { grid-template-columns: 52px minmax(0, 1fr) 44px; padding: 12px 16px; }
  .horse-row-main .distance { grid-column: 2; grid-row: 2; font-size: 14px; }
  .horse-row-main .distance:empty { display: none; }
  .horse-row .details { padding: 0 16px 16px; }
  .detail-panel dl { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts dd { font-size: 20px; }
  .editorial-grid, .guide-links { grid-template-columns: 1fr; }
  .result-item { grid-template-columns: 1fr; }
  .result-item .leg-meta { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 10px; }
  .winning-chip dd { font-size: 24px; }
  .step { grid-template-columns: 48px 1fr; }
  .step .step-no { width: 48px; height: 48px; font-size: 22px; }
  .step .step-ico { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; padding: 16px; }
  .full-bleed { max-height: 240px; }
  .filter-fields .field-actions { flex-direction: column; }
  .filter-fields .field-actions .btn { width: 100%; }
  .site-footer nav ul { flex-direction: column; gap: 10px; }
}

@media (max-width: 380px) {
  .legs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legs-grid > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .legs-grid > div:nth-child(2n) { border-right: 0; }
  .badge { white-space: normal; }
  .race-tab { padding: 10px 4px; font-size: 15px; }
  .horse-row-main { grid-template-columns: 44px minmax(0, 1fr) 40px; gap: 10px; }
  .number { min-width: 40px; height: 40px; font-size: 16px; }
  .detail-panel dl { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
}

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

@media print {
  .site-header, .site-footer, .menu-toggle, .toolbar, .actions { display: none !important; }
  body { background: #fff; }
}
