/* ============================================================
   Modulo Gare — race-control aesthetic (LIGHT mode)
   Light theme, condensed sans, monospace data, arancione accent
   ============================================================ */

:root {
  --bg:      #fafaf8;
  --bg-2:    #ffffff;
  --bg-3:    #f3f1ec;
  --bg-hi:   #ebe7df;
  --line:    #e2ddd2;
  --line-2:  #cfc8b9;

  --text:    #181613;
  --text-2:  #5b524a;
  --text-3:  #968a7a;
  --text-4:  #c5beb1;

  --lime:    #e85a0b;
  --lime-2:  #ff6e1c;
  --rosso:   #d9281f;
  --giallo:  #b87923;
  --verde:   #197414;
  --blu:     #1e6ec3;

  --gold:    #b8861f;
  --silver:  #707880;
  --bronze:  #9a5e25;

  --shadow-1: 0 1px 0 var(--line);
  --shadow-2: 0 14px 38px -22px rgba(24,22,19,.22), 0 2px 0 var(--line);

  --ff-display: 'Barlow Condensed', 'Helvetica Neue', sans-serif;
  --ff-body:    'Hanken Grotesk', system-ui, sans-serif;
  --ff-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--lime); text-decoration: none; transition: color .15s; }
a:hover { color: var(--lime-2); }

/* ============================================================
   TOPBAR — race-control header
   ============================================================ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2.4rem);
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-block;
  width: 24px; height: 24px;
  background: var(--lime);
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
}
.brand b { color: var(--lime); font-weight: 700; }

.topbar nav {
  display: flex;
  gap: 0;
  height: 100%;
}
.topbar nav a {
  display: flex;
  align-items: center;
  padding: 0 1.1rem;
  font-family: var(--ff-display);
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
  height: 100%;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--lime); border-bottom-color: var(--lime); }

/* ============================================================
   LAYOUT
   ============================================================ */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1.4rem, 3.5vw, 2.4rem) clamp(1rem, 3vw, 2.4rem) 5rem;
}

.eyebrow {
  font-family: var(--ff-display);
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.eyebrow .sep { color: var(--lime); margin: 0 .4rem; }

h1.display, h1, h2.display {
  font-family: var(--ff-display);
  font-weight: 700;
  font-style: normal;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
  margin: .25rem 0 1rem;
  color: var(--text);
}
h2 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0 0 1rem;
}
h3 {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0;
}

.lede {
  color: var(--text-2);
  max-width: 64ch;
  margin: 0 0 1rem;
  font-size: 1rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 2.4rem 0 1.2rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}
.section-title .num {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--lime);
  letter-spacing: .1em;
}
.section-title h2 {
  font-size: 1.05rem;
  margin: 0;
}

/* ============================================================
   HERO — race scoreboard header
   ============================================================ */

.hero-board {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1.6rem clamp(1.2rem, 3vw, 2rem);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.hero-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 65%, rgba(232, 90, 11, .09) 100%);
  pointer-events: none;
}
.hero-board.live::after {
  content: 'LIVE';
  position: absolute;
  top: 1rem; right: 1rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .14em;
  background: var(--rosso);
  color: var(--text);
  padding: .25rem .6rem;
  border-radius: 2px;
}
.hero-board.live::after { animation: blink 1.4s ease-in-out infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2.5rem;
  align-items: flex-end;
  justify-content: space-between;
}
.hero-row > div { min-width: 0; }

.hero-name {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: .96;
  letter-spacing: -.005em;
  text-transform: uppercase;
  margin: .15rem 0 .25rem;
}
.hero-meta {
  display: flex;
  gap: .8rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: .9rem;
  margin-top: .15rem;
}
.hero-meta .dot { color: var(--text-3); }

.hero-stats {
  display: flex;
  gap: clamp(1.2rem, 3vw, 2.4rem);
}
.hero-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.hero-stats .stat .num {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero-stats .stat.accent .num { color: var(--lime); }
.hero-stats .stat.live .num { color: var(--rosso); }
.hero-stats .stat .label {
  font-family: var(--ff-display);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: .2rem;
}

/* STATUS PILL */

.pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .25rem .65rem .25rem .55rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-family: var(--ff-display);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2);
  border-radius: 2px;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.pill.in_corso { color: var(--rosso); border-color: var(--rosso); background: rgba(217, 40, 31, .08); }
