/* ============================================================
   ADELMA — Chi resta accanto? Il fine vita delle persone sole
   Foglio di stile della pagina index.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
  color-scheme: light;
  /* Palette Adelma: verde Bruno, terracotta, crema, oro chiaro */
  --bg: #FFFFFF;
  --surface: #FAF3E2;
  --surface-2: #F3EDE0;
  --line: #E7E1D3;
  --ink: #43493F;
  --ink-hover: #565E51;
  --muted: #5A6156;
  --field: #43493F;
  --field-2: #4D5448;
  --field-3: #586050;
  --field-ink: #FDFBF6;
  --field-muted: #CFD2C8;
  --tile: #E7E1D3;
  --gold: #EFE0AE;
  --accent: #BB4E31;
  --accent-strong: #A8492F;

  --head: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --text: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;

  --t-display: clamp(52px, 8.3vw, 128px);
  --t-hero: clamp(46px, 7vw, 112px); /* titolo d’apertura su tre righe: «resterebbe» deve stare nella colonna */
  --t-head: clamp(34px, 4vw, 60px);
  --t-statement: clamp(22px, 2.2vw, 32px);
  --t-lead: clamp(19px, 1.8vw, 26px);

  /* Colonne dell'apertura, prese dalla bozza */
  --col-l: calc(var(--m) + 8.33vw);
  --col-text: 43.3vw;
  --col-r: 11.5vw;
  --t-body: 18px;
  --t-small: 15px;

  --m: clamp(16px, 2.2vw, 32px);
  --axis: calc(42vw - var(--m));
  --gap: clamp(96px, 11vw, 200px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-optical-sizing: auto; font-style: normal; font-size: var(--t-body); line-height: 1.2; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--head); font-optical-sizing: auto; font-weight: 300; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 0.07em; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--m); top: -100px; z-index: 10; background: var(--ink); color: var(--field-ink); padding: 12px 16px; }
.skip:focus { top: 8px; }

/* Buttons: square, one fill */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px;
  background: var(--ink); color: var(--field-ink);
  font-family: var(--head); font-weight: 600; font-size: var(--t-body); text-decoration: none;
  transition: transform 140ms var(--ease-out), background-color 180ms ease, color 180ms ease;
}
.button:active { transform: scale(0.97); }
.button svg { transition: transform 240ms var(--ease-out); }
.button--accent { background: var(--accent); color: #FFFFFF; }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ink-hover); }
  .button:hover svg { transform: translateX(4px); }
  .button--accent:hover { background: var(--accent-strong); }
}

