/* PaddockLink shared design system.
   Owned by author 1. Other authors use these classes and never redefine them.
   Direction: pit wall and timing tower. Navy ink, signal-yellow pit board,
   flag colors used only to carry meaning (run groups, status), start-grid lines. */

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --ink: #0f1e36;          /* timing-tower navy: text, dark bands */
  --ink-2: #33435e;        /* secondary text on light (AA on white and concrete) */
  --ink-3: #5a6880;        /* tertiary text, large only */
  --paper: #ffffff;
  --concrete: #eef0f2;     /* pit-wall concrete: alternate sections */
  --concrete-2: #e1e5ea;
  --line: #c6cdd6;
  --line-strong: #8d98a8;
  --signal: #ffcc00;       /* pit-board yellow: primary action, highlight */
  --signal-dark: #e6b400;
  --signal-tint: #fff4c2;
  --flag-green: #0a7a44;
  --flag-blue: #1b5ec2;
  --flag-red: #c4162b;
  --on-ink: #ffffff;
  --on-ink-2: #c9d3e3;     /* secondary text on navy (AA) */

  /* Type */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-display: "Bahnschrift", "DIN Alternate", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.375rem, 1.1rem + 1vw, 1.625rem);
  --step-3: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  --step-4: clamp(2.25rem, 1.4rem + 4vw, 4rem);
  --leading: 1.6;
  --leading-tight: 1.05;

  /* Space and shape */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: clamp(3rem, 2rem + 5vw, 6rem);
  --radius-s: 2px;
  --radius-m: 4px;
  --measure: 68ch;
  --container: 72rem;
  --focus: 3px solid var(--flag-blue);
}

/* ---------- Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading);
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; height: auto; }
main { display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-stretch: semi-condensed;
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.02em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); line-height: 1.15; }
h4 { font-size: var(--step-1); line-height: 1.2; }
p, ul, ol, dl, table, figure, blockquote { margin: 0 0 var(--space-4); }
p { max-width: var(--measure); }
small { font-size: var(--step--1); }
strong { font-weight: 700; }

a { color: var(--flag-blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--signal); color: var(--ink); }

.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;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--signal); color: var(--ink); font-weight: 700;
  padding: var(--space-3) var(--space-4); border: 2px solid var(--ink);
  border-radius: var(--radius-m); text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* ---------- Layout ---------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}
@media (max-width: 400px) { .container { width: calc(100% - 1.75rem); } }

.section { padding-block: var(--space-8); }
.section--alt { background: var(--concrete); }
.section--dark { background: var(--ink); color: var(--on-ink); }
.section--dark p, .section--dark li { color: var(--on-ink-2); }
.section--dark h2, .section--dark h3, .section--dark strong { color: var(--on-ink); }
.section--dark a:not(.btn) { color: var(--signal); }
.section > .container > :last-child { margin-bottom: 0; }

.section-head { margin-bottom: var(--space-6); max-width: 46rem; }
.section-head > :last-child { margin-bottom: 0; }

.grid-2, .grid-3 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.grid-2 > *, .grid-3 > * { min-width: 0; }

/* ---------- Text components ---------- */
.eyebrow {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--step--1); font-weight: 700; line-height: 1.3;
  color: var(--ink-2); margin: 0 0 var(--space-3);
}
.eyebrow::before {
  content: ""; flex: none; width: 1.5rem; height: 0.375rem;
  background: var(--signal); border-radius: 1px;
}
.section--dark .eyebrow, .cta-band .eyebrow, .page-hero--dark .eyebrow { color: var(--on-ink-2); }

