/* =========================
   THEME TOKENS (LIGHT default)
   ========================= */
:root{
  /* Light theme */
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-2: #f1f5fb;
  --text: #0b1220;
  --muted: #3e4a5a;
  --brand: #1b8f63;
  --brand-2: #1f6feb;
  --border: rgba(11,18,32,0.12);

  --radius: 16px;
  --shadow: 0 12px 30px rgba(0,0,0,0.12);
  --max: 1100px;

  color-scheme: light;
}

/* Dark theme override */
html[data-theme="dark"]{
  --bg: #0b0f14;
  --panel: #111825;
  --panel-2: #0f1520;
  --text: #e9eef5;
  --muted: #b7c2d0;
  --brand: #7ee2b8;
  --brand-2: #69b3ff;
  --border: rgba(255,255,255,0.10);

  --shadow: 0 12px 30px rgba(0,0,0,0.35);

  color-scheme: dark;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
}

body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(27,143,99,0.10), transparent 60%),
    radial-gradient(1200px 800px at 90% 20%, rgba(31,111,235,0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Dark-specific background */
html[data-theme="dark"] body{
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(126,226,184,0.12), transparent 60%),
    radial-gradient(1200px 800px at 90% 20%, rgba(105,179,255,0.10), transparent 55%),
    var(--bg);
}

a{
  color: inherit;
  text-decoration: none;
}

a:hover{
  text-decoration: underline;
}

/* Contenitore per centrare e dare respiro */
.container{
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
}

/* =========================
   SKIP LINK
   ========================= */
.skip-link{
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--text);
  color: #000;
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 9999;
}

.skip-link:focus{
  left: 12px;
}

/* =========================
   HEADER / NAV
   ========================= */
.site-header{
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.site-header .container{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand__mark{
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand) 35%, transparent),
    color-mix(in srgb, var(--brand-2) 25%, transparent)
  );
  border: 1px solid var(--border);
}

