/* ===========================================================
   inpedana.com · Movimento design system
   2026-05-08 - Montserrat, sage / GR magenta / butter
   =========================================================== */

/* --- 1. Tokens ---------------------------------------- */
:root {
    --c-primary:        #3E5C42;
    --c-primary-hover:  #2D4530;
    --c-primary-soft:   rgba(62, 92, 66, 0.08);
    --c-primary-ring:   rgba(62, 92, 66, 0.18);

    --c-accent:         #E63E81;
    --c-accent-hover:   #C92E6E;
    --c-accent-soft:    rgba(230, 62, 129, 0.10);
    --c-accent-strong:  rgba(230, 62, 129, 0.18);

    --c-highlight:      #FFD592;
    --c-highlight-soft: rgba(255, 213, 146, 0.35);

    --c-error:          #C0362F;

    --c-text:           #1A2418;
    --c-text-muted:     #5A655A;
    --c-text-faint:     #8E978D;

    --c-border:         #DCD8CC;
    --c-border-strong:  #B8B5A8;
    --c-bg:             #F6F4EE;
    --c-card:           #FFFFFF;

    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  1.5rem;
    --space-lg:  2rem;
    --space-xl:  3rem;
    --space-2xl: 4rem;

    --radius-sm:   4px;
    --radius:      8px;
    --radius-lg:   16px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 6%);
    --shadow:    0 1px 3px rgb(0 0 0 / 10%), 0 1px 2px rgb(0 0 0 / 6%);
    --shadow-lg: 0 10px 25px rgb(0 0 0 / 8%), 0 4px 10px rgb(0 0 0 / 6%);

    --header-h:    4rem;
    --content-max: 56rem;

    --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

/* --- 2. Reset + base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--c-primary-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1.2;
}
h1 { font-size: 2rem; letter-spacing: -0.022em; }
h2 { font-size: 1.375rem; letter-spacing: -0.015em; }
h3 { font-size: 1.0625rem; }

p { margin: 0; }
em { font-style: normal; color: var(--c-text); font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.9em; }

::selection { background: var(--c-accent-soft); color: var(--c-text); }
:focus-visible { outline: 3px solid var(--c-primary-ring); outline-offset: 2px; border-radius: 2px; }

/* --- 3. Layout chrome --------------------------------- */
header {
    padding: 0 var(--space-lg);
    height: var(--header-h);
    border-bottom: 1px solid var(--c-border);
    background: rgba(246, 244, 238, 0.85);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: var(--space-md);
}
header .logo {
    font-weight: 700;
    letter-spacing: -0.022em;
    font-size: 1.0625rem;
    color: var(--c-text);
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
}
header .logo:hover { color: var(--c-text); text-decoration: none; }
header .logo::after {
    content: "";
    width: 0.42em; height: 0.42em;
    border-radius: var(--radius-pill);
    background: var(--c-accent);
    display: inline-block;
    transform: translateY(-0.05em);
}
header .tag {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    letter-spacing: 0.005em;
}
@media (max-width: 540px) {
    header .tag { display: none; }
}

main {
    max-width: var(--content-max);
    margin: var(--space-xl) auto var(--space-lg);
    padding: 0 var(--space-lg);
}

footer {
    margin-top: var(--space-2xl);
    padding: var(--space-lg) var(--space-lg) var(--space-2xl);
    border-top: 1px solid var(--c-border);
    text-align: center;
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    line-height: 1.7;
}
footer a { color: var(--c-primary); font-weight: 500; }

/* --- 4. Helpers --------------------------------------- */
.muted { color: var(--c-text-muted); }
.small { font-size: 0.8125rem; }

