
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:  #0d4a0d;
  --green-main:  #1a6b1a;
  --green-mid:   #2e8b2e;
  --green-light: #d4edda;
  --green-pale:  #f0f7f0;
  --red:         #c0392b;
  --text:        #111;
  --text-mid:    #444;
  --text-muted:  #777;
  --border:      #d0ddd0;
  --bg:          #f4f6f4;
  --white:       #fff;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-main) 100%);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
header .site-name {
  color: #9dd89d;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
  white-space: nowrap;
}
header .site-name:hover { color: #fff; }
header p {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Breadcrumb ── */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 7px 28px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-muted);
}
nav a { color: var(--green-main); text-decoration: none; font-weight: 500; }
nav a:hover { text-decoration: underline; }
nav .sep { color: #ccc; }

/* ── Layout ── */
main { padding: 24px 28px; max-width: 1000px; margin: 0 auto; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 4px;
  letter-spacing: -.3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.page-subtitle a { color: var(--green-main); text-decoration: none; font-weight: 500; }
.page-subtitle a:hover { text-decoration: underline; }

h2 {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-main);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-light);
  margin: 32px 0 14px;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-radius: 4px;
  overflow: hidden;
}
th, th.num, th abbr {
  color: rgba(255,255,255,.9);
}
th abbr {
  text-decoration: underline dotted rgba(255,255,255,.4);
  cursor: help;
}
th {
  background: var(--green-dark);
  color: rgba(255,255,255,.9);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid #edf2ed;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--green-pale); }
td a { color: var(--green-main); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-mid); }
.center { text-align: center; }

.score {
  font-weight: 700;
  text-align: center;
  color: var(--green-dark);
  white-space: nowrap;
  min-width: 44px;
  font-size: 13px;
}
.team-home { text-align: right; }
.team-away { text-align: left; }

tfoot td {
  font-weight: 700;
  background: var(--green-pale) !important;
  border-top: 2px solid var(--green-light);
  color: var(--text);
}

/* ── Season cards (homepage) ── */
.decade-block { margin-bottom: 32px; }

.season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.season-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.season-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.season-card .year { font-size: 14px; font-weight: 700; color: var(--green-main); }
.season-card .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Teams grid ── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.team-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.team-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.team-card .name { font-weight: 700; color: var(--green-main); }
.team-card .seasons { font-size: 12px; color: var(--text-muted); }

/* ── Matchday grid ── */
.matchday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.matchday-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 8px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.matchday-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.matchday-card .day-num { font-size: 20px; font-weight: 700; color: var(--green-main); line-height: 1.1; }
.matchday-card .day-matches { font-size: 11px; color: var(--text-muted); }

/* ── Matchday navigation ── */
.matchday-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font-size: 13px;
}
.matchday-nav a {
  background: var(--green-main);
  color: #fff;
  padding: 7px 16px;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: background .15s;
}
.matchday-nav a:hover { background: var(--green-dark); }
.matchday-nav .current { color: var(--text-muted); flex: 1; text-align: center; font-weight: 500; }

/* ── Stat boxes ── */
.stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.stat-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  border-top: 3px solid var(--green-main);
  padding: 12px 18px;
  min-width: 84px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stat-box .val { font-size: 24px; font-weight: 700; color: var(--green-dark); line-height: 1.1; }
.stat-box .lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }

