/* Motogordon Racing - foglio di stile condiviso
   Palette dal logo: arancione (66,1,17 -> 251,195,12), blu (1,60,108 -> 93,134,190), verde (4,71,23 -> 115,133,21)
   Arancione = moto, verde = podismo, blu = dati e app. Nessun font o script esterno. */

:root {
  --or-1: #420111; --or-2: #d9700f; --or-3: #fbc30c;
  --bl-1: #013c6c; --bl-2: #2f6195; --bl-3: #5d86be;
  --gr-1: #044717; --gr-2: #3c6616; --gr-3: #738515;
  --ink: #14181f; --muted: #46505c; --paper: #f2f5f8; --white: #ffffff; --line: #d3dae2;
  --night: #0a1722;
  --maxw: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --font: "Bahnschrift", "DIN Alternate", "DIN 1451 Std", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  color: var(--ink); background: var(--paper);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--bl-1); text-underline-offset: .18em; }
a:hover { color: var(--bl-2); }
:focus-visible { outline: 3px solid var(--bl-3); outline-offset: 3px; border-radius: 3px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--or-3); color: #1b1200; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

h1, h2, h3 { font-weight: 800; font-style: italic; line-height: 1.12; letter-spacing: .005em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.15rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

/* ---------- Intestazione e menu ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--white); box-shadow: 0 1px 0 var(--line); }
.site-header::after {
  content: ""; display: block; height: 6px;
  background: linear-gradient(90deg,
    var(--or-1), var(--or-2) 17%, var(--or-3) 33%,
    var(--bl-1) 33%, var(--bl-3) 66%,
    var(--gr-1) 66%, var(--gr-3));
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand img { height: 44px; width: auto; }
.brand-name { font-weight: 800; font-style: italic; font-size: 1.3rem; letter-spacing: .01em; white-space: nowrap; }

.nav-toggle {
  display: none; align-items: center; gap: .6rem; font: inherit; font-weight: 700;
  background: var(--bl-1); color: #fff; border: 0; border-radius: 8px; padding: .55rem .9rem; cursor: pointer;
}
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px;
}
.nav-toggle .bars { position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.nav-list a {
  display: block; padding: .6rem .85rem; font-weight: 700; font-style: italic; text-decoration: none; color: var(--ink);
  border-bottom: 4px solid transparent; transition: border-color .15s;
}
.nav-list a:hover { border-bottom-color: var(--bl-3); color: var(--ink); }
.nav-list a[aria-current="page"] { border-bottom-color: var(--or-2); }

@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; }
  .site-nav { flex-basis: 100%; }
  .nav-list { flex-direction: column; padding-bottom: .6rem; }
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 14px 24px rgba(10, 23, 34, .18);
    padding: .4rem var(--gutter) .6rem;
  }
  .js .site-nav.open { display: block; }
  .brand-name { font-size: 1.1rem; }
}

/* ---------- Strisce a scacchi ---------- */
.checker { height: 16px; background: conic-gradient(#10151c 25%, #fff 0 50%, #10151c 0 75%, #fff 0) 0 0 / 16px 16px; }

/* ---------- Hero con pettorina ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #00203d, var(--bl-1) 58%, #0a4f8a);
  padding: clamp(2.2rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5.5rem);
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 0 40%; opacity: .14; pointer-events: none;
  background: conic-gradient(#000 25%, #fff 0 50%, #000 0 75%, #fff 0) 0 0 / 44px 44px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }

.bib {
  background: var(--white); border-radius: 20px; padding: clamp(1rem, 3vw, 1.8rem);
  display: flex; align-items: center; gap: clamp(.8rem, 2.4vw, 1.6rem);
  box-shadow: 12px 12px 0 var(--or-2), 24px 24px 0 var(--gr-3);
  margin: 0 24px 24px 0;
}
.bib-logo { flex: 0 0 33%; }
.bib-title { flex: 1 1 auto; margin: 0; min-width: 0; }
.bib-title img { width: 100%; }

.hero-copy .lead { font-size: clamp(1.15rem, 2.6vw, 1.45rem); line-height: 1.4; font-weight: 600; margin-bottom: .8em; }
.hero-copy p { color: #dbe7f5; max-width: 46ch; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }
.btn {
  display: inline-block; padding: .8rem 1.4rem; border-radius: 8px; font-weight: 800; font-style: italic;
  text-decoration: none; border: 2px solid transparent; transition: transform .15s, background-color .15s;
}
.btn--main { background: var(--or-3); color: #1b1200; }
.btn--main:hover { background: #ffd33f; color: #1b1200; transform: translateY(-2px); }
.btn--line { border-color: #fff; color: #fff; }
.btn--line:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.hero :focus-visible, .band :focus-visible, .site-footer :focus-visible, .page-head :focus-visible { outline-color: var(--or-3); }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .bib { box-shadow: 8px 8px 0 var(--or-2), 16px 16px 0 var(--gr-3); margin: 0 16px 16px 0; }
}
@media (max-width: 520px) {
  .bib { flex-direction: column; text-align: center; }
  .bib-logo { flex-basis: auto; width: 58%; }
  .bib-title { width: 100%; }
}

/* ---------- Sezioni ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-intro { max-width: 60ch; color: var(--muted); }

.lanes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.2rem; margin-top: 1.8rem; }
.lane { color: #fff; border-radius: 14px; padding: clamp(1.4rem, 3vw, 2.1rem); border-top: 8px solid var(--or-3); position: relative; overflow: hidden; }
.lane h3 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
.lane p { max-width: 44ch; margin-bottom: 0; color: #f3eee9; }
.lane--moto { grid-column: span 3; background: linear-gradient(160deg, var(--or-1) 0%, #7a2c0c 60%, #a8480c 100%); }
.lane--run { grid-column: span 3; border-top-color: var(--gr-3); background: linear-gradient(160deg, var(--gr-1) 0%, #2c5a14 60%, var(--gr-2) 100%); }
.lane--run p { color: #eef3e6; }
.lane::after {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 120px; height: 120px; opacity: .16;
  background: conic-gradient(#000 25%, #fff 0 50%, #000 0 75%, #fff 0) 0 0 / 30px 30px;
  transform: rotate(-12deg);
}
@media (max-width: 760px) { .lane--moto, .lane--run { grid-column: 1 / -1; } }

.band { background: linear-gradient(135deg, var(--bl-1), #0a4f8a); color: #fff; padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.band .section-intro { color: #dbe7f5; }
.band a { color: var(--or-3); }
.band a:hover { color: #ffe27a; }
.board { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.board li { background: var(--night); border-left: 6px solid var(--or-3); padding: .65rem .9rem; font-weight: 700; border-radius: 4px; font-variant-numeric: tabular-nums; }
.board li:nth-child(3n+2) { border-left-color: var(--bl-3); }
.board li:nth-child(3n) { border-left-color: var(--gr-3); }
.band-note { margin-top: 1.6rem; max-width: 62ch; }

.pit { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: .7rem; }
.pit a {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-left: 10px solid var(--or-2); border-radius: 8px;
  padding: 1rem 1.3rem; transition: transform .15s, border-color .15s;
}
.pit a:hover { transform: translateX(4px); color: var(--ink); }
.pit li:nth-child(2) a { border-left-color: var(--bl-2); }
.pit li:nth-child(3) a { border-left-color: var(--gr-2); }
.pit strong { display: block; font-size: 1.2rem; font-style: italic; }
.pit span { color: var(--muted); }
.pit a::after { content: ""; width: .7rem; height: .7rem; border-top: 3px solid var(--ink); border-right: 3px solid var(--ink); transform: rotate(45deg); }

/* ---------- Pagine interne ---------- */
.page-head { color: #fff; background: linear-gradient(135deg, #00203d, var(--bl-1) 60%, #0a4f8a); padding: clamp(2rem, 5vw, 3.4rem) 0 clamp(1.8rem, 4vw, 2.6rem); }
.page-head h1 { margin-bottom: .3em; }
.page-head p { margin: 0; color: #dbe7f5; max-width: 60ch; }

.prose { max-width: 76ch; }
.prose h2 { margin-top: 2.2em; padding-left: .7rem; border-left: 8px solid var(--or-2); font-size: clamp(1.3rem, 3vw, 1.7rem); }
.prose h2:nth-of-type(3n+2) { border-left-color: var(--bl-2); }
.prose h2:nth-of-type(3n) { border-left-color: var(--gr-2); }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: .4em; }
.callout { background: var(--white); border: 1px solid var(--line); border-left: 8px solid var(--bl-2); border-radius: 8px; padding: 1rem 1.2rem; margin: 1.4rem 0; }
.callout p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table-wrap th, .table-wrap td { padding: .7rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-wrap th { background: var(--bl-1); color: #fff; font-style: italic; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap code { font-size: .85em; word-break: break-all; }

/* ---------- Tabella risultati ---------- */
.table-wrap .results { min-width: 0; }
.results tbody tr[data-type="moto"] td:first-child { box-shadow: inset 6px 0 0 var(--or-2); }
.results tbody tr[data-type="podismo"] td:first-child { box-shadow: inset 6px 0 0 var(--gr-2); }
.results .empty-row td { color: var(--muted); text-align: center; padding: 1.6rem 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 0 0 1rem; padding: 0; list-style: none; font-weight: 700; }
.legend li::before { content: ""; display: inline-block; width: 1rem; height: .7rem; margin-right: .5rem; border-radius: 2px; background: var(--or-2); }
.legend li:last-child::before { background: var(--gr-2); }

@media (max-width: 640px) {
  .table-wrap.results-wrap { overflow: visible; border: 0; background: none; }
  .results thead { position: absolute; left: -9999px; }
  .results, .results tbody, .results tr, .results td { display: block; width: 100%; }
  .results tbody tr { background: var(--white); border: 1px solid var(--line); border-left: 8px solid var(--bl-2); border-radius: 10px; margin-bottom: 1rem; padding: .5rem 1rem; }
  .results tbody tr[data-type="moto"] { border-left-color: var(--or-2); }
  .results tbody tr[data-type="podismo"] { border-left-color: var(--gr-2); }
  .results tbody tr td, .results tbody tr td:first-child { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem 0; box-shadow: none; text-align: right; }
  .results td::before { content: attr(data-label); font-weight: 800; font-style: italic; color: var(--muted); text-align: left; }
  .results .empty-row td { display: block; text-align: center; }
  .results .empty-row td::before { content: none; }
}

/* ---------- Piè di pagina ---------- */
.site-footer { background: var(--night); color: #c9d6e3; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.2rem 2rem; padding: 2rem 0; }
.footer-inner p { margin: 0; max-width: 46ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.footer-links a { color: #fff; font-weight: 700; }
.footer-links a:hover { color: var(--or-3); }
.copy { border-top: 1px solid rgba(255, 255, 255, .12); padding: 1rem 0 1.4rem; font-size: .9rem; }

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