/* --- 5. Search (homepage) ----------------------------- */
.search { max-width: 36rem; margin: var(--space-xl) auto 0; padding-top: var(--space-md); }
.search h1 {
    font-size: clamp(1.875rem, 3vw + 1rem, 2.625rem);
    letter-spacing: -0.028em;
    margin-bottom: var(--space-xs);
}
.search > .muted {
    margin-bottom: var(--space-md);
    font-size: 0.9375rem;
    color: var(--c-text-muted);
}
.search input[type=search] {
    font-family: inherit;
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: var(--space-md);
    background: var(--c-card);
    color: var(--c-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}
.search input[type=search]::placeholder { color: var(--c-text-faint); }
.search input[type=search]:hover { border-color: var(--c-border-strong); }
.search input[type=search]:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-ring);
}

/* --- 6. Search results list --------------------------- */
ul.results {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
ul.results li {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
ul.results li:hover {
    border-color: var(--c-border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
ul.results a {
    display: block;
    padding: 0.875rem 1rem;
    color: var(--c-text);
}
ul.results a:hover { text-decoration: none; }
ul.results .name {
    font-weight: 600;
    display: block;
    font-size: 0.9375rem;
    letter-spacing: -0.005em;
}
ul.results .team {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    display: block;
    margin-top: 0.125rem;
}
ul.results .meta {
    color: var(--c-text-faint);
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

h3.results-section {
    margin: var(--space-md) 0 var(--space-xs) 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--c-text-muted);
}
h3.results-section:first-child { margin-top: 0; }

/* Live-pill chrome on athlete search results. The pill is a sibling of the
   main result link (anchors don't nest in HTML), styled inline-flex so it
   sits on its own row inside the same card. Two variants:
     --in-gara   (red, pulsing)  - at least one score landed
     --iscritta  (yellow, calm)  - in roster only */
ul.results li.has-live { border-color: rgba(192, 57, 43, 0.35); }
.live-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem 1rem;
    margin-top: -0.25rem;
}
ul.results .live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    border: 1px solid;
}
ul.results .live-pill--in-gara {
    background: #fff4f4;
    border-color: #f0c4c4;
    color: #a93226;
    animation: badge-live-pulse 2s ease-in-out infinite;
}
ul.results .live-pill--in-gara:hover {
    background: #ffe9e9;
    border-color: #e0a8a8;
    text-decoration: none;
}
ul.results .live-pill--iscritta {
    background: #fffaeb;
    border-color: #ecd9a3;
    color: #8a6d1a;
}
ul.results .live-pill--iscritta:hover {
    background: #fff4d4;
    border-color: #d8be7c;
    text-decoration: none;
}
ul.results .live-pill--conclusa {
    background: #effaf0;
    border-color: #b6dfb9;
    color: #2e7d32;
}
ul.results .live-pill--conclusa:hover {
    background: #e1f3e3;
    border-color: #95cf99;
    text-decoration: none;
}
.live-pill__label { font-weight: 600; }
.live-pill__event {
    font-weight: 500;
    max-width: 28ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-pill--in-gara  .live-pill__event { color: #6b2017; }
.live-pill--iscritta .live-pill__event { color: #5b4710; }
.live-pill--conclusa .live-pill__event { color: #1b5e20; }
.live-pill__rank {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    margin-left: 0.1rem;
}

/* Athlete profile: live-event banner above the snapshot. Distinct from
   the compact pill on search-results - this surface has more room and
   rewards showing the rank/score (in_gara) or apparatus list (iscritta)
   inline. */
#athlete-live-banner { display: contents; }
a.live-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    margin: 0 0 0.75rem 0;
    border-radius: var(--radius);
    text-decoration: none;
    border: 1px solid;
    border-left-width: 3px;
}
a.live-banner--in-gara {
    background: linear-gradient(90deg, #fff4f4 0%, #fff8f8 100%);
    border-color: #f0c4c4;
    border-left-color: #c0392b;
    color: #6b2017;
    box-shadow: 0 1px 2px rgba(192, 57, 43, 0.06);
    animation: badge-live-pulse 2s ease-in-out infinite;
}
a.live-banner--in-gara:hover {
    background: linear-gradient(90deg, #ffe9e9 0%, #fff4f4 100%);
    text-decoration: none;
    border-color: #e0a8a8;
}
a.live-banner--iscritta {
    background: linear-gradient(90deg, #fffaeb 0%, #fffcf3 100%);
    border-color: #ecd9a3;
    border-left-color: #c89712;
    color: #5b4710;
    box-shadow: 0 1px 2px rgba(200, 151, 18, 0.06);
}
a.live-banner--iscritta:hover {
    background: linear-gradient(90deg, #fff4d4 0%, #fff9e3 100%);
    text-decoration: none;
    border-color: #d8be7c;
}
a.live-banner--conclusa {
    background: linear-gradient(90deg, #effaf0 0%, #f5fbf6 100%);
    border-color: #b6dfb9;
    border-left-color: #2e7d32;
    color: #1b5e20;
    box-shadow: 0 1px 2px rgba(46, 125, 50, 0.06);
}
a.live-banner--conclusa:hover {
    background: linear-gradient(90deg, #e1f3e3 0%, #ecf7ee 100%);
    text-decoration: none;
    border-color: #95cf99;
}
.live-banner__dot { font-size: 0.8rem; line-height: 1; }
.live-banner__text {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}
.live-banner__label {
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.live-banner--in-gara  .live-banner__label { color: #a93226; }
.live-banner--iscritta .live-banner__label { color: #8a6d1a; }
.live-banner--conclusa .live-banner__label { color: #2e7d32; }

/* Homepage: In gara ora + Ultime gare lists.
   The section itself is the card - own border, padding, rounded corners.
   Inner list items have no individual border; just a hairline rule between
   rows so we don't get a double-boxed look. The "live" section gets a
   tinted accent on its top border to set it apart from "ultime gare". */
section.home-events {
    margin-top: var(--space-lg);
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
}
section.home-events--live {
    border-top: 2px solid #c0392b;
}
section.home-events h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--c-text-muted);
    margin: 0 0 0.6rem 0;
}
section.home-events--live h2 { color: #a93226; }
ul.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
ul.event-list li {
    border-top: 1px solid var(--c-border);
    transition: background 0.12s ease;
}
ul.event-list li:first-child { border-top: 0; }
ul.event-list li:hover {
    background: var(--c-bg);
}
ul.event-list a {
    display: grid;
    grid-template-columns: 1.4rem minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.55rem 0.4rem;
    color: var(--c-text);
    text-decoration: none;
    border-radius: 4px;
}
ul.event-list a:hover { text-decoration: none; }
.event-list__dot { font-size: 0.78rem; line-height: 1; }
.event-list__dot--live { animation: badge-live-pulse 2s ease-in-out infinite; }
.event-list__name {
    font-weight: 500;
    font-size: 0.9375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.event-list__meta {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

/* Inline status dot rendered next to athlete names on team / athlete pages
   when the athlete is competing today. Non-clickable; the dot color
   matches the existing pill+banner palette so the visual language stays
   consistent across surfaces. */
.status-dot {
    display: inline-block;
    margin-right: 0.3rem;
    font-size: 0.65rem;
    line-height: 1;
    vertical-align: 0.05em;
    cursor: help;
}
.status-dot--in-gara  { animation: badge-live-pulse 2s ease-in-out infinite; }

/* GDPR-K takedown contact at the bottom of every athlete page. Soft,
   not the visual focus, but always visible. */
p.privacy-takedown {
    margin-top: var(--space-lg);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--c-border);
    text-align: center;
}

/* /status page: traffic-light health rows + facts dl. */
article.status header h1 {
    margin-bottom: 0.4rem;
}
.status-overall {
    font-weight: 600;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid;
}
.status-overall.status-ok    { color: #2e7d32; background: #effaf0; border-color: #b6dfb9; }
.status-overall.status-warn  { color: #8a6d1a; background: #fffaeb; border-color: #ecd9a3; }
.status-overall.status-crit  { color: #a93226; background: #fff4f4; border-color: #f0c4c4; }

section.status-list {
    margin: var(--space-md) 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.status-row {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-border);
    border-radius: var(--radius);
}
.status-row.status-ok    { border-left-color: #4caf50; }
.status-row.status-warn  { border-left-color: #c89712; background: #fffdf6; }
.status-row.status-crit  { border-left-color: #c0392b; background: #fff8f8; }
.status-row__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.status-row__title {
    font-weight: 600;
    font-size: 0.95rem;
}
.status-row__detail {
    font-size: 0.8125rem;
}

section.status-info {
    margin-top: var(--space-md);
}
section.status-info h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--c-text-muted);
    margin: 0 0 var(--space-xs) 0;
}
dl.status-dl {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem 1.2rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}
dl.status-dl dt {
    color: var(--c-text-muted);
    font-size: 0.875rem;
}
dl.status-dl dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    text-align: right;
    font-size: 0.875rem;
}
p.status-footnote { margin-top: var(--space-md); }

/* Event page: per-fascia heading is a drill-in link to the
   ?fascia=...filtered view of the same event. Inherits the h2 colour so
   it doesn't read as a generic link; hover underlines + nudges a small
   arrow to signal clickability. */
h2 a.fascia-drill {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
h2 a.fascia-drill::after {
    content: " →";
    color: var(--c-primary);
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.15s ease;
}
h2 a.fascia-drill:hover {
    color: var(--c-primary);
    text-decoration: none;
}
h2 a.fascia-drill:hover::after { opacity: 1; }

/* Event page: 'sto vedendo solo X' banner, sits between the header and
   the results sections when ?fascia= is applied. Top margin gives it
   breathing room from the h1 + meta line above. */
.event-fascia-filter {
    margin: 1rem 0;
    padding: 0.55rem 0.85rem;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--c-text-muted);
}
.event-fascia-filter strong { color: var(--c-text); }
.live-banner__event {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-banner__fascia {
    color: var(--c-text-muted);
    font-size: 0.875rem;
}
.live-banner__score {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.live-banner__total { font-weight: 600; }

/* --- 7. Athlete + Team page header -------------------- */
article.athlete > header,
article.team > header {
    border: none;
    background: transparent;
    display: block;
    padding: 0;
    height: auto;
    position: static;
    margin-bottom: var(--space-md);
}
article.athlete header h1,
article.team header h1 {
    font-size: clamp(1.625rem, 2.5vw + 1rem, 2rem);
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

/* Team header with optional logo + description. Falls back gracefully when
   the team hasn't uploaded branding yet. */
article.team header.team-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}
article.team header .team-logo {
    width: 5rem;
    height: 5rem;
    flex-shrink: 0;
    object-fit: contain;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.4rem;
    box-shadow: var(--shadow-sm);
}
article.team header .team-header__info {
    flex: 1;
    min-width: 0;
}
article.team header .team-description {
    color: var(--c-text);
    font-size: 0.9375rem;
    line-height: 1.55;
    margin: 0.5rem 0 0;
    max-width: 44rem;
}
@media (max-width: 540px) {
    article.team header.team-header { gap: var(--space-sm); }
    article.team header .team-logo { width: 3.5rem; height: 3.5rem; padding: 0.25rem; }
}
article.athlete header .meta,
article.team header .meta {
    color: var(--c-text-muted);
    font-size: 0.9375rem;
    margin: 0;
}
article.athlete header .meta a,
article.team header .meta a { color: var(--c-primary); font-weight: 500; }

p.actions {
    margin: 0 0 var(--space-md) 0;
}
p.actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--c-accent);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    background: var(--c-accent-soft);
    transition: background 0.15s ease;
}
p.actions a:hover {
    background: var(--c-accent-strong);
    color: var(--c-accent-hover);
    text-decoration: none;
}

/* --- 8. Snapshot stat tiles --------------------------- */
.snapshot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.snapshot::before {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 10rem; height: 10rem;
    background: radial-gradient(circle at top right, var(--c-accent-soft), transparent 65%);
    pointer-events: none;
    z-index: 0;
}
.snapshot > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.875rem;
    background: var(--c-bg);
    border-radius: var(--radius);
    position: relative;
    z-index: 1;
}
.snapshot .num {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.022em;
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.snapshot .lab {
    color: var(--c-text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Per-specialty chip row - appears below .snapshot when the athlete sits
   in a single tier (Gold-only or Silver-only), to fill the visual space
   that would otherwise be three tiles of zeros. */
.specialty-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 var(--space-md) 0;
    padding: 0.75rem 1rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.specialty-row .eyebrow {
    color: var(--c-text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-right: 0.25rem;
}
.specialty-row .chip {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    border-radius: var(--radius-pill);
    padding: 0.25rem 0.7rem 0.25rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    line-height: 1.4;
}
.specialty-row .chip__count {
    color: var(--c-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- 9. Charts ---------------------------------------- */
.chart-wrap {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}
.chart-wrap h2 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-text-muted);
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.charts-row > .chart-wrap.half { margin-bottom: 0; }
@media (max-width: 720px) {
    .charts-row { grid-template-columns: 1fr; }
}

/* --- 10. Year accordion ------------------------------- */
details.year-accordion {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    padding: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
details.year-accordion[open] {
    border-color: var(--c-border-strong);
    box-shadow: var(--shadow-sm);
}
details.year-accordion summary {
    cursor: pointer;
    list-style: none;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 0.9375rem;
    user-select: none;
}
details.year-accordion summary::-webkit-details-marker { display: none; }
details.year-accordion summary::before {
    content: "›";
    color: var(--c-primary);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-block;
    transition: transform 0.18s ease;
    transform: translateY(-1px);
    margin-right: 0.1rem;
    width: 0.6rem;
}
details.year-accordion[open] summary::before {
    transform: rotate(90deg) translateX(-1px);
}
details.year-accordion .year-label {
    font-weight: 700;
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
    color: var(--c-text);
    letter-spacing: -0.015em;
}
details.year-accordion .year-content {
    padding: 0 1rem 1rem 1rem;
}

/* --- 11. Tables --------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.875rem;
}
th, td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}
thead th {
    background: var(--c-bg);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--c-bg); }
tr:last-child td { border-bottom: none; }

table.year-results { margin: 0; box-shadow: none; }
tr.specialty-detail > td {
    background: var(--c-bg);
    padding: 0.4rem 0.5rem 0.6rem 1.5rem;
    border-bottom: none;
}
table.specialties {
    border: 1px solid var(--c-border);
    background: var(--c-card);
    margin: 0;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}
table.specialties th, table.specialties td {
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
}
table.specialties th { background: rgba(0, 0, 0, 0.02); }

/* Event ranking: per-row expand to per-specialty breakdown */
table.event-ranking th.col-toggle,
table.event-ranking td.col-toggle { width: 1.6rem; padding-right: 0; }
button.specialty-toggle {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0.1rem 0.25rem;
    cursor: pointer;
    color: var(--c-primary);
    font-weight: 700;
    line-height: 1;
}
button.specialty-toggle::before {
    content: "›";
    font-size: 1.1rem;
    display: inline-block;
    transition: transform 0.18s ease;
}
button.specialty-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
}
button.specialty-toggle:hover { color: var(--c-primary-hover); }
button.specialty-toggle:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Live event chrome: status banner above the result tables.
   Top margin pushes it off the event header (h1 + meta line) so the
   '🔴 In corso' badge doesn't crowd the title. */
.event-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 1rem 0;
    min-height: 1.5rem;
}
/* When the event-fascia-filter banner is the previous sibling, drop
   .event-status's top margin to its own bottom margin so we don't
   stack the gap twice. */
.event-fascia-filter + #event-results .event-status { margin-top: 0; }
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    background: #fff4f4;
    color: #c0392b;
    border: 1px solid #f0c4c4;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    animation: badge-live-pulse 2s ease-in-out infinite;
}
@keyframes badge-live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.0); }
    50%      { box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.10); }
}
@media (prefers-reduced-motion: reduce) {
    .badge-live { animation: none; }
}
tr.preliminary > td { opacity: 0.78; font-style: italic; }
tr.preliminary > td.rank { font-style: normal; }

/* Rank colors */
.rank {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.rank-1 { color: var(--c-accent); }
.rank-2 { color: var(--c-primary); }
.rank-3 { color: #B5783A; }            /* warm bronze */

/* --- 12. .results section headings -------------------- */
.results { margin-top: var(--space-md); }
.results h2 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 1.125rem;
    letter-spacing: -0.012em;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.results h2 .small { font-weight: 500; color: var(--c-text-muted); }

/* --- 13. Suggest cards (rivals / teammates) ----------- */
.suggest h2 {
    margin: var(--space-md) 0 var(--space-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-text-muted);
}
.suggest-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    margin-bottom: var(--space-md);
}
.suggest-card {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.875rem 1rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    color: var(--c-text);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.suggest-card:hover {
    border-color: var(--c-border-strong);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.suggest-card .name {
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.005em;
}
.suggest-card .team {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
}

/* --- 14. Team page leaderboards ----------------------- */
.leader-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 0.75rem 0 var(--space-md) 0;
}
@media (max-width: 540px) { .leader-row { grid-template-columns: 1fr; } }
.leader-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-sm);
}
.leader-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--c-text-muted);
}
.leader-card ol { list-style: none; padding: 0; margin: 0; }
.leader-card li {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.4rem 0;
    font-size: 0.9375rem;
}
.leader-card li + li { border-top: 1px solid var(--c-border); }
.leader-card .metric {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}
.leader-card a { color: var(--c-text); font-weight: 500; }
.leader-card a:hover { color: var(--c-primary); text-decoration: none; }

/* --- 15. Squad results --------------------------------- */
.squad-details > summary {
    cursor: pointer;
    color: var(--c-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5rem 0;
    user-select: none;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.squad-details > summary::-webkit-details-marker { display: none; }
.squad-details > summary::before {
    content: "›";
    font-weight: 700;
    font-size: 1rem;
    display: inline-block;
    transition: transform 0.18s ease;
}
.squad-details[open] > summary::before { transform: rotate(90deg); }
.squad-details > summary:hover { color: var(--c-primary-hover); text-decoration: none; }
.squad-details[open] > summary { margin-bottom: 0.5rem; }

/* --- 16. Privacy --------------------------------------- */
article.privacy { max-width: 720px; }
article.privacy h1 {
    font-size: 1.875rem;
    letter-spacing: -0.022em;
    margin-bottom: 0.25rem;
}
article.privacy > .small { margin-bottom: var(--space-md); display: block; }
article.privacy h2 {
    margin: var(--space-lg) 0 var(--space-xs);
    font-size: 1.0625rem;
    letter-spacing: -0.012em;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
article.privacy h2::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: var(--radius-pill);
    background: var(--c-accent);
    display: inline-block;
    flex-shrink: 0;
}
article.privacy h2:first-of-type { margin-top: var(--space-md); }
article.privacy p {
    line-height: 1.65;
    margin-bottom: var(--space-sm);
    color: var(--c-text);
}
article.privacy ul {
    padding-left: 1.25rem;
    margin: 0 0 var(--space-sm) 0;
    line-height: 1.7;
}
article.privacy ul li { margin-bottom: 0.25rem; }
article.privacy strong { color: var(--c-text); font-weight: 600; }

/* --- 17. Compare page ---------------------------------- */
article.compare h1 {
    font-size: 1.875rem;
    letter-spacing: -0.022em;
    margin-bottom: var(--space-sm);
}
article.compare > p.muted { margin-bottom: var(--space-md); }

.compare-chips {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-md) 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.compare-chips .chip {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.4rem 0.4rem 0.875rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease;
}
.compare-chips .chip:hover { border-color: var(--c-border-strong); }
.compare-chips .chip .name { font-weight: 600; color: var(--c-text); }
.compare-chips .chip .name:hover { color: var(--c-primary); text-decoration: none; }
.compare-chips .chip .team-link { font-size: 0.75rem; color: var(--c-text-muted); }
.compare-chips .chip .team-link:hover { color: var(--c-primary); text-decoration: none; }
.compare-chips .chip .remove {
    color: var(--c-text-muted);
    text-decoration: none;
    margin-left: 0.25rem;
    padding: 0.05rem 0.5rem;
    border-radius: var(--radius-pill);
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 1rem;
}
.compare-chips .chip .remove:hover {
    background: rgba(192, 54, 47, 0.12);
    color: var(--c-error);
    text-decoration: none;
}

.compare-add h2 {
    margin: 0 0 var(--space-xs);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-text-muted);
}
.compare-add input[type=search] {
    font-family: inherit;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    background: var(--c-card);
    color: var(--c-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.compare-add input[type=search]:hover { border-color: var(--c-border-strong); }
.compare-add input[type=search]:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-ring);
}

/* --- 18. Admin ----------------------------------------- */
.admin-nav {
    display: flex;
    gap: var(--space-md);
    border-bottom: 1px solid var(--c-border);
    padding-bottom: 0.5rem;
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
}
.admin-nav a {
    font-weight: 600;
    color: var(--c-text-muted);
    padding: 0.25rem 0;
}
.admin-nav a:hover { color: var(--c-primary); text-decoration: none; }

.dupe-group { margin: var(--space-md) 0; }
.dupe-group h2 { font-size: 1rem; margin-bottom: 0.5rem; }

.merge-form { display: inline-flex; gap: 0.25rem; align-items: center; }
.merge-form select, .merge-form button {
    font-family: inherit;
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-card);
}
.merge-form button {
    background: var(--c-highlight);
    border-color: var(--c-highlight);
    color: #5C3A0A;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s ease;
}
.merge-form button:hover { background: #FFC470; }

/* admin uses pre.snapshot for raw JSON; reset the .snapshot grid styling for <pre> */
pre.snapshot {
    display: block;
    grid-template-columns: none;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    max-width: 400px;
    overflow-x: auto;
    background: var(--c-bg);
    padding: 0.5rem;
    margin: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    box-shadow: none;
}
pre.snapshot::before { display: none; }

/* Period caption above each .snapshot block on the team page
   ("Storico - 2020-2026" / "Solo 2026"). Same uppercase / muted
   small-cap treatment as .snapshot .lab so the two snapshots feel
   like one visual family. */
.snapshot-label {
    color: var(--c-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: var(--space-md) 0 0.5rem 0;
}
.snapshot-label:first-of-type { margin-top: 0; }

/* "Ultima settimana" table on the team page: just inherits the regular
   article table styles. We only need a small bottom margin so it
   doesn't crowd the Gold section's h2. */
.last-week { margin-bottom: var(--space-md); }
.last-week table { margin-top: 0.5rem; }

/* Tier chip in the last-week table. Two real values (Gold / Silver)
   mirror the chart line colors used elsewhere on the team page; Altro
   gets a neutral fallback because we don't visualise that bucket. */
.tier-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
}
.tier-badge--gold   { background: rgba(230, 62, 129, 0.12); color: rgb(166, 26, 79); }
.tier-badge--silver { background: rgba(62, 92, 66, 0.12);  color: rgb(40, 70, 44); }
.tier-badge--altro  { background: var(--c-border);          color: var(--c-text-muted); }

/* --- Buttons + forms ---------------------------------- */
/* Mirrored from the /dev/styleguide reference so admin + claim forms
   share the same canonical control styles. */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.2;
    padding: 0.625rem 1.125rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.04s ease;
    letter-spacing: 0.005em;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--c-primary-ring); }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-hover); color: #fff; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn--ghost:hover { background: var(--c-primary-soft); color: var(--c-primary); text-decoration: none; }
.btn--danger { background: var(--c-error); color: #fff; }
.btn--danger:hover { filter: brightness(0.92); color: #fff; text-decoration: none; }
/* Yellow CTA for "Reclama questa Società" and similar claim-shaped
   actions. Dark text on the soft yellow stays AA against background. */
.btn--claim {
    background: var(--c-highlight);
    color: #4A3A12;
    border-color: rgba(0, 0, 0, 0.05);
}
.btn--claim:hover {
    background: #F8C16A;
    color: #2E2308;
    text-decoration: none;
}
.btn[disabled], .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: var(--space-md); }
.field > label { font-weight: 600; font-size: 0.8125rem; color: var(--c-text); }
.field .help { font-size: 0.75rem; color: var(--c-text-muted); }
.field .err  { font-size: 0.75rem; color: var(--c-error); }

.input, .select, .textarea {
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: var(--c-card);
    color: var(--c-text);
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--c-text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-border-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-ring);
}
.textarea { resize: vertical; min-height: 6rem; }

/* --- Generic badge --------------------------------- */
.badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    line-height: 1.4;
    vertical-align: middle;
}
.badge--claimed {
    background: var(--c-primary);
    color: #fff;
}

/* --- Team page: claim CTA card + contacts row --------- */
.claim-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin: var(--space-md) 0 var(--space-lg);
    padding: var(--space-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-lg);
    background: var(--c-highlight-soft);
}
.claim-cta__copy { display: flex; flex-direction: column; gap: 0.2rem; }
.claim-cta__copy strong { font-size: 0.9375rem; color: var(--c-text); }
@media (max-width: 540px) {
    .claim-cta { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .claim-cta .btn { align-self: stretch; justify-content: center; }
}
.team-contacts { margin: 0.5rem 0 0; }
.team-contacts a { color: var(--c-primary); }

/* --- Claim form page ---------------------------------- */
article.claim { max-width: 36rem; }
article.claim h1 { margin-bottom: 0.5rem; }
article.claim .form-error {
    background: rgba(192, 54, 47, 0.10);
    color: var(--c-error);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    margin: var(--space-md) 0;
    font-size: 0.875rem;
}
.claim-form { margin-top: var(--space-md); }
.claim-form__note {
    background: var(--c-highlight-soft);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    margin: var(--space-md) 0;
    font-size: 0.875rem;
}
.claim-form__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* --- Header "Teams" nav (apex domain) ---------------- */
.site-nav { margin-left: auto; display: flex; gap: var(--space-md); }
.site-nav a {
    font-size: 0.875rem;
    color: var(--c-text-muted);
    font-weight: 500;
}
.site-nav a:hover { color: var(--c-primary); text-decoration: none; }

/* --- Teams dashboard (teams.inpedana.com) ------------- */
.teams-nav { margin-left: auto; display: flex; gap: var(--space-md); }
.teams-nav a { font-size: 0.875rem; color: var(--c-text-muted); }
.teams-nav a:hover { color: var(--c-primary); text-decoration: none; }
.form-ok {
    background: rgba(62, 92, 66, 0.12);
    color: var(--c-primary-hover);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin: var(--space-md) 0;
    font-size: 0.875rem;
}
.teams-list {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.teams-list__item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    align-items: center;
}
.teams-list__logo {
    width: 4rem; height: 4rem;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.25rem;
}
.teams-list__body { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.teams-list__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.athlete-row--hidden td { opacity: 0.55; }
