/*
  styles.css
  - CSS moderno con variabili, temi chiaro/scuro, layout responsive
  - Blocco schermo mobile: su schermi piccoli il body non scorre; scorre main.site-scroll
  - Le tabelle responsive diventano blocchi tipo card su schermi piccoli usando data-label
*/

/* ========== Variabili CSS e Temi ========== */
:root {
  --color-bg: #171717;
  --color-text: #fff; /* set global text to white for readability */
  --color-muted: #475569; /* slate-600 */
  --color-border: #e2e8f0; /* slate-200 */
  --color-primary: #16a34a; /* green-600 */
  --color-primary-contrast: #ffffff;
  --color-secondary: #0ea5e9; /* sky-500 */

  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.08);

  --container: 1200px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

/* Classe tema scuro applicata al <body> via JS */
body.theme-dark {
  --color-bg: #0b0b0b;
  --color-text: #fff;
  --color-muted: #a3a3a3;
  --color-border: #262626;
  --color-primary: #22c55e;
  --color-secondary: #38bdf8;
}

/* Rispetta la preferenza di sistema quando in modalità auto */
@media (prefers-color-scheme: dark) {
  body.theme-auto {
    --color-bg: #0b0b0b;
    --color-text: #fff;
    --color-muted: #a3a3a3;
    --color-border: #262626;
    --color-primary: #22c55e;
    --color-secondary: #38bdf8;
  }
}

/* ========== Reset di base e Tipografia ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
}
/* Rende tutti i link bianchi per evitare il blu di default */
a, a:visited { color: var(--color-text); }
img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.page-title { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); margin: var(--space-6) 0 var(--space-2); }
.lead { color: var(--color-muted); margin: var(--space-3) 0; }

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: 8px; z-index: 1000;
  background: var(--color-primary); color: var(--color-primary-contrast);
  padding: 6px 10px; border-radius: var(--radius-sm);
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(0); outline: 2px dashed #fff; }

/* ========== Header ========== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 92%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding-block: var(--space-3);
}
.brand img { display: block; }
.nav-list { display: flex; gap: var(--space-4); list-style: none; padding: 0; margin: 0; }
.nav-list a { color: var(--color-text); text-decoration: none; opacity: .85; }
.nav-list a:focus, .nav-list a:hover { opacity: 1; }

.header-ctas { display: flex; align-items: center; gap: var(--space-3); }

/* Header mobile: nasconde la nav, logo a sinistra & CTA a destra */
@media (max-width: 767px) {
  .primary-nav { display: none; }
  .header-inner { gap: var(--space-2); }
  .header-ctas { gap: var(--space-2); }
  .header-ctas .btn { padding: 10px 12px; }
}

/* ========== Pulsanti ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 14px; text-decoration: none; font-weight: 600; }
.btn-primary { background: var(--color-primary); color: var(--color-primary-contrast); }
.btn-secondary { background: var(--color-secondary); color: var(--color-primary-contrast); }
.btn-outline { background: transparent; color: var(--color-primary-contrast); border-color: color-mix(in oklab, var(--color-border), white 40%); }
.btn-icon { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); width: 40px; height: 40px; border-radius: 999px; }
.btn:focus-visible { outline: 3px solid color-mix(in oklab, var(--color-primary), white 30%); outline-offset: 2px; }
/* Migliora contrasto bordo su hover per i bottoni outline */
.btn-outline:hover, .btn-outline:focus-visible { border-color: color-mix(in oklab, var(--color-primary), white 40%); }