.lead {
  font-size: var(--step-1); line-height: 1.5; color: var(--ink-2);
  max-width: 40em;
}
.section--dark .lead { color: var(--on-ink-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.875rem; padding: 0.6rem 1.25rem;
  font-family: var(--font-display); font-stretch: semi-condensed;
  font-size: 1.0625rem; font-weight: 700; line-height: 1.1;
  text-decoration: none; text-align: center;
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  cursor: pointer; transition: background-color 120ms ease, color 120ms ease;
}
.btn--primary { background: var(--signal); color: var(--ink); }
.btn--primary:hover { background: var(--signal-dark); }
.btn--secondary { background: transparent; color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: var(--on-ink); }
.section--dark .btn--secondary, .cta-band .btn--secondary, .page-hero--dark .btn--secondary {
  color: var(--on-ink); border-color: var(--on-ink);
}
.section--dark .btn--secondary:hover, .cta-band .btn--secondary:hover, .page-hero--dark .btn--secondary:hover {
  background: var(--on-ink); color: var(--ink);
}
.section--dark .btn--primary, .cta-band .btn--primary, .page-hero--dark .btn--primary { border-color: var(--signal); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; }

/* ---------- Card ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  border-radius: var(--radius-s);
  padding: var(--space-5);
}
.card > :last-child { margin-bottom: 0; }
.card h3 { font-size: var(--step-1); margin-bottom: var(--space-2); }
.card p { color: var(--ink-2); }
.card--signal { border-top-color: var(--signal); }
.card--green { border-top-color: var(--flag-green); }
.card--blue { border-top-color: var(--flag-blue); }
.card--red { border-top-color: var(--flag-red); }
.section--dark .card { color: var(--ink); }
.section--dark .card p, .section--dark .card li { color: var(--ink-2); }
.section--dark .card h3, .section--dark .card strong { color: var(--ink); }

/* ---------- Feature list (checkered-flag bullets) ---------- */
.feature-list { list-style: none; padding: 0; }
.feature-list li {
  position: relative; padding-left: 1.75rem; margin-bottom: var(--space-3);
}
.feature-list li::before {
  content: ""; position: absolute; left: 0; top: 0.4em;
  width: 0.8rem; height: 0.8rem; border: 1px solid var(--ink);
  background: conic-gradient(var(--ink) 25%, var(--paper) 0 50%, var(--ink) 0 75%, var(--paper) 0) 0 0 / 50% 50%;
}
.section--dark .feature-list li::before { border-color: var(--on-ink); }
.feature-list li > strong:first-child { display: block; color: var(--ink); }
.section--dark .feature-list li > strong:first-child { color: var(--on-ink); }

/* ---------- Steps (start-grid slots; for real sequences only) ---------- */
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: var(--space-5); }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 0 4.25rem; min-height: 3.25rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 3.25rem; height: 3.25rem;
  display: grid; place-items: center;
  font-family: var(--font-display); font-stretch: semi-condensed;
  font-size: 1.5rem; font-weight: 700; color: var(--ink);
  /* a painted grid slot: open at the bottom, like the box on the start line */
  border: 3px solid var(--ink); border-bottom: 0;
  background: var(--signal);
}
.steps > li > :last-child { margin-bottom: 0; }
.steps h3 { font-size: var(--step-1); margin-bottom: var(--space-1); padding-top: 0.2rem; }
.steps p { color: var(--ink-2); }
.section--dark .steps p { color: var(--on-ink-2); }
.section--dark .steps > li::before { border-color: var(--on-ink); }
@media (min-width: 900px) {
  .steps--row { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--space-6); }
  .steps--row > li { padding: 4.25rem 0 0; }
  .steps--row > li:nth-child(even) { margin-top: var(--space-6); } /* staggered like a grid */
}

