/* Active Label — sito web
   Layout: ogni sezione usa la stessa griglia a due colonne uguali, così titoli, testi,
   riquadri e immagini partono sempre dagli stessi due allineamenti verticali.
   Blu notte pieno per apertura e piede, magenta solo per azioni ed enfasi. */

:root {
  color-scheme: light;

  /* Colori */
  --ink: #0c1a3a;        /* blu notte: testo e fasce scure */
  --ink-2: #15264f;      /* riquadri sulle fasce scure */
  --paper: #ffffff;
  --mist: #f3f4f8;       /* fondo delle sezioni alternate e dei riquadri */
  --line: #d9dde8;       /* filetti */
  --muted: #515b78;      /* testo secondario */
  --magenta: #c51f58;    /* azioni ed enfasi */
  --blue: #0a6fb3;       /* link, dato "freddo" */
  --on-ink: #ffffff;
  --on-ink-muted: #c3cbe0;
  --on-ink-line: rgba(255, 255, 255, 0.22);
  --pink: #ff7fa8;       /* enfasi e dato "caldo" su fondo scuro */
  --sky: #9ccbf5;        /* dato "freddo" su fondo scuro */

  /* Scala tipografica: sei gradini, usati sempre per lo stesso ruolo */
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-h1: clamp(2.5rem, 4.6vw, 4rem);          /* titolo di pagina */
  --fs-h2: clamp(2rem, 3.3vw, 3rem);            /* titolo di sezione */
  --fs-h3: clamp(1.375rem, 1.9vw, 1.625rem);    /* titolo di riquadro o sottosezione */
  --fs-title: 1.1875rem;                        /* titolo di una voce d'elenco */
  --fs-lead: clamp(1.125rem, 1.4vw, 1.25rem);   /* testo introduttivo */
  --fs-body: 1.0625rem;                         /* testo corrente */
  --fs-small: 0.9375rem;                        /* didascalie, note, etichette */

  /* Spazi, raggi, griglia */
  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 40px);
  --section: clamp(72px, 9vw, 128px);
  --col-gap: clamp(32px, 5vw, 72px);
  --radius: 16px;        /* fotografie e riquadri */
  --radius-s: 10px;      /* pulsanti e campi */
  --shadow: 0 28px 56px -32px rgba(12, 26, 58, 0.35);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* ---------- Gerarchia dei testi ---------- */
h1, h2, h3 { font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); line-height: 1.1; letter-spacing: -0.025em; }
h3 { font-size: var(--fs-h3); line-height: 1.2; letter-spacing: -0.015em; }
h1 em, h2 em { display: block; font-style: italic; font-weight: 800; color: var(--magenta); }

.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.kicker { font-size: var(--fs-small); font-weight: 700; color: var(--magenta); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }

a { color: var(--blue); text-decoration: underline; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Struttura ---------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section) 0; }
.section--mist { background: var(--mist); }

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack--loose { gap: 32px; }
.stack--wide { gap: clamp(40px, 5vw, 64px); }

/* Due colonne uguali: è la griglia di tutto il sito */
.split, .head, .cols--2, .steps--cols, .sectors { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--col-gap); }
.split { row-gap: 40px; align-items: start; }
.split--center { align-items: center; }

/* Intestazione di sezione: titolo a sinistra, testo introduttivo a destra, allineati in basso */
.head { row-gap: 20px; align-items: end; }

.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--col-gap); }