/* ========== Hero ========== */
.hero { margin-block: var(--space-6); }
.hero-inner { display: grid; gap: var(--space-4); align-items: center; }
.hero-copy { max-width: 60ch; }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
/* Immagine banner con CTA in sovrimpressione */
.hero-media { position: relative; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); }
.hero-media picture, .hero-media img { display: block; width: 100%; height: auto; }
.hero-media::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,.6));
  pointer-events: none;
}
.hero-overlay {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  background: color-mix(in oklab, black 55%, transparent);
  backdrop-filter: blur(6px) saturate(150%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  width: min(92%, 640px);
  box-shadow: var(--shadow-md);
  text-align: center;
  color: #ffffff;
}
.hero-overlay .hero-actions { justify-content: center; }
.hero-title { margin: 0 0 6px; font-size: clamp(1.25rem, 1.1rem + 1vw, 1.8rem); }
.hero-subtitle { margin: 0 0 10px; color: var(--color-muted); }
.hero-overlay .hero-title, .hero-overlay .hero-subtitle { text-shadow: 0 2px 8px rgba(0,0,0,.7); }
@media (max-width: 767px) {
  .hero-overlay { width: calc(100% - 24px); padding: 14px; bottom: 5%; }
  .hero-title { font-size: clamp(1.1rem, 0.9rem + 2vw, 1.5rem); }
  .hero-subtitle { font-size: 0.95rem; }
  .hero-actions { gap: 10px; }
  .hero-actions .btn { flex: 1 1 0; min-height: 44px; }
}

/* ========== Tabelle (desktop) ========== */
.table-responsive { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: color-mix(in oklab, var(--color-bg) 98%, transparent); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table thead th { text-align: left; font-weight: 700; color: var(--color-text); background: color-mix(in oklab, var(--color-bg) 96%, transparent); }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.table tbody tr:hover { background: color-mix(in oklab, var(--color-bg) 94%, transparent); }

/* ========== Tabelle -> Card (mobile) ========== */
@media (max-width: 640px) {
  .table { min-width: 0; }
  .table thead { display: none; }
  .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { border-bottom: 1px solid var(--color-border); padding: 10px 8px; }
  .table td { border: 0; padding: 8px 8px; }
  .table td::before {
    content: attr(data-label);
    display: block; font-size: 12px; color: var(--color-muted); margin-bottom: 4px;
  }
}

/* ========== Griglia slot e Pagamenti ========== */
.slots-grid { list-style: none; padding: 0; margin: var(--space-6) 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .slots-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .slots-grid { grid-template-columns: repeat(6, 1fr); } }
.slot-card { display: block; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--color-border); position: relative; aspect-ratio: 4 / 3; background: #0a0a0a; }
.slot-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slot-card::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: box-shadow .2s ease, transform .2s ease;
  border-radius: inherit;
}
.slot-card:hover::after, .slot-card:focus-visible::after {
  box-shadow: 0 0 24px color-mix(in oklab, var(--color-primary), white 20%);
}
.slot-card:active { transform: translateY(1px); }

.payments { list-style: none; padding: 0; margin: var(--space-6) 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-4); align-items: center; }
.payments img { max-height: 40px; object-fit: contain; filter: saturate(0.9); }

/* Icone metodi di pagamento nel footer */
.footer-payments-wrap { width: 100%; }
.footer-payments { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: grid; grid-template-columns: repeat(6, minmax(60px, 1fr)); gap: var(--space-3); align-items: center; }
@media (max-width: 640px) { .footer-payments { grid-template-columns: repeat(3, minmax(60px, 1fr)); } }
.footer-payments img { width: 100%; max-height: 28px; object-fit: contain; filter: grayscale(15%) contrast(110%); opacity: .9; transition: opacity .2s ease, filter .2s ease; }
.footer-payments img:hover, .footer-payments img:focus { opacity: 1; filter: none; }

/* ========== Utility di layout ========== */
.cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.content section { margin-block: var(--space-8); }

/* Footer */
.site-footer { border-top: 1px solid var(--color-border); margin-top: var(--space-10); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: var(--space-4); flex-wrap: wrap; }
.footer-links { display: flex; gap: var(--space-4); list-style: none; padding: 0; margin: 0; }
.footer-links a { text-decoration: none; color: var(--color-text); opacity: .85; }
.footer-links a:hover { opacity: 1; }

/* ========== Blocco schermo Mobile ========== */
/* Su schermi piccoli, prima il body era bloccato; ora si permette lo scroll della pagina così il footer è raggiungibile */
@media (max-width: 767px) {
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; touch-action: auto; }
  .site-scroll { height: auto; overflow: visible; }
}

/* ========== Accessibilità ========== */
:focus-visible { outline: 3px solid color-mix(in oklab, var(--color-secondary), white 20%); outline-offset: 2px; }

/* Riduci movimento */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ========== Varie ========== */
.primary-nav a, .brand, .btn { transition: opacity .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease; }