/* Home (index.php) e pagine di accesso — design system ESportsArena (vedi DESIGN.md).
   Font e palette in css/tokens.css (da caricare prima di questo file); qui solo alias brevi. */
:root {
  --red: var(--ea-red);
  --red-hover: var(--ea-red-hover);
  --red-text: var(--ea-red-text);
  --blue: var(--ea-blue);
  --blue-text: var(--ea-blue-text);
  --success: var(--ea-success);
  --success-text: var(--ea-success-text);
  --warning: var(--ea-warning);
  --bg: var(--ea-bg);
  --bg-alt: var(--ea-bg-alt);
  --surface: var(--ea-surface);
  --surface-2: var(--ea-surface-2);
  --border: var(--ea-border);
  --divider: var(--ea-divider);
  --text: var(--ea-text);
  --muted: var(--ea-muted);
  --nav-bg: var(--ea-nav-bg);
  --logo-filter: var(--ea-logo-filter);
  color-scheme: dark;

  --f1: var(--ea-f1);
  --mgp: var(--ea-mgp);
  --wec: var(--ea-wec);

  --r-sm: var(--ea-r-sm);
  --r: var(--ea-r);
  --r-lg: var(--ea-r-lg);

  --glow-sm: var(--ea-glow-sm);
  --glow: var(--ea-glow);
  --glow-md: var(--ea-glow-md);
  --glow-lg: var(--ea-glow-lg);
  --glow-blue-sm: var(--ea-glow-blue-sm);
  --glow-blue: var(--ea-glow-blue);
  --glow-blue-md: var(--ea-glow-blue-md);

  --font-head: var(--ea-font-head);
  --font-body: var(--ea-font-body);
  --font-mono: var(--ea-font-mono);

  --fast: var(--ea-fast);
  --gutter: 16px;
  --nav-h: 56px;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; margin: 0; text-transform: uppercase; letter-spacing: .01em; }