.nav{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.nav a{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav a:focus,
.nav a:hover{
  border-color: var(--border);
  text-decoration: none;
}

/* =========================
   LANGUAGE SWITCH (IT/EN)
   ========================= */
.lang{
  display: inline-flex;
  gap: 6px;
  margin-left: 6px;
}

.lang__link{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
}

.lang__link:hover,
.lang__link:focus-visible{
  border-color: color-mix(in srgb, var(--text) 18%, transparent);
  text-decoration: none;
}

.lang__link[aria-current="page"]{
  border-color: color-mix(in srgb, var(--text) 22%, transparent);
}

/* =========================
   SECTION TITLE + ENI LOGO
   ========================= */
.section-title{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.eni-logo{
  display: inline-block;
  width: 94px;
  height: 94px;
  object-fit: contain;
  border-radius: 8px; /* opzionale */
}

/* =========================
   HERO
   ========================= */
.hero{
  padding: 42px 0 18px;
}

.hero__grid{
  display: grid;
  gap: 18px;
  grid-template-columns: 1.6fr 1fr;
  align-items: start;
}

h1{
  font-size: clamp(1.8rem, 2.5vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 12px;
}

.lead{
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.hero__cta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.hero__card{
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.h3{
  font-size: 1.1rem;
  margin: 0 0 10px;
}

.bullets{
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.fineprint{
  color: var(--muted);
  font-size: 0.92rem;
}

/* =========================
   SEZIONI / GRIGLIE
   ========================= */
.section{
  padding: 34px 0;
}

.section--alt{
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

h2{
  margin: 0 0 10px;
  font-size: 1.5rem;
}

p{
  margin: 0 0 14px;
}

.grid{
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.card{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  padding: 16px;
}

.card h3{
  margin: 0 0 8px;
}

.card p{
  color: var(--muted);
  margin: 0;
}

/* =========================
   DOWNLOAD LIST
   ========================= */
.downloads{
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.download-item{
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.download-item__meta h3{
  margin: 6px 0 4px;
}

.muted{
  color: var(--muted);
}

.tag{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--text);
  font-size: 0.9rem;
}

.note{
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--text) 22%, transparent);
  color: var(--muted);
  background: color-mix(in srgb, #000 8%, transparent);
}

/* =========================
   BOTTONI
   ========================= */
.button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand) 35%, transparent),
    color-mix(in srgb, var(--brand-2) 25%, transparent)
  );
  font-weight: 650;
  text-decoration: none;
}

.button:hover{
  text-decoration: none;
  border-color: color-mix(in srgb, var(--text) 28%, transparent);
}

.button--ghost{
  background: color-mix(in srgb, var(--panel) 40%, transparent);
}

/* =========================
   FOOTER
   ========================= */
.site-footer{
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--muted);
}

/* =========================
   THEME SWITCH (Day/Night)
   ========================= */
.theme-switch{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 45%, transparent);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.theme-switch__track{
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  background: color-mix(in srgb, #000 12%, transparent);
  position: relative;
  flex: 0 0 auto;
}

.theme-switch__thumb{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  background: var(--text);
  transition: transform 180ms ease;
}

.theme-switch__text{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 0.95rem;
  white-space: nowrap;
}

.theme-switch__label{
  color: var(--muted);
}

/* Checked (Dark mode ON) */
.theme-switch[aria-checked="true"] .theme-switch__thumb{
  transform: translate(20px, -50%);
}

/* Focus ring */
.theme-switch:focus-visible{
  outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent);
  outline-offset: 3px;
}

/* =========================
   WCAG PATCH (AA / 2.2)
   ========================= */

/* Link riconoscibili nel testo (non solo al passaggio mouse) */
main a:not(.button):not(.brand):not(.nav a):not(.lang__link) {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.12em;
}

main a:not(.button):not(.brand):not(.nav a):not(.lang__link):hover {
  text-decoration-thickness: 0.16em;
}

/* Focus visibile e coerente: usa focus-visible */
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus {
  outline: none;
}

:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 70%, transparent);
  outline-offset: 3px;
}

.button:focus-visible,
.nav a:focus-visible,
.lang__link:focus-visible{
  outline-offset: 4px;
}

/* Navbar: hover/focus più evidente */
.nav a:hover,
.nav a:focus-visible{
  border-color: color-mix(in srgb, var(--text) 22%, transparent);
}

/* Skip link: più robusto sopra lo sticky header */
.skip-link:focus-visible{
  left: 12px;
  top: 12px;
  outline: 3px solid color-mix(in srgb, var(--brand) 70%, transparent);
  outline-offset: 2px;
}

/* Target size consigliato (WCAG 2.2) */
.nav a,
.button,
.lang__link,
.theme-switch{
  min-height: 44px;
}

/* Link dentro testo muted: resta riconoscibile */
.muted a{
  text-decoration: underline;
}

/* Anchor con header sticky */
section[id]{
  scroll-margin-top: 80px;
}

/* Riduci motion se l’utente lo chiede */
@media (prefers-reduced-motion: reduce){
  html:focus-within{
    scroll-behavior: auto;
  }
  *, *::before, *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .theme-switch__thumb{
    transition: none !important;
  }
}

/* =========================
   RESPONSIVE (existing)
   ========================= */
@media (max-width: 900px){
  .hero__grid{
    grid-template-columns: 1fr;
  }

  .grid{
    grid-template-columns: 1fr;
  }

  .download-item{
    flex-direction: column;
    align-items: stretch;
  }
}

/* =========================
   MOBILE HEADER TUNING
   ========================= */
@media (max-width: 600px){
  .site-header .container{
    padding: 10px 0;
    gap: 10px;
  }

  /* Brand più compatto */
  .brand__name{
    font-size: 0.98rem;
  }
  .brand__mark{
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  /* NAV: una riga scrollabile */
  .nav{
    width: 100%;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .nav::-webkit-scrollbar{ height: 0; }

  .nav a{
    white-space: nowrap;
    padding: 10px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 55%, transparent);
    border-color: color-mix(in srgb, var(--text) 10%, transparent);
  }

  /* Switch tema e lingua */
  .theme-switch{
    padding: 6px 10px;
  }
  .theme-switch__text{
    font-size: 0.92rem;
  }

  .lang{
    margin-left: 0;
    gap: 6px;
  }

  .lang__link{
    padding: 10px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 55%, transparent);
    border-color: color-mix(in srgb, var(--text) 10%, transparent);
  }

  /* Logo sezione "Chi è Eni" più piccolo su mobile */
  .eni-logo{
    width: 30px;
    height: 30px;
  }

  /* Hero più compatta */
  .hero{
    padding: 26px 0 12px;
  }
}