/* ---------- Callout ---------- */
.callout {
  background: var(--signal-tint);
  border-left: 6px solid var(--signal);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: var(--space-4) var(--space-5);
  color: var(--ink);
  margin: 0 0 var(--space-5);
}
.callout > :last-child { margin-bottom: 0; }
.callout p { color: var(--ink); }
.callout--info { background: #e8f0fb; border-left-color: var(--flag-blue); }
.callout--warn { background: #fbe9eb; border-left-color: var(--flag-red); }
.section--dark .callout p, .section--dark .callout strong { color: var(--ink); }

/* ---------- FAQ (details/summary) ---------- */
.faq { border-top: 2px solid var(--ink); margin: 0 0 var(--space-5); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4);
  padding: var(--space-4) 0;
  font-weight: 700; font-size: var(--step-1); line-height: 1.35;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.25rem; line-height: 1;
  border: 2px solid var(--ink); border-radius: var(--radius-s);
}
.faq details[open] > summary::after { content: "\2212"; background: var(--signal); }
.faq summary:hover { color: var(--flag-blue); }
.faq details > :not(summary) { max-width: var(--measure); }
.faq details > :last-child { margin-bottom: var(--space-5); }

/* ---------- Prose (long-form legal text) ---------- */
.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); margin-top: var(--space-7); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.prose h3 { font-size: var(--step-1); margin-top: var(--space-6); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li { margin-bottom: var(--space-2); }
.prose li::marker { color: var(--ink-2); }
.prose p, .prose li { color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
.prose blockquote { border-left: 4px solid var(--line-strong); padding-left: var(--space-4); color: var(--ink-2); }

/* ---------- Placeholder (owner-supplied values) ---------- */
.placeholder {
  display: inline; padding: 0 0.3em;
  background: var(--signal-tint); color: var(--ink);
  outline: 1px dashed var(--ink); outline-offset: -1px;
  border-radius: var(--radius-s);
  font-weight: 700; font-style: normal;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- Badge (inspection-sticker tag) ---------- */
.badge {
  display: inline-block; vertical-align: middle;
  padding: 0.15rem 0.55rem;
  font-size: var(--step--1); font-weight: 700; line-height: 1.4;
  background: var(--concrete-2); color: var(--ink);
  border: 1px solid var(--ink); border-radius: var(--radius-s);
}
.badge--signal { background: var(--signal); }
.badge--green { background: var(--flag-green); color: #fff; border-color: var(--flag-green); }
.badge--blue { background: var(--flag-blue); color: #fff; border-color: var(--flag-blue); }
.badge--red { background: var(--flag-red); color: #fff; border-color: var(--flag-red); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-s); }
.table-wrap .table { margin: 0; border: 0; }
.table {
  width: 100%; border-collapse: collapse; background: var(--paper);
  font-size: var(--step-0); line-height: 1.45;
}
.table caption { text-align: left; font-weight: 700; padding: var(--space-3) var(--space-4); caption-side: top; }
.table th, .table td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.table thead th {
  background: var(--ink); color: var(--on-ink);
  font-family: var(--font-display); font-stretch: semi-condensed; font-size: 1rem;
  border-bottom: 3px solid var(--signal);
}
.table tbody th { font-weight: 700; }
.table tbody tr:nth-child(even) { background: #f7f8f9; }
.table td.num, .table th.num { text-align: right; }

/* ---------- Page hero (top of interior pages; optional shared block) ---------- */
.page-hero {
  position: relative; overflow: hidden;
  background: var(--concrete);
  border-bottom: 4px solid var(--ink);
  padding-block: clamp(2.5rem, 2rem + 4vw, 5rem);
}
.page-hero h1 { max-width: 18ch; }
.page-hero .lead { margin-bottom: 0; }
.page-hero > .container { position: relative; }
.page-hero::after {
  /* start-grid slots painted along the right edge */
  content: ""; position: absolute; right: -1rem; top: 0; bottom: 0; width: min(38vw, 22rem);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120' viewBox='0 0 160 120'%3E%3Cpath d='M12 8h48M12 8v26M60 8v26M92 68h48M92 68v26M140 68v26' fill='none' stroke='%230f1e36' stroke-opacity='.14' stroke-width='4'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.page-hero--dark { background: var(--ink); color: var(--on-ink); border-bottom-color: var(--signal); }
.page-hero--dark .lead { color: var(--on-ink-2); }
.page-hero--dark::after { filter: invert(1); opacity: 0.7; }
@media (max-width: 719px) { .page-hero::after { display: none; } }

/* ---------- CTA band (use as its own <section>, not with .section) ---------- */
.cta-band {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--on-ink);
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
  border-top: 6px solid var(--signal);
}
.cta-band::before {
  /* the start line: a checkered strip and staggered grid boxes */
  content: ""; position: absolute; inset: 0 0 0 auto; width: min(45%, 30rem);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='160' viewBox='0 0 200 160'%3E%3Cpath d='M20 14h64M20 14v34M84 14v34M116 94h64M116 94v34M180 94v34' fill='none' stroke='%23ffffff' stroke-opacity='.22' stroke-width='5'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.cta-band > .container { position: relative; }
.cta-band h2 { color: var(--on-ink); max-width: 20ch; }
.cta-band p { color: var(--on-ink-2); max-width: 46ch; }
.cta-band a:not(.btn) { color: var(--signal); }
.cta-band :focus-visible, .section--dark :focus-visible, .site-footer :focus-visible, .page-hero--dark :focus-visible { outline-color: var(--signal); }
@media (max-width: 719px) { .cta-band::before { width: 100%; opacity: 0.45; } }

/* ---------- Site header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 10;
}
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-3);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.brand__mark { width: 2.25rem; height: 2.25rem; flex: none; }
.brand__name {
  font-family: var(--font-display); font-stretch: semi-condensed;
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1;
}
.brand:hover .brand__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.site-header__cta { min-height: 2.5rem; padding: 0.45rem 1rem; }
@media (max-width: 359px) {
  .brand__mark { width: 1.875rem; height: 1.875rem; }
  .brand__name { font-size: 1.25rem; }
  .site-header__cta { padding: 0.4rem 0.7rem; font-size: 0.975rem; }
}

.site-nav { order: 3; flex: 1 0 100%; margin-inline: -0.5rem; }
.site-nav ul { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; gap: 0; }
.site-nav li { white-space: nowrap; }
.site-nav a {
  display: block; padding: 0.55rem 0.5rem;
  color: var(--ink); font-weight: 600; font-size: 0.975rem; text-decoration: none;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--line-strong); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--signal); }
.site-nav a:focus-visible { outline-offset: -3px; }

@media (min-width: 960px) {
  .site-header__inner { flex-wrap: nowrap; padding-block: var(--space-4); }
  .brand { margin-right: 0; }
  .site-nav { order: 0; flex: 1 1 auto; margin: 0; overflow: visible; }
  .site-nav ul { justify-content: flex-end; gap: var(--space-1); }
  .site-nav a { padding: 0.5rem 0.65rem; }
}

/* ---------- Site footer ---------- */
.site-footer {
  background: var(--ink); color: var(--on-ink-2);
  padding-block: var(--space-7) var(--space-6);
  font-size: 0.975rem;
}
.site-footer__inner { display: grid; gap: var(--space-6); }
.site-footer .brand { color: var(--on-ink); }
.site-footer__brand p { margin: var(--space-3) 0 0; max-width: 34ch; }
.site-footer__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.site-footer__nav a { color: var(--on-ink); text-decoration: none; font-weight: 600; display: inline-block; padding: 0.2rem 0; }
.site-footer__nav a:hover { text-decoration: underline; }
.site-footer__legal { margin: 0; padding-top: var(--space-5); border-top: 1px solid rgba(255, 255, 255, 0.18); font-size: var(--step--1); }
@media (min-width: 860px) {
  .site-footer__inner { grid-template-columns: 1fr auto; align-items: start; }
  .site-footer__nav ul { justify-content: flex-end; max-width: 42rem; }
  .site-footer__legal { grid-column: 1 / -1; }
}

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

/* ---------- Print ---------- */
@media print {
  .skip-link, .site-header, .site-footer, .cta-band, .btn, .btn-row { display: none !important; }
  body { color: #000; background: #fff; font-size: 11pt; }
  .page-hero { background: none; border-bottom: 1pt solid #000; padding: 0 0 12pt; }
  .page-hero::after { display: none; }
  .section, .section--alt { padding: 12pt 0; background: none; }
  .container { width: auto; }
  .prose { max-width: none; }
  .prose h2, .prose h3 { break-after: avoid; page-break-after: avoid; color: #000; }
  .prose h2 { border-top: 0; }
  .prose p, .prose li { orphans: 3; widows: 3; color: #000; }
  .prose a { color: #000; text-decoration: underline; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; }
  .placeholder { background: none; outline: 1pt dashed #000; }
  .table thead th { background: none; color: #000; border-bottom: 1pt solid #000; }
}