h3 { font-size: 22px; line-height: 1.2; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 32px; } }

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 999; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: var(--r); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); border-radius: var(--r); }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 6px 16px; border-radius: var(--r); border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 600; font-size: 14px; letter-spacing: .02em; cursor: pointer; white-space: nowrap;
  transition: background var(--fast), box-shadow var(--fast), border-color var(--fast), color var(--fast);
}
.btn-sm { height: 28px; padding: 4px 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 8px 24px; font-size: 16px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); box-shadow: var(--glow-sm); }
.btn-secondary { background: transparent; color: var(--blue-text); border-color: var(--blue); }
.btn-secondary:hover { background: rgba(37, 99, 235, .08); box-shadow: var(--glow-blue); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-f1  { background: var(--red); color: #fff; }
.btn-f1:hover { background: var(--red-hover); box-shadow: var(--glow-sm); }
.btn-wec { background: var(--blue); color: #fff; }
.btn-wec:hover { background: #1D4ED8; box-shadow: var(--glow-blue-sm); }
.btn-mgp { background: var(--warning); color: #0A0A0A; }
.btn-mgp:hover { background: #D97706; box-shadow: 0 0 4px rgba(245, 158, 11, .35); }

/* chip / pill */
.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 11px; font-weight: 500; line-height: 1.6;
  text-transform: uppercase; letter-spacing: .8px;
}
.chip-success { background: rgba(34, 197, 94, .125); color: var(--success-text); }
.chip-info { background: rgba(37, 99, 235, .125); color: var(--blue-text); }
.pill-f1 { background: var(--red); color: #fff; }
.pill-wec { background: var(--blue); color: #fff; }
.pill-mgp { background: var(--warning); color: #0A0A0A; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 6px var(--success); animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 20px; text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 480px) { .brand { font-size: clamp(14px, 4.4vw, 20px); } }
.brand img { border-radius: var(--r); }
.brand strong { color: var(--red); font-weight: 400; }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; min-width: 44px; min-height: 44px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: transform var(--fast), opacity var(--fast); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-menu { display: flex; align-items: center; gap: 24px; }
.nav-menu > a:not(.btn) { color: var(--muted); font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; transition: color var(--fast); }
.nav-menu > a:not(.btn):hover { color: var(--text); }
.nav-menu .btn + .btn { margin-left: -16px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 4px var(--gutter) 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    transform: translateY(-110%); opacity: 0; visibility: hidden;
    transition: transform var(--fast) ease-out, opacity var(--fast), visibility var(--fast);
  }
  .nav-menu.open { transform: none; opacity: 1; visibility: visible; }
  .nav-menu > a:not(.btn) { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--surface-2); }
  .nav-menu .btn { height: 44px; margin-top: 8px; font-size: 14px; }
  .nav-menu .btn + .btn { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: 48px 0 32px; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero-bg { position: absolute; inset: 0; z-index: -1; background: var(--bg); }
.hero-bg::before, .hero-bg::after { content: ""; position: absolute; top: 0; bottom: 0; }
/* tagli diagonali: rosso a destra, blu a sinistra */
.hero-bg::before {
  right: 0; width: 55%;
  background: linear-gradient(135deg, rgba(220, 38, 38, .22), rgba(220, 38, 38, .04) 60%);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
}
.hero-bg::after {
  left: 0; width: 30%;
  background: linear-gradient(315deg, rgba(37, 99, 235, .16), transparent 70%);
  clip-path: polygon(0 0, 100% 0, 40% 100%, 0 100%);
}
.hero-inner { display: grid; gap: 32px; align-items: center; }
@media (min-width: 960px) {
  .hero { padding: 80px 0 48px; }
  .hero-inner { grid-template-columns: 1.3fr 1fr; gap: 48px; }
}

.hero h1 { font-size: clamp(40px, 8vw, 72px); line-height: 1.05; margin: 16px 0 16px; }
.accent { color: var(--red); text-shadow: 0 0 24px rgba(220, 38, 38, .45); }
.lead { font-size: 16px; color: var(--muted); max-width: 36rem; }
.lead strong { color: var(--text); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
@media (max-width: 480px) { .hero-cta .btn { flex: 1 1 100%; } }

.hero-series { list-style: none; padding: 0; margin: 32px 0 0; display: flex; align-items: center; gap: 24px; }
.hero-series img { height: 22px; width: auto; filter: var(--logo-filter); opacity: .6; }

/* pannello pronostico (stile classifica) */
.hero-card {
  background: var(--surface-2); border: 1px solid rgba(220, 38, 38, .25); border-left: 3px solid var(--red);
  border-radius: var(--r); padding: 16px; box-shadow: var(--glow-lg);
  max-width: 420px; width: 100%; justify-self: center;
}
.mock-head {
  display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
}
.mock-list { list-style: none; padding: 0; margin: 0; }
.mock-list li {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 4px;
  font-size: 14px;
}
.mock-list li + li { border-top: 1px solid var(--divider); }
.mock-list .pos { width: 22px; font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--muted); }
.mock-list li:nth-child(-n+3) .pos { color: var(--red-text); }
.mock-list .bar { width: 3px; height: 18px; border-radius: 1px; }
.bar.t1 { background: #ff8000; } .bar.t2 { background: #ff8000; } .bar.t3 { background: #3671c6; }
.bar.t4 { background: #e8002d; } .bar.t5 { background: #27f4d2; }
.mock-list b { margin-left: auto; font-family: var(--font-mono); font-weight: 700; color: var(--success); }
.mock-list li:last-child b { color: var(--muted); }
.mock-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
}
.mock-foot i { color: var(--blue-text); margin-right: 4px; }

/* statistiche */
.stats { margin: 32px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats > div { background: var(--surface); border: 1px solid var(--border); border-top: 2px solid var(--red); border-radius: var(--r); padding: 12px 16px; }
.stats dt { color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; }
.stats dd { margin: 4px 0 0; font-family: var(--font-mono); font-size: clamp(22px, 4vw, 30px); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Sezioni ---------- */
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
@media (min-width: 960px) { .section { padding: 64px 0; } }
.section-head { max-width: 42rem; margin-bottom: 24px; }
.eyebrow {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-sm);
  background: rgba(220, 38, 38, .125); color: var(--red-text);
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px;
}
.section-head h2 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.15; margin: 8px 0; }
.section-head p { color: var(--muted); font-size: 16px; }

.grid { display: grid; gap: 8px; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

/* card base: team coding con bordo sinistro, glow in hover */
.serie-card, .steps li, .feature, .league {
  --c: var(--red);
  --c-glow: rgba(220, 38, 38, .30);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c);
  border-radius: var(--r);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.serie-card:hover, .steps li:hover, .feature:hover, .league:hover {
  border-color: color-mix(in srgb, var(--c) 45%, var(--border)); border-left-color: var(--c);
  box-shadow: 0 0 10px var(--c-glow);
}
.serie-wec, .league-wec { --c: var(--blue); --c-glow: rgba(37, 99, 235, .30); }
.serie-mgp, .league-mgp { --c: var(--warning); --c-glow: rgba(245, 158, 11, .30); }

/* card serie */
.serie-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.serie-top { display: flex; align-items: center; justify-content: space-between; }
.serie-logo { height: 28px; width: auto; filter: var(--logo-filter); }
.serie-desc { color: var(--muted); font-size: 14px; }
.next { margin-top: auto; background: var(--surface-2); border-radius: var(--r); padding: 12px; }
.next-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.next-round { font-family: var(--font-mono); color: var(--text); }
.next-name { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 20px; text-transform: uppercase; margin-top: 4px; }
.flag { width: 24px; height: 16px; object-fit: cover; border-radius: var(--r-sm); }
.next-date { display: block; color: var(--muted); font-size: 12px; }
.next-date::first-letter { text-transform: uppercase; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; text-align: center; }
.countdown div { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 0; }
.countdown b { display: block; font-family: var(--font-mono); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.next-empty { color: var(--muted); font-size: 14px; }

/* passi */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: step; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .steps { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.steps li { counter-increment: step; position: relative; padding: 16px; }
.steps li::after {
  content: counter(step, decimal-leading-zero);
  position: absolute; top: 12px; right: 16px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--red-text);
}
.steps i { font-size: 20px; color: var(--red); }
.steps h3 { margin: 12px 0 4px; }
.steps p { color: var(--muted); font-size: 14px; }

/* funzioni */
.feature { padding: 16px; }
.feature i {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r);
  background: rgba(220, 38, 38, .15); color: var(--red-text); font-size: 18px;
}
.feature h3 { margin: 12px 0 4px; }
.feature p { color: var(--muted); font-size: 14px; }

/* leghe: lista classifica */
.leagues { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 860px) { .leagues { grid-template-columns: repeat(2, 1fr); } }
.league { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 12px; }
.rank { width: 24px; flex-shrink: 0; font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--muted); text-align: center; }
.rank-1, .rank-2, .rank-3 { color: var(--red-text); }
.league-logo { width: 48px; height: 22px; object-fit: contain; flex-shrink: 0; filter: var(--logo-filter); }
.league-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.league-info strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.league-info span { color: var(--muted); font-size: 12px; }
.league-info span i { margin-right: 2px; }

/* CTA finale */
.cta-box {
  text-align: center; padding-block: 48px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(220, 38, 38, .18), transparent 70%), var(--surface-2);
  border: 1px solid rgba(220, 38, 38, .25); border-radius: var(--r-lg);
  box-shadow: var(--glow-lg);
  max-width: calc(1180px - 2 * var(--gutter));
  width: calc(100% - 2 * var(--gutter));
}
.cta-box h2 { font-size: clamp(32px, 6vw, 56px); line-height: 1.05; }
.cta-box p { color: var(--muted); margin-top: 8px; }
.cta-box .hero-cta { justify-content: center; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 32px 0 calc(32px + env(safe-area-inset-bottom)); }
.footer-inner { display: grid; gap: 16px; justify-items: center; text-align: center; }
.footer .brand { font-size: 18px; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.footer nav a:hover { color: var(--text); }
.disclaimer { color: var(--muted); font-size: 11px; max-width: 36rem; }

/* comparsa allo scroll (rapida) */
.reveal { opacity: 0; transition: opacity var(--fast) ease-out; }
.reveal.visible { opacity: 1; }

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

/* ---------- Switch tema chiaro/scuro ---------- */
.nav-tools { display: flex; align-items: center; gap: 4px; order: 3; }
.theme-toggle {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 15px; cursor: pointer;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
/* mostra l'icona del tema verso cui si passa */
.theme-toggle .fa-moon { display: none; }
:root[data-theme="light"] .theme-toggle .fa-moon { display: inline; }
:root[data-theme="light"] .theme-toggle .fa-sun { display: none; }
@media (max-width: 860px) { .theme-toggle { width: 44px; height: 44px; } }