/* ---------- Hero ---------- */
.hero { position: relative; }
.masthead {
  display: grid; height: 52svh; min-height: 360px;
  grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 1fr 1fr;
  grid-template-areas: "a a b c d e" "f g b h h e";
}
.cell { overflow: hidden; margin: 0; background: var(--tile); }
.c-a { grid-area: a; background: var(--line); }
.c-b { grid-area: b; background: var(--ink); }
.c-c { grid-area: c; background: var(--accent); }
.c-d { grid-area: d; background: var(--surface); }
.c-e { grid-area: e; background: var(--muted); }
.c-f { grid-area: f; background: var(--gold); }
.c-g { grid-area: g; background: var(--surface-2); }
.c-h { grid-area: h; background: #D9D1BE; }

.topbar { position: absolute; inset: 0 0 auto 0; display: flex; align-items: stretch; height: 56px; z-index: 2; }
.wordmark { display: flex; align-items: center; padding: 0 22px; background: var(--ink); color: var(--field-ink); font-family: var(--head); font-weight: 600; font-size: var(--t-body); letter-spacing: -0.01em; text-decoration: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.logo { display: block; width: auto; aspect-ratio: 498.512 / 143.772; }
.wordmark .logo { height: 24px; color: #FFFFFF; }
.tab { display: flex; align-items: center; gap: 22px; padding: 0 22px; width: max(calc(42vw - 112px), 330px); background: var(--gold); }
.tab a { font-size: var(--t-small); font-weight: 700; text-decoration: none; color: var(--ink); }
.tab a:hover { text-decoration: underline; }
.topbar .button { margin-left: auto; min-height: 56px; }

/* Apertura: titolo e frase con le cifre partono dallo stesso bordo sinistro (--col-l);
   testo e pulsante partono al 43% della larghezza (--col-text) e arrivano allo stesso
   bordo destro della frase con le cifre (--col-r). */
.hero-text {
  display: grid;
  grid-template-columns: minmax(max-content, calc(var(--col-text) - var(--col-l))) minmax(0, 1fr);
  align-items: start;
  padding: 72px var(--col-r) 0 var(--col-l);
}
.hero h1 { padding-right: 32px; font-size: var(--t-hero); line-height: 0.9; letter-spacing: -0.04em; }
.hero-side { padding-top: calc(var(--t-hero) * 0.03); padding-right: 1.5vw; }
.standfirst { font-size: var(--t-lead); line-height: 1.2; color: var(--ink); }
.hero .actions { margin-top: 28px; }

/* masked line reveal */
.lines .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.lines [data-line] { display: block; }

/* ---------- Statement with figures ---------- */
.figures { padding: clamp(120px, 22vw, 320px) var(--m) var(--gap); }
.figures p { max-width: none; margin-left: calc(var(--col-l) - var(--m)); margin-right: calc(var(--col-r) - var(--m)); font-size: var(--t-statement); line-height: 1.2; color: var(--muted); }
.figures b { color: var(--ink); font-weight: 700; font-variant-numeric: lining-nums; }

/* ---------- Night field: the law ---------- */
.night { background: var(--field); color: var(--field-ink); }
.law { padding: var(--gap) var(--m); }
.law-head { display: grid; grid-template-columns: var(--axis) minmax(0, 1fr); gap: 32px; align-items: end; }
.law h2 { font-size: var(--t-head); line-height: 1; letter-spacing: -0.03em; }
.law-head p { max-width: 44ch; color: var(--field-muted); }
.law-head p b { color: var(--field-ink); font-weight: 700; }
.diagram { display: block; width: 100%; height: auto; margin-top: 72px; }
.diagram--tall { display: none; }
.thirds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 40px; }
.thirds h3 { font-size: var(--t-statement); letter-spacing: -0.02em; margin-bottom: 10px; }
.thirds p { color: var(--field-muted); max-width: 34ch; }
.thirds .ref { display: block; margin-top: 12px; font-size: var(--t-small); color: var(--field-muted); }

.who { display: grid; grid-template-columns: var(--axis) minmax(0, 1fr); gap: 32px; margin-top: var(--gap); padding-top: 0; }
.who h3 { font-size: var(--t-head); line-height: 1; letter-spacing: -0.03em; max-width: 13ch; }
.who-form fieldset { border: 0; margin: 0; padding: 0; }
.who-intro { margin-top: 24px; max-width: 34ch; color: var(--field-muted); }
.choices { display: grid; gap: 4px; }
.choice { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 18px; background: var(--field-2); cursor: pointer; transition: background-color 180ms ease; }
.choice input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.choice:has(input:checked) { background: var(--field-3); }
@media (hover: hover) and (pointer: fine) { .choice:hover { background: #535A4E; } }
.answer { margin-top: 32px; padding: 28px 24px; background: var(--field-ink); color: var(--ink); }
.answer .who-name { font-family: var(--head); font-size: var(--t-statement); letter-spacing: -0.02em; }
.answer .who-name strong { font-weight: 600; }
.answer .note { margin-top: 10px; color: var(--muted); }

/* ---------- Comparison ---------- */
.compare { padding: var(--gap) var(--m) 0; }
.compare h2 { font-size: var(--t-head); line-height: 1; letter-spacing: -0.03em; }
.compare-lead { max-width: 44ch; margin: 20px 0 48px; color: var(--muted); }
.compare table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.compare col.c-name { width: 34%; }
.compare th, .compare td { text-align: left; vertical-align: middle; padding: 18px 20px; }
.compare thead th { font-family: var(--text); font-size: var(--t-body); font-weight: 700; padding-top: 14px; padding-bottom: 14px; }
.compare thead th.ch { padding-top: 38px; }
.compare tbody th { font-family: var(--head); font-weight: 300; font-size: var(--t-statement); letter-spacing: -0.02em; }
.compare tbody tr:nth-child(odd) th, .compare tbody tr:nth-child(odd) td { background: var(--surface); }
.compare .ch { background: var(--ink) !important; color: var(--field-ink); }

/* ---------- The gap: tiles ---------- */
.gap { padding: var(--gap) var(--m) 0; }
.board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 38svh 38svh minmax(38svh, auto); gap: 8px; }
.t-a { grid-column: 1 / 9; grid-row: 1 / 3; background: var(--ink); color: var(--field-ink); display: flex; align-items: flex-end; padding: 28px; }
.t-a h2 { font-size: var(--t-display); line-height: 0.86; letter-spacing: -0.04em; text-transform: uppercase; }

/* Riquadri con cifra: la cifra grande in alto, il testo che la completa subito sotto. */
.fig-tile { padding: 24px; display: flex; flex-direction: column; justify-content: flex-start; gap: 14px; overflow: hidden; }
.fig-tile .fig { font-family: var(--head); font-weight: 300; font-size: var(--t-display); line-height: 0.86; letter-spacing: -0.05em; }
.fig-tile p { font-size: var(--t-small); max-width: 28ch; }
.t-b { grid-column: 9 / 13; grid-row: 1; background: var(--surface-2); }
.t-c { grid-column: 9 / 13; grid-row: 2; background: var(--gold); }
.t-d { grid-column: 1 / 5; grid-row: 3; background: var(--line); }
.t-e { grid-column: 5 / 9; grid-row: 3; background: var(--field-3); color: var(--field-ink); }
/* Il testo chiude la terza fila; il rientro lo allinea alle cifre dei riquadri sopra. */
.t-txt { grid-column: 9 / 13; grid-row: 3; padding: 24px 0 24px 24px; }

/* ---------- Agenda ---------- */
.agenda { padding: var(--gap) var(--m); }
.agenda-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.agenda h2 { font-size: var(--t-head); line-height: 1; letter-spacing: -0.03em; max-width: 14ch; }
.agenda-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 40px; margin-top: 56px; }
.tabs { display: none; flex-direction: column; gap: 6px; }
.js .tabs { display: flex; }
.tabs button {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px;
  min-height: 64px; padding: 10px 16px; border: 0; background: var(--surface); color: var(--ink);
  font: 700 var(--t-body)/1.2 var(--text); text-align: left; cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 140ms var(--ease-out);
}
.tabs button span { font-weight: 400; font-size: var(--t-small); color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--field-ink); }
.tabs button[aria-selected="true"] span { color: var(--field-muted); }
.tabs button:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .tabs button[aria-selected="false"]:hover { background: var(--surface-2); } }
.agenda-body:not(:has(.tabs)) { grid-template-columns: 1fr; }
.panels { grid-column: 1 / -1; display: grid; gap: 40px; }
.js .panels { grid-column: 2; }
.panel h3 { font-family: var(--text); font-weight: 700; font-size: var(--t-body); margin-bottom: 12px; }
.js .panel h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.js .panel[hidden] { display: none; }
.bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bands li { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 24px; min-height: 76px; padding: 14px 20px; background: var(--surface); }
.bands li:nth-child(even) { background: var(--surface-2); }
.bands time { font-weight: 700; font-variant-numeric: tabular-nums; }
.bands .note { font-size: var(--t-small); color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .js .panel:not([hidden]) .bands li { animation: band-in 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
}
@keyframes band-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Chiusura ---------- */
.closing { background: var(--field); color: var(--field-ink); }
.cl-main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; padding: 96px var(--m) 72px; align-items: start; }
.cl-ask { grid-column: 1 / 6; }
.cl-ask h2 { font-size: var(--t-head); line-height: 1; letter-spacing: -0.03em; }
.cl-ask p { max-width: 40ch; margin-top: 20px; color: var(--field-muted); }
.cl-ask .button { margin-top: 32px; }
.cl-sources { grid-column: 7 / 13; font-size: var(--t-small); }
.cl-sources h2 { font-family: var(--text); font-weight: 700; font-size: var(--t-small); margin-bottom: 12px; color: var(--field-ink); }
.cl-sources ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.cl-sources a { color: var(--field-muted); text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color 180ms ease, color 180ms ease; }
.cl-sources a:hover { color: var(--field-ink); text-decoration-color: currentColor; }
.cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 40px; padding: 22px var(--m); background: var(--surface); font-size: var(--t-small); color: #000000; }
.cl-bar nav a { color: #000000; text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color 180ms ease; }
.cl-bar nav a:hover { text-decoration-color: currentColor; }
.cl-logo { display: block; color: var(--accent); }
.cl-logo .logo { height: 28px; }
.cl-bar nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.cl-legal { margin-left: auto; }

/* ---------- Entrances ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .hero [data-line] { transform: translateY(105%); animation: line-up 900ms var(--ease-expo) forwards; animation-delay: calc(var(--i) * 110ms + 150ms); }
  .js .hero [data-load] { opacity: 0; transform: translateY(12px); animation: rise 500ms var(--ease-out) forwards; animation-delay: var(--d); }
  .js .masthead .cell { opacity: 0; animation: tile-in 700ms var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 60ms); }
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-expo); transition-delay: calc(var(--i, 0) * 80ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 0; transition: opacity 500ms ease; }
  .js [data-reveal].is-in { opacity: 1; }
}
@keyframes line-up { to { transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes tile-in { to { opacity: 1; } }

/* ---------- Tablet ---------- */
@media (max-width: 1000px) {
  .thirds { gap: 20px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .t-a { grid-column: 1 / -1; grid-row: auto; min-height: 32svh; }
  .fig-tile { grid-column: auto; grid-row: auto; aspect-ratio: 16 / 10; }
  .t-txt { grid-column: 1 / -1; grid-row: auto; max-width: 60ch; padding: 40px 0 0; }
  .cl-main { grid-template-columns: minmax(0, 1fr); gap: 56px; }
  .cl-ask, .cl-sources { grid-column: 1 / -1; }
}

/* ---------- Phone ---------- */
@media (max-width: 700px) {
  :root { --axis: 0px; --t-display: 13vw; --t-hero: 13vw; --t-statement: 22px; }
  .topbar { position: static; height: 56px; }
  .tab { display: none; }
  .masthead { height: 38svh; min-height: 260px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "a a b" "f c e"; }
  .c-d, .c-g, .c-h { display: none; }
  .hero-text { grid-template-columns: minmax(0, 1fr); padding: 32px var(--m) 0; }
  .hero h1 { padding-right: 0; }
  .topbar .button { flex: 1 1 auto; }
  .hero-side { padding-top: 0; }
  .standfirst { margin-top: 28px; }
  .hero .actions { margin-top: 28px; }
  .hero .actions .button { width: 100%; }
  .figures { padding-top: 96px; }
  .figures p { margin-left: 0; margin-right: 0; }
  .law-head, .who { grid-template-columns: 1fr; }
  .who h3 { max-width: none; }
  .diagram--wide { display: none; }
  .law-flow { display: grid; grid-template-columns: minmax(0, 1fr) 38vw; gap: 16px; margin-top: 48px; }
  .diagram--tall { display: block; margin-top: 0; }
  .thirds { grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); margin-top: 0; gap: 12px; }
  .thirds h3 { margin-bottom: 6px; }
  .thirds p { font-size: var(--t-small); }
  .compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .compare table, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: 100%; }
  .compare tbody tr { padding: 18px 0 0; }
  .compare tbody tr:nth-child(odd) { background: var(--surface); }
  .compare tbody tr:nth-child(odd) th, .compare tbody tr:nth-child(odd) td { background: transparent; }
  .compare tbody th { padding: 0 16px 8px; }
  .compare td { padding: 6px 16px 14px; }
  .compare td::before { content: attr(data-label); display: block; font-weight: 700; font-size: var(--t-small); margin-bottom: 2px; }
  .compare td.ch { background: var(--ink) !important; padding-top: 12px; }
  .board { gap: 6px; }
  .t-a { min-height: 0; padding: 96px 20px 20px; }
  .fig-tile { aspect-ratio: 1; min-height: 0; padding: 14px; gap: 10px; }
  .fig-tile .fig { font-size: 11vw; }
  .t-txt { padding-top: 32px; }
  .agenda-body { grid-template-columns: 1fr; gap: 20px; }
  .js .tabs { flex-direction: row; position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 8px 0; }
  .tabs button { flex: 1 1 0; min-width: 0; padding: 8px 10px; font-size: var(--t-small); }
  .tabs button span { display: none; }
  .js .panels { grid-column: 1; }
  .bands li { grid-template-columns: 1fr; gap: 4px; padding: 16px; }
  .cl-main { padding: 72px var(--m) 56px; gap: 48px; }
  .cl-sources ul { grid-template-columns: 1fr; }
  .cl-ask .button { width: 100%; }
  .cl-bar { padding: 24px var(--m); gap: 16px 24px; }
  .cl-legal { margin-left: 0; width: 100%; }
}