/* ── H2H bar ── */
.h2h-teams {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.h2h-teams a { color: var(--green-dark); text-decoration: none; }
.h2h-teams a:hover { text-decoration: underline; }

.h2h-bar {
  display: flex;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.h2h-bar .seg { display: flex; align-items: center; justify-content: center; color: #fff; min-width: 26px; }
.h2h-bar .seg-a { background: var(--green-main); }
.h2h-bar .seg-d { background: #999; }
.h2h-bar .seg-b { background: var(--red); }

.h2h-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Match datetime cell ── */
.match-datetime {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}
.match-date { display: block; }
.match-time { display: block; color: var(--text-mid); font-weight: 500; }

/* ── Page nav links (Calendario / Classifica) ── */
.page-nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-nav-link {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-main);
  text-decoration: none;
  border: 1px solid var(--green-main);
  padding: 4px 14px;
  border-radius: 20px;
  transition: background .12s, color .12s;
}
.page-nav-link:hover {
  background: var(--green-main);
  color: #fff;
}

/* ── Homepage hero ── */
.hero {
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero .page-title {
  font-size: 32px;
  letter-spacing: -.5px;
  margin-bottom: 10px;
}
.hero-desc {
  font-size: 15px;
  color: var(--text-mid);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 28px;
}
.hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.hero-stat .val {
  display: block;
  font-size: 36px;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1;
  letter-spacing: -1px;
}
.hero-stat .lbl {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-top: 4px;
}
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-btn {
  display: inline-block;
  padding: 9px 22px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: var(--green-main);
  color: #fff;
  transition: background .15s;
}
.hero-btn:hover { background: var(--green-dark); }
.hero-btn.secondary {
  background: transparent;
  color: var(--green-main);
  border: 1px solid var(--green-main);
}
.hero-btn.secondary:hover { background: var(--green-pale); }

/* ── Team logos ── */
.team-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.team-logo-right {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 6px;
  flex-shrink: 0;
}
.team-logo-header {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.team-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.team-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}
.team-header .page-title { margin-bottom: 2px; }

/* ── Table title row ── */
th.table-title {
  background: var(--green-pale);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
}

/* ── Statistics hub ── */
.stat-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat-section-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-main);
  border-radius: 4px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.stat-section-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.stat-section-title { font-size: 15px; font-weight: 700; color: var(--green-dark); margin-bottom: 6px; }
.stat-section-desc { font-size: 13px; color: var(--text-mid); line-height: 1.5; }

/* ── Page intro text ── */
.page-intro, .seo-intro {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.75;
  max-width: 720px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--green-pale);
  border-left: 3px solid var(--green-mid);
  border-radius: 0 4px 4px 0;
}
.page-intro strong, .seo-intro strong { color: var(--green-dark); }

/* ── All-time bar chart ── */
.alltime-chart { margin-bottom: 32px; }
.chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.chart-label {
  min-width: 200px;
  max-width: 200px;
  font-size: 13px;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}
.chart-label a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-label a:hover { text-decoration: underline; }
.chart-pos { font-size: 11px; color: var(--text-muted); min-width: 20px; text-align: right; flex-shrink: 0; }
.chart-bar-wrap { flex: 1; background: var(--green-pale); border-radius: 2px; height: 22px; }
.chart-bar {
  height: 22px;
  background: var(--green-main);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  min-width: 52px;
}
.chart-bar.top { background: var(--green-dark); }
.chart-val { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.9); white-space: nowrap; }
.record-goals { color: var(--green-dark) !important; font-size: 14px; }

@media (max-width: 600px) {
  .chart-label { min-width: 130px; max-width: 130px; }
}

/* ── Albo d'oro ── */
.podium-team {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.podium-pts {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Homepage sections ── */
.home-section { margin-bottom: 40px; }

.featured-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.featured-team-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.featured-team-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.featured-team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.featured-seasons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.featured-season-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.featured-season-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.featured-season-label { font-size: 15px; font-weight: 700; color: var(--green-main); }
.featured-season-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Heatmap (Mappa risultati) ── */
.heatmap-wrap {
  overflow-x: auto;
  margin-bottom: 32px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: 28px repeat(9, minmax(44px, 1fr));
  gap: 3px;
  min-width: 440px;
  max-width: 600px;
}
.hm-corner { background: transparent; }
.hm-header {
  background: var(--green-dark);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  border-radius: 3px;
}
.hm-row-label {
  background: var(--green-dark);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}
.hm-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  cursor: default;
  transition: transform .1s, box-shadow .1s;
  font-variant-numeric: tabular-nums;
}
.hm-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
}

/* ── Blog ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 32px;
}
.blog-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.blog-card:hover {
  box-shadow: 0 4px 12px rgba(13,74,13,.15);
  transform: translateY(-1px);
}
.blog-card-date { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.blog-card-title { font-size: 15px; font-weight: 700; color: var(--green-dark); line-height: 1.3; }
.blog-card-summary { font-size: 13px; color: var(--text-mid); line-height: 1.5; flex: 1; }
.blog-card-read { font-size: 12px; color: var(--green-main); font-weight: 600; margin-top: 4px; }

.blog-post-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 28px; text-transform: uppercase; letter-spacing: .5px; }
.blog-post-body { max-width: 680px; margin-bottom: 40px; }
.blog-post-body p { font-size: 15px; line-height: 1.85; color: var(--text-mid); margin-bottom: 18px; }
.blog-post-body h2 { max-width: 680px; }
.blog-post-body strong { color: var(--green-dark); }
.blog-post-body a { color: var(--green-main); text-decoration: none; font-weight: 500; }
.blog-post-body a:hover { text-decoration: underline; }
.blog-post-body em { font-style: italic; color: var(--text); }
.season-chart-svg { width: 100%; height: auto; display: block; margin-bottom: 32px; background: var(--white); border: 1px solid var(--border); border-radius: 4px; padding: 8px 4px 4px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.comments-section { max-width: 680px; margin: 48px 0 40px; }
.comments-section #cusdis_thread iframe {
  width: 100%;
  border: none;
  min-height: 120px;
  display: block;
}

/* ── H2H badge ── */
.h2h-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.h2h-link:hover { color: var(--green-main); border-color: var(--green-main); }