.pill.in_corso::before { background: var(--rosso); animation: pulse 1.2s ease-in-out infinite; }
.pill.programmata { color: var(--lime); border-color: rgba(232,90,11,.5); background: rgba(232, 90, 11, .1); }
.pill.programmata::before { background: var(--lime); }
.pill.conclusa { color: var(--text-2); }
.pill.conclusa::before { background: var(--text-3); }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .4; }
}

/* ============================================================
   TAB BAR — segmented buttons
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  margin: 1.6rem 0 1.4rem;
  flex-wrap: wrap;
}
.tabs a {
  padding: .65rem 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-family: var(--ff-display);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2);
  border-radius: 2px;
  transition: all .15s;
}
.tabs a:hover { color: var(--text); border-color: var(--line-2); background: var(--bg-3); }
.tabs a.active {
  color: var(--bg);
  background: var(--lime);
  border-color: var(--lime);
}

/* ============================================================
   LEADERBOARD — race timing table
   ============================================================ */

.lb {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.lb thead th {
  background: var(--bg-3);
  border-bottom: 2px solid var(--line);
  padding: .75rem .9rem;
  text-align: left;
  font-family: var(--ff-display);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}
.lb thead th.r { text-align: right; }
.lb thead th.c { text-align: center; }
.lb tbody td {
  padding: .85rem .9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.lb tbody tr { transition: background .12s; }
.lb tbody tr:hover { background: var(--bg-3); }
.lb tbody tr:last-child td { border-bottom: 0; }
.lb td.r { text-align: right; }
.lb td.c { text-align: center; }

.lb td.pos {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
  width: 64px;
  letter-spacing: -.02em;
}
.lb td.pos .ord { color: var(--text-3); font-size: .8rem; font-weight: 500; margin-left: 1px; vertical-align: super; }
.lb tr.gold td.pos { color: var(--gold); }
.lb tr.silver td.pos { color: var(--silver); }
.lb tr.bronze td.pos { color: var(--bronze); }
.lb tr.gold { background: linear-gradient(90deg, rgba(184, 134, 31, .14), transparent 40%); }
.lb tr.silver { background: linear-gradient(90deg, rgba(112, 120, 128, .12), transparent 40%); }
.lb tr.bronze { background: linear-gradient(90deg, rgba(154, 94, 37, .13), transparent 40%); }

.lb td.bib {
  font-family: var(--ff-mono);
  font-size: .82rem;
  color: var(--text-3);
  width: 70px;
}

.lb td.who {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.15;
}
.lb td.who a { color: inherit; }
.lb td.who a:hover { color: var(--lime); }
.lb td.who small {
  display: block;
  font-family: var(--ff-body);
  font-size: .76rem;
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  margin-top: .15rem;
}

.lb td.cps {
  font-family: var(--ff-mono);
  font-size: .85rem;
  color: var(--text-2);
  width: 90px;
}
.lb td.cps .filled { color: var(--lime); }

.lb td.time {
  font-family: var(--ff-mono);
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
  width: 110px;
  letter-spacing: -.02em;
}
.lb td.time-dash { color: var(--text-3); }

.lb tr.dnf td.pos { color: var(--text-3); }
.lb tr.dnf td.who { color: var(--text-3); }
.lb tr.dnf td.who a { color: var(--text-3); }
.lb tr.dnf td.time { color: var(--text-3); }
.lb tr.dnf .dnf-tag {
  display: inline-block;
  font-family: var(--ff-display);
  font-size: .68rem;
  letter-spacing: .14em;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-3);
  padding: .15rem .45rem;
  border-radius: 2px;
}

@media (max-width: 720px) {
  .lb td.bib { display: none; }
  .lb th.bib { display: none; }
  .lb td, .lb th { padding: .65rem .55rem; }
  .lb td.pos { font-size: 1.2rem; width: 44px; }
  .lb td.who { font-size: .92rem; }
  .lb td.time { width: 80px; font-size: .85rem; }
}

/* ============================================================
   PASSAGGI — compact matrix table
   ============================================================ */

.matrix {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.matrix thead th {
  background: var(--bg-3);
  padding: .65rem .55rem;
  font-family: var(--ff-display);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 2px solid var(--line);
  text-align: center;
  vertical-align: bottom;
}
.matrix thead th:first-child { text-align: left; min-width: 200px; }
.matrix thead th .cp-tipo { display: block; font-size: .6rem; color: var(--text-4); margin-top: .15rem; letter-spacing: .12em; }
.matrix thead th.partenza { color: var(--lime); }
.matrix thead th.arrivo { color: var(--rosso); }

.matrix tbody td {
  padding: .65rem .55rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-family: var(--ff-mono);
  font-size: .82rem;
  color: var(--text-2);
  white-space: nowrap;
}
.matrix tbody td:first-child {
  text-align: left;
  font-family: var(--ff-display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .92rem;
  color: var(--text);
  letter-spacing: .02em;
}
.matrix tbody td:first-child small {
  display: block;
  font-family: var(--ff-body);
  font-size: .72rem;
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}
.matrix tbody td.hit { color: var(--text); }
.matrix tbody td.miss { color: var(--text-4); }
.matrix tbody td.miss::before { content: '—'; }
.matrix tbody td.partenza.hit { color: var(--lime); }
.matrix tbody td.arrivo.hit { color: var(--rosso); }

.matrix tbody tr:hover td { background: var(--bg-3); }

/* ============================================================
   STATISTICHE — checkpoint metric tiles
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.stat-tile {
  padding: 1.4rem 1.4rem 1.5rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
}
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: 1fr; }
}
.stat-tile.partenza { background: rgba(232,90,11,.07); }
.stat-tile.arrivo { background: rgba(217, 40, 31, .07); }

.stat-tile .stat-tipo {
  font-family: var(--ff-display);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: .35rem;
}
.stat-tile.partenza .stat-tipo { color: var(--lime); }
.stat-tile.arrivo .stat-tipo { color: var(--rosso); }
.stat-tile .stat-name {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.05;
  margin: 0 0 1rem;
}
.stat-tile .stat-pass {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: 1rem;
}
.stat-tile .stat-pass .num {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-tile .stat-pass .lbl {
  font-family: var(--ff-display);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.stat-rows {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .55rem 1rem;
  font-family: var(--ff-mono);
  font-size: .85rem;
  align-items: center;
}
.stat-rows .key {
  font-family: var(--ff-display);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stat-rows .val { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.stat-rows .val.avg { color: var(--lime); font-weight: 500; }
.stat-rows .bar {
  height: 3px;
  background: var(--line);
  position: relative;
  border-radius: 2px;
  overflow: visible;
}
.stat-rows .bar .seg {
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  background: var(--text-4);
}
.stat-rows .bar.with-marker .marker {
  position: absolute;
  top: -3px;
  width: 9px; height: 9px;
  background: var(--lime);
  transform: translateX(-50%);
  border-radius: 50%;
}

.stat-tile.no-data .stat-pass .num { color: var(--text-3); }
.stat-tile .empty-msg {
  font-family: var(--ff-display);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ============================================================
   GARE INDEX — race cards
   ============================================================ */

.gare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.gara-card {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: 1.4rem 1.4rem 1.6rem;
  background: var(--bg-2);
  color: var(--text);
  position: relative;
  transition: background .18s;
  border-bottom: 0;
}
.gara-card:hover { background: var(--bg-3); color: var(--text); }
.gara-card .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.gara-card .when {
  font-family: var(--ff-display);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-3);
}
.gara-card.in_corso .when { color: var(--rosso); }
.gara-card h2 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: -.005em;
  text-transform: uppercase;
  margin: .2rem 0;
  color: var(--text);
}
.gara-card p {
  color: var(--text-2);
  margin: 0;
  font-size: .9rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gara-card .footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: .6rem;
}
.gara-card .footer .arrow {
  font-family: var(--ff-display);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.gara-card.in_corso .footer .arrow { color: var(--rosso); }
.gara-card.programmata .footer .arrow { color: var(--lime); }
.gara-card:hover .footer .arrow { color: var(--text); }

/* YEAR FILTER */

.filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 1.4rem 0 1.6rem;
}
.filter-btn {
  padding: .45rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-family: var(--ff-display);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-2);
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.filter-btn:hover { border-color: var(--line-2); color: var(--text); background: var(--bg-3); }
.filter-btn.active { background: var(--lime); color: var(--bg); border-color: var(--lime); }

/* ============================================================
   EMPTY / META
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  font-family: var(--ff-display);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: 2rem;
  font-family: var(--ff-display);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.back-link::before { content: '←'; color: var(--lime); }
.back-link:hover { color: var(--text); }

footer.bottom {
  border-top: 1px solid var(--line);
  padding: 1.6rem clamp(1rem, 3vw, 2.4rem);
  margin-top: 4rem;
  text-align: center;
  font-family: var(--ff-display);
  font-size: .76rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ============================================================
   CONCORRENTE — athlete profile dashboard
   ============================================================ */

.profile-board {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  margin-bottom: 1.4rem;
}
.profile-board .ath-name {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: .95;
  letter-spacing: -.005em;
  text-transform: uppercase;
  margin: .15rem 0 .25rem;
}
.profile-board .ath-name .first {
  color: var(--lime);
}
.profile-board .ath-society {
  font-family: var(--ff-display);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: .4rem;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin-top: 1.4rem;
  background: var(--line);
}
.profile-stats .ps {
  background: var(--bg-2);
  padding: 1rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
}
.profile-stats .ps .num {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.profile-stats .ps.accent .num { color: var(--lime); }
.profile-stats .ps .label {
  font-family: var(--ff-display);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: .35rem;
}
.profile-stats .ps .num.tm {
  font-family: var(--ff-mono);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 500;
}

/* PAGE LOAD ANIMATION */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: rise .5s cubic-bezier(.2,.8,.2,1) forwards;
}
.reveal:nth-child(1) { animation-delay: .03s; }
.reveal:nth-child(2) { animation-delay: .09s; }
.reveal:nth-child(3) { animation-delay: .15s; }
.reveal:nth-child(4) { animation-delay: .21s; }
.reveal:nth-child(5) { animation-delay: .27s; }
.reveal:nth-child(6) { animation-delay: .33s; }
.reveal:nth-child(n+7) { animation-delay: .40s; }

@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reveal, .pill.in_corso::before, .hero-board.live::after { animation: none !important; opacity: 1; transform: none; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

::selection { background: var(--lime); color: #fff; }

/* ============================================================
   SENIOR-FRIENDLY + MOBILE TWEAKS (public)
   ============================================================ */

html, body { font-size: 17px; }

.topbar { height: 64px; padding: 0 clamp(1rem, 3vw, 2rem); }
.brand { font-size: 1.2rem; }
.topbar nav a { font-size: .92rem; letter-spacing: .08em; padding: 0 1rem; }

/* Bigger tab buttons (mobile-friendly touch targets) */
.tabs a {
  padding: .85rem 1.3rem;
  font-size: .92rem;
  letter-spacing: .08em;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

/* Hero-board stats: bigger and more breathing */
.hero-stats .stat .num { font-size: clamp(2.2rem, 5vw, 3rem); }
.hero-stats .stat .label { font-size: .78rem; letter-spacing: .1em; }
.hero-name { font-size: clamp(2.2rem, 6vw, 3.8rem); }
.hero-meta { font-size: 1rem; }

/* Leaderboard table: readable on mobile */
.lb thead th { padding: .9rem .85rem; font-size: .78rem; letter-spacing: .1em; }
.lb tbody td { padding: 1rem .85rem; font-size: 1rem; }
.lb td.pos { font-size: 1.7rem; }
.lb td.who { font-size: 1.1rem; }

/* Filters/pills bigger on mobile */
.filter-btn { padding: .55rem 1.1rem; font-size: .82rem; letter-spacing: .08em; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; }

.pill { font-size: .8rem; padding: .3rem .8rem .3rem .65rem; letter-spacing: .08em; }
.pill::before { width: 8px; height: 8px; }

/* Card cards arrow visible */
.gara-card h2 { font-size: 1.75rem; letter-spacing: 0; }
.gara-card .footer .arrow { font-size: .82rem; letter-spacing: .08em; }
.gara-card .when { font-size: .82rem; letter-spacing: .1em; }
.gara-card p { font-size: 1rem; line-height: 1.5; }

/* ============================================================
   MOBILE — < 720px
   ============================================================ */

@media (max-width: 720px) {
  html, body { font-size: 16px; }

  /* Topbar: tighter */
  .topbar { padding: 0 1rem; height: 56px; }
  .brand { font-size: 1.05rem; gap: .5rem; }
  .topbar nav { gap: 0; }
  .topbar nav a { padding: 0 .65rem; font-size: .78rem; }

  main { padding: 1.4rem 1rem 4rem; }

  /* Hero stacks */
  .hero-board { padding: 1.2rem 1rem 1.4rem; }
  .hero-row { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .hero-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: .8rem;
    padding-top: .8rem;
    border-top: 1px solid var(--line);
  }
  .hero-stats .stat .num { font-size: 1.8rem; }
  .hero-stats .stat .label { font-size: .68rem; }

  .hero-name { font-size: 1.9rem; line-height: 1; }
  .hero-meta { font-size: .9rem; }
  .hero-board.live::after { font-size: .72rem; padding: .2rem .5rem; }

  /* Tabs */
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { padding: .75rem .9rem; font-size: .8rem; letter-spacing: .04em; flex-shrink: 0; }

  /* Leaderboard table -> compact card-like */
  .lb { font-size: .9rem; }
  .lb thead th { padding: .6rem .5rem; font-size: .68rem; letter-spacing: .06em; }
  .lb tbody td { padding: .8rem .5rem; }
  .lb td.pos { font-size: 1.35rem; width: 44px; }
  .lb td.pos .ord { font-size: .65rem; }
  .lb td.who { font-size: .94rem; }
  .lb td.who small { font-size: .78rem; }
  .lb td.time { font-size: .9rem; width: 88px; }
  .lb td.cps { font-size: .82rem; width: 64px; }
  .lb td.bib, .lb th.bib { display: none; }
  /* On very small screens, also hide società column */
  @media (max-width: 480px) {
    .lb td:nth-child(4), .lb th:nth-child(4) { display: none; }
  }

  /* Matrix table (passaggi): stack as concorrente-card with chips */
  .matrix { border: 0; background: transparent; }
  .matrix thead { display: none; }
  .matrix tbody tr {
    display: block;
    background: var(--bg-2);
    border: 1px solid var(--line);
    margin-bottom: .8rem;
    padding: 1rem;
  }
  .matrix tbody td {
    display: inline-block;
    border: 1px solid var(--line);
    padding: .4rem .65rem !important;
    margin: .25rem .2rem .25rem 0 !important;
    font-size: .82rem;
    background: var(--bg-3);
    border-radius: 4px;
    white-space: nowrap;
  }
  .matrix tbody td:first-child {
    display: block;
    border: 0;
    background: transparent;
    padding: 0 0 .6rem !important;
    margin: 0 0 .6rem !important;
    border-bottom: 1px solid var(--line);
    font-size: 1.1rem;
    border-radius: 0;
  }
  .matrix tbody td:first-child small { font-size: .8rem; }
  .matrix tbody td.miss::before { content: '— '; color: var(--text-4); }

  /* Stat cards: 1 col, full width */
  .stat-grid { grid-template-columns: 1fr; }
  .stat-tile { border-right: 0 !important; }
  .stat-tile .stat-name { font-size: 1.25rem; }

  /* Gare cards single column */
  .gare-grid { grid-template-columns: 1fr; }
  .gara-card { padding: 1.2rem 1rem 1.4rem; }
  .gara-card h2 { font-size: 1.45rem; }

  /* Profile board: stats stack in 2 cols */
  .profile-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .profile-board { padding: 1.2rem 1rem; }
  .profile-board .ath-name { font-size: 2rem; }
}

/* Tabella pubblica unificata: colonne checkpoint dentro .lb (riuso dello stile .matrix) */
.lb th.cp, .lb td.cp { text-align: center; white-space: nowrap; font-family: 'JetBrains Mono', monospace; font-size: .82rem; }
.lb thead th.cp { font-family: inherit; }
.lb th.cp .cp-tipo { display: block; font-size: .6rem; color: var(--text-4); margin-top: .15rem; letter-spacing: .12em; text-transform: uppercase; }
.lb td.cp.hit { color: var(--text); }
.lb td.cp.miss { color: var(--text-4); }
.lb td.cp.miss::before { content: '—'; }
.lb th.cp.partenza, .lb td.cp.partenza.hit { color: var(--lime); }
.lb th.cp.arrivo, .lb td.cp.arrivo.hit { color: var(--rosso); }