/* ---------- Elenchi separati da filetti ---------- */
.rule { display: flex; flex-direction: column; gap: 6px; padding: 24px 0; border-top: 1px solid var(--line); }
.rule dt, .rule h3 { font-size: var(--fs-title); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.rule dd, .rule p { font-size: 1rem; color: var(--muted); }
.rules-end { border-bottom: 1px solid var(--line); }
.rule p:only-child { font-size: var(--fs-body); font-weight: 600; color: var(--ink); }
.rule:has(> p:only-child) { padding: 16px 0; }

/* Passaggi numerati: la sequenza è reale, quindi il numero resta */
.steps { counter-reset: step; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 6px 12px; padding: 24px 0; border-top: 1px solid var(--line); }
.steps > li::before { content: counter(step); grid-row: span 2; font-size: var(--fs-h3); font-weight: 800; line-height: 1.15; color: var(--magenta); font-variant-numeric: tabular-nums; }
.steps h3 { font-size: var(--fs-title); line-height: 1.3; letter-spacing: -0.01em; }
.steps p { grid-column: 2; font-size: 1rem; color: var(--muted); }

/* ---------- Riquadri ---------- */
.box { padding: clamp(24px, 3vw, 40px); border-radius: var(--radius); background: var(--mist); }
.section--mist .box { background: var(--paper); }
.band .box { background: var(--ink-2); }
.box figcaption, .shot figcaption { font-size: var(--fs-small); color: var(--muted); }

/* ---------- Pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 12px 26px; border: 2px solid var(--magenta); border-radius: var(--radius-s); background: var(--magenta); color: #ffffff; font: inherit; font-size: 1rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: #a3164a; border-color: #a3164a; color: #ffffff; }
.btn--light { background: #ffffff; border-color: #ffffff; color: var(--ink); }
.btn--light:hover { background: var(--mist); border-color: var(--mist); color: var(--ink); }
.btn--small { min-height: 44px; padding: 8px 18px; font-size: var(--fs-small); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.more { font-weight: 700; }
.more::after { content: "→"; display: inline-block; margin-left: 0.4em; }

/* ---------- Testata ---------- */
.site-header { background: var(--ink); color: var(--on-ink); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; padding-top: 20px; padding-bottom: 20px; }
.site-header img { height: 44px; width: auto; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; font-size: var(--fs-small); font-weight: 500; }
.site-nav a { padding: 10px 0; color: var(--on-ink-muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #ffffff; text-decoration: underline; }
.site-tools { display: flex; align-items: center; gap: 20px; }
.lang { font-size: var(--fs-small); color: var(--on-ink-muted); }
.lang strong { color: #ffffff; }

/* ---------- Fasce scure ---------- */
.band { background: var(--ink); color: var(--on-ink); }
.band .lead, .band .muted { color: var(--on-ink-muted); }
.band .kicker { color: var(--pink); }
.band a:not(.btn) { color: #ffffff; }
.band h1 em, .band h2 em { color: var(--pink); }
.band .rule, .band .steps > li { border-color: var(--on-ink-line); }
.band .rule dd, .band .rule p, .band .steps p { color: var(--on-ink-muted); }
.band .steps > li::before { color: var(--pink); }
.hero { padding: clamp(48px, 6vw, 88px) 0 clamp(72px, 8vw, 112px); }

.band--magenta { background: var(--magenta); }
.band--magenta h2 em, .band--magenta .lead { color: #ffffff; }

/* ---------- Grafico della storia termica ---------- */
.trace { display: flex; flex-direction: column; gap: 16px; }
.trace__ends { display: flex; justify-content: space-between; gap: 16px; font-size: var(--fs-small); color: var(--on-ink-muted); }
.trace__ends strong { display: block; font-size: var(--fs-h3); line-height: 1.15; font-weight: 800; color: #ffffff; }
.trace__ends div:last-child { text-align: right; }
.trace__stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 2.5%; font-size: clamp(0.625rem, 0.45rem + 0.5vw, 0.8125rem); text-align: center; hyphens: auto; overflow-wrap: anywhere; color: var(--on-ink-muted); }
.trace__stages--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trace__stages .is-hot { font-weight: 700; color: var(--pink); }
.trace figcaption { padding-top: 16px; border-top: 1px solid var(--on-ink-line); color: var(--on-ink-muted); }

/* ---------- Figure e fotografie ---------- */
.shot { display: flex; flex-direction: column; gap: 14px; }
.shot img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.figure-box { display: flex; flex-direction: column; gap: 16px; }

.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.pair figure { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.pair svg { width: 100%; }
.pair figcaption { color: var(--muted); }
.pair figcaption strong { display: block; font-size: var(--fs-title); color: var(--ink); }

/* Settori: quattro riquadri con fotografia, due per riga */
.sectors { row-gap: var(--col-gap); }
.sectors > li { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--mist); }
.sectors__media { overflow: hidden; aspect-ratio: 3 / 2; background: var(--line); }
.sectors__media img { width: 100%; height: 100%; object-fit: cover; }
.sectors__body { display: flex; flex-direction: column; flex-grow: 1; gap: 10px; padding: clamp(24px, 3vw, 36px); }
.sectors__body p:not(.kicker) { font-size: 1rem; color: var(--muted); }
.sectors__body .more { display: inline-block; margin-top: 6px; }

/* Sostenitori */
.supporters-strip { padding: 40px 0; background: var(--paper); border-top: 1px solid var(--line); }
.supporters { display: flex; flex-wrap: wrap; align-items: center; gap: 20px clamp(24px, 4vw, 48px); }
.supporters img { height: 72px; width: auto; }

/* Catalogo: copertina in primo piano, due pagine interne dietro */
.catalog { display: flex; align-items: center; justify-content: center; padding: clamp(32px, 5vw, 64px) 0; }
.catalog__pages { display: grid; width: 74%; max-width: 360px; }
.catalog__pages img { grid-area: 1 / 1; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.catalog__pages img:nth-child(1) { transform: rotate(-6deg) translateX(-14%); }
.catalog__pages img:nth-child(2) { transform: rotate(5deg) translateX(14%); }
.catalog__pages img:nth-child(3) { position: relative; z-index: 1; box-shadow: var(--shadow); }

/* ---------- Modulo ---------- */
.form { display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow); }
.form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-small); font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid #8f98b3; border-radius: var(--radius-s); background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }
.field textarea { min-height: 120px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 12px; font-size: var(--fs-small); color: var(--muted); }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--magenta); }
.form__note { font-size: var(--fs-small); font-weight: 600; }

/* ---------- Piede ---------- */
.site-footer { background: var(--ink); color: var(--on-ink-muted); font-size: var(--fs-small); }
.site-footer .wrap { display: flex; flex-direction: column; gap: 48px; padding-top: 64px; padding-bottom: 32px; }
.site-footer a { color: var(--on-ink-muted); text-decoration: none; }
.site-footer a:hover { color: #ffffff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px var(--col-gap); }
.footer-grid h2 { font-size: var(--fs-small); font-weight: 700; line-height: 1.6; letter-spacing: 0; color: #ffffff; }
.footer-grid ul, .footer-grid .stack { gap: 10px; display: flex; flex-direction: column; }
.footer-brand img { height: 50px; width: auto; }
.footer-brand p { font-style: italic; font-weight: 700; color: #ffffff; }
.footer-cert { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; padding-top: 32px; border-top: 1px solid var(--on-ink-line); }
.footer-cert img { width: 72px; height: auto; padding: 6px; background: #ffffff; border-radius: var(--radius-s); }
.footer-cert p { max-width: 34rem; }
.footer-cert strong { color: #ffffff; }
.footer-cert a { color: #ffffff; text-decoration: underline; }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 32px; padding-top: 24px; border-top: 1px solid var(--on-ink-line); }
.footer-legal ul { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ---------- Schermi stretti: tutto su una colonna ---------- */
@media (max-width: 860px) {
  .split, .head, .cols, .cols--2, .steps--cols, .sectors { grid-template-columns: minmax(0, 1fr); }
  .head { align-items: start; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .pair, .footer-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Testata che resta in alto (solo su schermi larghi, dove occupa una riga) */
@media (min-width: 861px) {
  .site-header { position: sticky; top: 0; z-index: 10; }
  [id] { scroll-margin-top: 88px; }
}

/* ---------- Movimento ----------
   Tutto ciò che segue vale solo per chi non ha chiesto di ridurre le animazioni.
   A riposo ogni contenuto è visibile: le animazioni partono quando l'elemento
   sta per entrare nello schermo (classe .is-in aggiunta da js/site.js). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Ingresso dei contenuti, con un leggero scarto tra elementi vicini */
  @keyframes entra {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
  }
  .is-in { animation: entra 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--i, 0) * 80ms); }

  /* Il grafico si disegna da sinistra a destra, come il viaggio del prodotto */
  @keyframes disegna {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
  }
  @keyframes compare {
    from { opacity: 0; transform: scale(0.2); }
    to { opacity: 1; transform: none; }
  }
  .is-in .chart__line { stroke-dasharray: 1; animation: disegna 2s cubic-bezier(0.45, 0, 0.55, 1) 0.3s backwards; }
  .is-in .chart__dot { transform-box: fill-box; transform-origin: center; animation: compare 0.35s ease-out backwards; animation-delay: var(--d, 0s); }

  /* Testata: si compatta dopo i primi pixel di scorrimento */
  .site-header .wrap { transition: padding 0.25s ease; }
  .site-header img { transition: height 0.25s ease; }
  .site-header.is-compact .wrap { padding-top: 10px; padding-bottom: 10px; }
  .site-header.is-compact img { height: 36px; }
  .site-header.is-compact { box-shadow: 0 1px 0 var(--on-ink-line); }

  /* Voci di menu: la sottolineatura cresce da sinistra */
  .site-nav a { background: linear-gradient(currentColor, currentColor) 0 calc(100% - 6px) / 0 2px no-repeat; transition: background-size 0.25s ease, color 0.2s ease; }
  .site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: none; background-size: 100% 2px; }

  /* Pulsanti e link di approfondimento */
  .btn { transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: none; }
  .more::after { transition: transform 0.2s ease; }
  .more:hover::after { transform: translateX(5px); }

  /* Riquadri dei settori: si sollevano e la fotografia si avvicina */
  .sectors > li { transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s ease; }
  .sectors > li:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
  .sectors__media img { transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .sectors > li:hover .sectors__media img { transform: scale(1.05); }

  /* Catalogo: le pagine interne si aprono a ventaglio al passaggio del mouse */
  .catalog__pages img { transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .catalog:hover .catalog__pages img:nth-child(1) { transform: rotate(-10deg) translateX(-22%); }
  .catalog:hover .catalog__pages img:nth-child(2) { transform: rotate(9deg) translateX(22%); }

  .field input, .field select, .field textarea { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
  .field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink); }
}
