/* Stile principale migliorato per il sito Palio
   Merge delle regole esistenti con aggiunte per l'Albo d'oro e miglioramenti accessibilità.
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2b6cb0; /* aggiornato */
    --secondary-color: #f6ad55;
    --dark-color: #0b1220;
    --light-color: #f8f9fa;
    --accent-color: #e74c3c;
    --text-color: #222;
    --border-radius: 12px;
    --transition: all 0.25s ease;
    --max-width: 1100px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--light-color);
}

/* NAVIGAZIONE */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.logo h1 {
  color: #fff7d6;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1.15;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.35),
    0 3px 8px rgba(0, 0, 0, 0.35);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a[aria-current="page"] {
    background: rgba(255,255,255,0.08);
}

/* HERO SECTION */
.hero {
    background: linear-gradient(180deg, rgba(0,0,0,0.05), transparent);
    padding: 2.5rem 0;
    margin-bottom: 1rem;
}

.hero .hero-content{padding:1rem 0}

.btn{display:inline-block;padding:.5rem .75rem;border-radius:6px;border:0;background:var(--primary-color);color:#fff;text-decoration:none;cursor:pointer}

.btn.secondary {
  background: var(--accent-color);
  color: #fff;
}

h1,h2,h3{color:var(--dark-color)}

.features-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem}
.feature-card{background:#fff;padding:1rem;border-radius:8px;box-shadow:0 1px 3px rgba(2,6,23,0.06)}

.footer{background:var(--dark-color);color:#fff;padding:1rem 0;margin-top:2rem}
.footer .container{display:flex;justify-content:space-between;align-items:center}
.footer-links{list-style:none;display:flex;gap:1rem;margin:0;padding:0}

/* ALBO SPECIFIC */
.albo-section{background:#fff;padding:1rem;border-radius:8px;margin:1rem 0;box-shadow:0 1px 3px rgba(2,6,23,0.04)}
.albo-controls{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin-bottom:1rem}
.albo-controls label{font-weight:600}
.albo-controls select,input[type="search"]{padding:.4rem .5rem;border:1px solid #e6e9ee;border-radius:6px}
.albo-controls .btn{padding:.35rem .6rem}
.table-wrap{overflow:auto}
table.albo-table{width:100%;border-collapse:collapse;margin-bottom:0}
table.albo-table th, table.albo-table td{padding:.6rem .8rem;border-bottom:1px solid #eef2f7;text-align:left}
table.albo-table thead th{background:#f4f6fb;font-weight:700}

/* Controls row */
.controls-row{display:flex;gap:.5rem;align-items:center}
.controls-row .spacer{flex:1}

/* Utility */
.text-muted{color:#6b7280;font-size:.95rem}
.small-note{color:#666;font-size:0.9rem}

/* stemma nel logo */
.logo{display:flex;align-items:center;gap:.6rem}
.logo-stemma{width:56px;height:auto;display:block;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,0.15)}
@media (max-width:720px){
  .logo-stemma{width:40px}
  .logo h1{font-size:1rem}
}

/* Hamburger e mobile nav */
.nav-toggle{display:none;align-items:center;justify-content:center;border:0;background:transparent;color:#fff;width:44px;height:44px;border-radius:6px;cursor:pointer}
.nav-toggle .bar{display:block;width:22px;height:2px;background:#fff;border-radius:2px;position:relative}
.nav-toggle .bar::before,.nav-toggle .bar::after{content:"";position:absolute;left:0;width:22px;height:2px;background:#fff;border-radius:2px}
.nav-toggle .bar::before{top:-6px}
.nav-toggle .bar::after{top:6px}

.nav-backdrop{position:fixed;inset:0;background:rgba(0,0,0,0.35);opacity:0;pointer-events:none;transition:opacity .28s ease;z-index:48}


/* Print */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .nav-links,
  .btn,
  .nav-toggle,
  .albo-controls {
    display: none;
  }

  .albo-section {
    box-shadow: none;
    border: none;
  }
}

/* Colori podio */
table.albo-table tbody tr.rank-gold {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.18), #ffffff);
}

table.albo-table tbody tr.rank-silver {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.22), #ffffff);
}

table.albo-table tbody tr.rank-bronze {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.20), #ffffff);
}

table.albo-table tbody tr.rank-gold td:nth-child(2) {
  color: #b8860b;
  font-weight: 800;
}

table.albo-table tbody tr.rank-silver td:nth-child(2) {
  color: #6b7280;
  font-weight: 800;
}

table.albo-table tbody tr.rank-bronze td:nth-child(2) {
  color: #92400e;
  font-weight: 800;
}
.nav-backdrop.visible{opacity:1;pointer-events:auto}

/* =========================================================
   MIGLIORAMENTI GENERALI SMARTPHONE
   ========================================================= */

@media (max-width: 720px) {

  /* Layout generale */
  body {
    font-size: 16px;
    line-height: 1.55;
    background: #f4f6f8;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding: 0 1rem;
  }

  main.container {
    padding-top: 1rem;
  }

  h1 {
    font-size: 1.55rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  p {
    font-size: 0.95rem;
  }

  .text-muted {
    font-size: 0.9rem;
    line-height: 1.45;
  }


  /* Navbar mobile */
  .navbar {
    padding: 0.65rem 0;
  }

  .navbar .container {
    gap: 0.75rem;
  }

  .logo {
    min-width: 0;
    flex: 1;
  }

  .logo-stemma {
    width: 42px;
    flex-shrink: 0;
  }

  .logo h1 {
    font-size: 0.95rem;
    line-height: 1.15;
    color: #fff;
    overflow-wrap: anywhere;
  }

  .nav-toggle {
    display: flex;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.12);
  }

  .nav-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .nav-links {
  display: none;
  position: fixed;
  top: 66px;
  left: 1rem;
  right: 1rem;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #1f4f86, #92342b);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  z-index: 1001;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: scaleY(0.95);
  transition: max-height 0.28s ease, opacity 0.28s ease, transform 0.28s ease;
}

.nav-links.open {
  display: flex;
  max-height: 420px;
  opacity: 1;
  transform: scaleY(1);
}

.nav-links a {
  display: block;
  color: #fff;
  font-size: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}

  /* Hero e sezioni */
  .hero {
    padding: 1.5rem 0;
    margin-bottom: 0.75rem;
  }

  .hero .hero-content {
    padding: 0.5rem 0;
  }

  .albo-section,
  .feature-card {
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  }


  /* Controlli albo */
  .controls-row {
    display: block;
  }

  .albo-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    background: #ffffff;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.08);
    margin-bottom: 1rem;
  }

  .albo-controls label {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: #374151;
  }

  .albo-controls select,
  .albo-controls input[type="search"] {
    width: 100%;
    min-height: 44px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid #d9dee7;
    background: #fff;
    padding: 0.65rem 0.75rem;
  }

  .albo-controls select:focus,
  .albo-controls input[type="search"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.16);
  }


  /* Bottoni touch-friendly */
  .btn {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.75rem 1rem;
    text-align: center;
  }

  .btn:active {
    transform: scale(0.98);
  }


  /* Tabella albo trasformata in card */
  .table-wrap {
    overflow: visible;
  }

  table.albo-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  table.albo-table,
  table.albo-table thead,
  table.albo-table tbody,
  table.albo-table th,
  table.albo-table td,
  table.albo-table tr {
    display: block;
    width: 100%;
  }

  table.albo-table thead {
    display: none;
  }

  table.albo-table tbody tr {
    margin: 0 0 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.10);
    border-left: 6px solid var(--primary-color);
  }

  table.albo-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eef2f7;
    text-align: right;
    font-size: 0.95rem;
    color: #374151;
  }

  table.albo-table td:last-child {
    border-bottom: none;
  }

  table.albo-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    text-align: left;
    font-weight: 800;
    color: var(--dark-color);
  }

  table.albo-table td:first-child {
    margin: -1rem -1rem 0.65rem -1rem;
    padding: 0.85rem 1rem;
    border-radius: 18px 18px 0 0;
    background: rgba(43, 108, 176, 0.08);
    border-bottom: none;
    color: var(--primary-color);
    font-size: 1.15rem;
    font-weight: 900;
  }

  table.albo-table td:nth-child(2) {
    font-weight: 800;
    color: #111827;
  }

  table.albo-table td:nth-child(3) {
    color: #6b7280;
    font-size: 0.9rem;
  }


  /* Podio smartphone */
  table.albo-table tbody tr.rank-gold {
    border-left-color: #d4af37;
    background: linear-gradient(180deg, #fff8dc, #ffffff);
  }

  table.albo-table tbody tr.rank-silver {
    border-left-color: #a3a3a3;
    background: linear-gradient(180deg, #f3f4f6, #ffffff);
  }

  table.albo-table tbody tr.rank-bronze {
    border-left-color: #b45309;
    background: linear-gradient(180deg, #fff1e6, #ffffff);
  }

  table.albo-table tbody tr.rank-gold td:nth-child(2) {
  color: #b8860b;
  font-weight: 900;
}

table.albo-table tbody tr.rank-silver td:nth-child(2) {
  color: #6b7280;
  font-weight: 900;
}

table.albo-table tbody tr.rank-bronze td:nth-child(2) {
  color: #92400e;
  font-weight: 900;
}


  /* Righe vuote o messaggi errore */
  table.albo-table tr.empty-row {
    border-left: none;
    text-align: center;
  }

  table.albo-table tr.empty-row td {
    display: block;
    text-align: center;
    border-bottom: none;
    color: #6b7280;
  }

  table.albo-table tr.empty-row td::before {
    content: none;
  }


  /* Footer mobile */
  .footer {
    margin-top: 1.5rem;
    padding: 1.25rem 0;
    text-align: center;
  }

  .footer .container {
    display: block;
  }

  .footer p {
    font-size: 0.9rem;
  }

  .footer-links {
    margin-top: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {

  .container {
    padding: 0 0.85rem;
  }

  .logo-stemma {
    width: 36px;
  }

  .logo h1 {
    font-size: 0.82rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  .albo-controls {
    padding: 0.85rem;
  }

  table.albo-table tbody tr {
    padding: 0.85rem;
    border-radius: 16px;
  }

  table.albo-table td {
    font-size: 0.9rem;
    gap: 0.75rem;
  }

  table.albo-table td::before {
    flex-basis: 38%;
  }

  table.albo-table td:first-child {
    margin: -0.85rem -0.85rem 0.6rem -0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 16px 16px 0 0;
  }
}

/* =========================================================
   HOME PAGE
   ========================================================= */


.hero-home {
  min-height: 480px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #2b6cb0 0%, #e74c3c 100%);
  padding: 0;
  margin-bottom: 2rem;
}


.hero-home::after {
  content: "";
  position: absolute;
  right: clamp(1rem, 7vw, 6rem);
  top: 50%;
  width: clamp(180px, 22vw, 320px);
  height: clamp(180px, 22vw, 320px);
  background-image: url("../assets/stemma.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transform: translateY(-50%);
  opacity: 0.14;
  pointer-events: none;
}

.hero-home .hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1rem;

}

.hero-home h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  max-width: 760px;
}

.hero-home p {
  max-width: 640px;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.92);
}

.hero-kicker {
  display: inline-block;
  margin-bottom: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: #fff;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-secondary,
.btn.secondary {
  background: var(--accent-color);
  color: #fff;
}

.intro-section {
  background: #fff;
  margin: 2rem 0;
  padding: 1.5rem;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.intro-section h2,
.features h2,
.cta-section h2 {
  margin-bottom: 0.75rem;
}

.features {
  margin: 2rem 0;
}

.feature-card {
  border-radius: 18px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.feature-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  border-radius: 14px;
  background: rgba(43, 108, 176, 0.1);
  font-size: 1.4rem;
}

.card-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--primary-color);
  font-weight: 700;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

.highlight-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  margin: 2rem 0;
  padding: 1.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #0b1220, #1e3a5f);
  color: #fff;
}

.highlight-section h2 {
  color: #fff;
  margin-bottom: 0.5rem;
}

.highlight-section p {
  color: rgba(255, 255, 255, 0.85);
}

.highlight-box {
  min-width: 150px;
  padding: 1rem;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
}

.highlight-box strong {
  display: block;
  font-size: 2rem;
  color: #f6ad55;
}

.highlight-box span {
  display: block;
  font-size: 0.9rem;
  color: #fff;
}

.cta-section {
  margin: 2rem 0;
  padding: 2rem;
  text-align: center;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09);
}

.cta-section p {
  margin-bottom: 1rem;
  color: #6b7280;
}

/* =========================================================
   HOME PAGE - SMARTPHONE
   ========================================================= */

@media (max-width: 720px) {

  .hero-home {
    min-height: auto;
    background: linear-gradient(
      135deg,
      rgba(43, 108, 176, 0.95),
      rgba(231, 76, 60, 0.9)
    );
  }

  .hero-home::after {
    width: 220px;
    height: 220px;
    right: -70px;
    top: 58%;
    opacity: 0.10;
  }

  .hero-home .hero-content {
    padding: 2rem 1rem;
  }

  .hero-home h1 {
    font-size: 2rem;
  }

  .hero-home p {
    font-size: 1rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .intro-section,
  .cta-section,
  .highlight-section {
    margin: 1.25rem 0;
    padding: 1rem;
    border-radius: 16px;
  }

  .highlight-section {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .highlight-box {
    width: 100%;
  }

  .feature-card:hover {
    transform: none;
  }
}


table.albo-table tr.year-separator td {
  background: linear-gradient(135deg, var(--dark-color), #1e3a5f);
  color: #fff3c4;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  border-bottom: none;
  border-top: 1.25rem solid #fff;
  text-align: left;
}

@media (max-width: 720px) {

  table.albo-table tr.year-separator {
    display: block;
    margin: 1.25rem 0 0.75rem;
    padding: 0;
    border-left: none;
    box-shadow: none;
    background: transparent;
  }

  table.albo-table tr.year-separator td {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--dark-color), #1e3a5f);
    color: #fff3c4;
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
    border-bottom: none;
    border-top: none;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.18);
  }

  table.albo-table tr.year-separator td::before {
    content: none;
  }

  table.albo-table tbody tr.year-separator:first-child {
    margin-top: 0;
  }
}

/* Prima barra anno senza troppo spazio sopra */
table.albo-table tbody tr.year-separator:first-child td {
  border-top: none;
}


table.albo-table thead th:first-child,
table.albo-table tbody tr:not(.year-separator) td:first-child {
  display: none;
}


@media (max-width: 720px) {
  table.albo-table tbody tr:not(.year-separator) td:first-child {
    display: none;
  }
}

/* =========================================================
   RISALTO CAMPO NOME - ALBO D'ORO
   ========================================================= */

/* Desktop: evidenzia il nome */
table.albo-table tbody tr:not(.year-separator) td:nth-child(3) {
  font-weight: 900;
  color: var(--dark-color);
  font-size: 1.05rem;
}

/* Desktop: effetto leggero sulla riga al passaggio mouse */
table.albo-table tbody tr:not(.year-separator):hover td:nth-child(3) {
  color: var(--primary-color);
}

/* =========================================================
   MOBILE - NOME IN RISALTO SENZA ALONE
   ========================================================= */

@media (max-width: 720px) {

  table.albo-table tbody tr:not(.year-separator) td:nth-child(3) {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: var(--dark-color);
    font-size: 1.08rem;
    font-weight: 900;
    padding: 0.65rem 0;
  }

  table.albo-table tbody tr:not(.year-separator) td:nth-child(3)::before {
    color: var(--primary-color);
    font-weight: 900;
  }
}
