/* SurgeGuard · surgeguard.it
   Font IBM Plex in locale (SIL OFL 1.1, vedi /assets/fonts/OFL.txt),
   da @ibm/plex-sans@1.1.0 e @ibm/plex-mono@1.1.0. */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/IBMPlexSans-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/IBMPlexSans-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/IBMPlexSans-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/IBMPlexMono-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/IBMPlexMono-Medium.woff2') format('woff2'); }

/* Griglia modulare: le funzioni ricalcano il simbolo (3×3, modulo ciano in alto a destra, vuoto in basso a destra).
   Due soli fondi, come da brand kit: ghiaccio e blu notte. Un solo aspetto, chiaro con bande scure. */
:root {
  color-scheme: light;
  --night: #0B2A3A;
  --ice: #38BDF8;
  --frost: #F5F7FA;
  --white: #FFFFFF;
  --steel: #94A3B8;
  --ink-2: #475569;
  --ink-3: #64748B;
  --line: #E2E8F0;
  --muted: #CBD5E1;
  --panel-dark: #0F3447;
  --tint: #1E4A5F;

  --ok: #16A34A;
  --ok-border: #BBE5C8;
  --weak-fill: rgba(56, 189, 248, .22);
  --warn: #F59E0B;
  --warn-border: #F8D48A;
  --alarm: #DC2626;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --r-control: 4px;
  --r-panel: 6px;
  --maxw: 1160px;
  --band-y: clamp(64px, 9vw, 112px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--frost);
  color: var(--night);
  font: 400 16px/1.625 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--night);
}
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

.band { padding-block: var(--band-y); }
.band--night { background: var(--night); color: var(--frost); }
.band--light { background: var(--frost); color: var(--night); }
section[id] { scroll-margin-top: 72px; }

.label {
  font: 500 12px/16px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.band--night .label { color: var(--steel); }
.label--ice { color: var(--ice) !important; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.unit { font-size: .62em; color: var(--ink-3); font-weight: 400; margin-left: .15em; }
.band--night .unit, .panel-dark .unit { color: var(--steel); }

.h2 { font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.25rem); line-height: 1.22; letter-spacing: -.015em; }
.h3 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -.01em; }
.lede { font-size: 1.125rem; line-height: 1.7; color: var(--ink-2); max-width: 38em; }
.band--night .lede { color: var(--muted); }

.section-head { display: grid; gap: 14px; max-width: 46rem; margin-bottom: clamp(36px, 5vw, 56px); }

/* Pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: var(--r-control);
  font: 600 15px/1 var(--sans);
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--ice { background: var(--ice); color: var(--night); }
.btn--ice:hover { background: var(--frost); }
.btn--ghost { background: transparent; color: var(--frost); border-color: var(--tint); }
.btn--ghost:hover { border-color: var(--steel); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }

/* Indicatori di stato (da tokens.css) */
.sg-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 8px;
  font: 500 13px/1.2 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--night); background: var(--white);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.sg-status::before { content: ""; width: 10px; height: 10px; border-radius: 2.5px; flex: none; }
.sg-status--ok { border-color: var(--ok-border); }
.sg-status--ok::before { background: var(--ok); }
.sg-status--weak { border: 1px dashed var(--ice); }
.sg-status--weak::before { background: var(--weak-fill); border: 1.5px dashed var(--ice); }
.sg-status--warn { border-color: var(--warn-border); }
.sg-status--warn::before { background: var(--warn); }
.sg-status--alarm { background: var(--alarm); border-color: var(--alarm); color: var(--white); }
.sg-status--alarm::before { background: var(--white); }

/* Testata */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--night);
  border-bottom: 1px solid var(--panel-dark);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; line-height: 0; }
.brand svg { height: 28px; width: auto; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:not(.btn):hover { color: var(--frost); }
@media (max-width: 860px) { .nav a:not(.btn) { display: none; } }

/* Apertura */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 8vw, 104px) clamp(64px, 9vw, 120px); }
.hero__mark {
  position: absolute; z-index: 0; pointer-events: none;
  width: clamp(360px, 52vw, 640px); height: auto; max-width: none;
  right: max(-180px, -12vw); top: clamp(24px, 6vw, 72px);
}
.hero .wrap { position: relative; z-index: 1; display: grid; gap: clamp(40px, 6vw, 72px); grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); align-items: center; }
.hero__copy { display: grid; gap: 22px; min-width: 0; }
.hero h1 {
  font-size: clamp(2.25rem, 1.35rem + 3vw, 3.15rem);
  line-height: 1.08; letter-spacing: -.02em; color: var(--frost);
}
.hero h1 .nobr { display: block; }
.hero .lede { color: var(--muted); max-width: 33em; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.hero__note { font: 400 12px/18px var(--mono); color: var(--steel); letter-spacing: .02em; }
@media (max-width: 960px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero__mark { top: auto; bottom: -60px; right: -120px; width: clamp(320px, 80vw, 520px); }
}

.panel-dark {
  background: var(--panel-dark);
  border: 1px solid var(--tint);
  border-radius: var(--r-panel);
  padding: 20px 20px 16px;
  min-width: 0;
}
.panel-dark__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 14px; }
.panel-dark__time { font: 500 12px/16px var(--mono); color: var(--steel); font-variant-numeric: tabular-nums; }
.units { list-style: none; margin: 0; padding: 0; }
.unit-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--tint);
}
.unit-row__name { min-width: 0; }
.unit-row__name b { display: block; font-weight: 500; font-size: 15px; color: var(--frost); line-height: 1.35; }
.unit-row__name span { display: block; font: 400 11px/16px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--steel); }
.unit-row__val { font-size: 22px; line-height: 1; color: var(--frost); text-align: right; }
.panel-dark__foot { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--tint); font: 400 11px/16px var(--mono); color: var(--steel); letter-spacing: .03em; }
@media (max-width: 440px) {
  .unit-row { grid-template-columns: minmax(0, 1fr) auto; }
  .unit-row .sg-status { grid-column: 1 / -1; justify-self: start; }
}

/* Funzioni: griglia a moduli */
.modules { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 26px 24px 24px;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.module p { color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.module__data { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.module--wide { grid-column: span 2; }
.module--ice { background: var(--ice); border-color: var(--ice); }
.module--ice p { color: var(--night); }
.module--void { background: transparent; border: 0; padding: 26px 8px; justify-content: flex-end; }
.tag { font: 500 11px/16px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--frost); }
.range { display: grid; grid-template-columns: auto auto; gap: 4px 16px; font: 400 13px/20px var(--mono); font-variant-numeric: tabular-nums; }
.range dt { color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.range dd { margin: 0; color: var(--night); font-weight: 500; }
.note-tiny { font: 400 11px/16px var(--mono); color: var(--ink-3); letter-spacing: .03em; }
.msg {
  background: var(--white); border-radius: var(--r-control);
  padding: 12px 14px; display: grid; gap: 8px; width: 100%;
}
.msg__head { display: flex; justify-content: space-between; gap: 8px; font: 500 11px/16px var(--mono); color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.msg__body { font-size: 14px; line-height: 1.45; color: var(--night); }
.link-quiet { font-weight: 600; color: var(--night); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link-quiet:hover { text-decoration-thickness: 2px; }
.spark { width: 100%; height: 48px; display: block; }
@media (max-width: 960px) {
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module--void { display: none; }
}
@media (max-width: 640px) {
  .modules { grid-template-columns: minmax(0, 1fr); }
  .module--wide { grid-column: auto; }
}

/* Sicurezza */
.recent {
  display: grid; gap: 10px; max-width: 44rem;
  padding-top: 22px; margin-top: 4px; border-top: 1px solid var(--tint);
}
.recent p { color: var(--muted); font-size: 1.0625rem; line-height: 1.7; }
.recent .num { color: var(--frost); }
.pivot { margin-top: clamp(40px, 5vw, 56px); font-size: 1.25rem; font-weight: 600; color: var(--frost); }
.points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(32px, 5vw, 64px); margin-top: 20px; }
.point { padding-block: 22px 26px; border-top: 1px solid var(--tint); display: grid; gap: 8px; min-width: 0; }
.point h3 { color: var(--frost); }
.point p { color: var(--muted); font-size: 15.5px; line-height: 1.65; max-width: 34em; }
@media (max-width: 760px) { .points { grid-template-columns: minmax(0, 1fr); } }

.sim {
  margin-top: clamp(48px, 6vw, 72px);
  background: var(--white); color: var(--night);
  border-radius: var(--r-panel);
  padding: clamp(20px, 3vw, 32px);
  display: grid; gap: clamp(24px, 4vw, 40px);
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
.sim__head { grid-column: 1 / -1; display: grid; gap: 8px; }
.sim__head .h3 { font-size: 1.375rem; }
.chart { min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart figcaption { margin-top: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; }
.timeline li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline time { font: 500 13px/22px var(--mono); font-variant-numeric: tabular-nums; color: var(--night); }
.timeline p { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.timeline .sg-status { margin-top: 6px; }
@media (max-width: 900px) { .sim { grid-template-columns: minmax(0, 1fr); } }

/* Come funziona */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 48px); }
.step { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 1px solid var(--night); min-width: 0; }
.step p { color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 760px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.where { margin-top: clamp(56px, 7vw, 88px); display: grid; gap: 22px; }
.where ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
.where li { padding-block: 16px; border-top: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; }
.where li b { font-weight: 600; }
.where li span { color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
@media (max-width: 900px) { .where ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .where ul { grid-template-columns: minmax(0, 1fr); } }

/* Domande */
.faq { max-width: 48rem; border-bottom: 1px solid var(--line); }
.faq details { border-top: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 0; font-weight: 600; font-size: 1.0625rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 22px/1 var(--mono); color: var(--ink-3); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 20px; color: var(--ink-2); max-width: 40em; }

/* Contatti e piede */
.contact { display: grid; gap: 18px; max-width: 46rem; }
.contact .h2 { color: var(--frost); }
.mailbox { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 10px; }
.mailbox__addr { font: 500 clamp(1.25rem, 1rem + 1.2vw, 1.75rem)/1.2 var(--mono); color: var(--frost); user-select: all; overflow-wrap: anywhere; }
.copy-state { font: 400 12px/16px var(--mono); color: var(--steel); min-width: 6em; }

.site-footer { background: var(--night); color: var(--steel); }
.site-footer .wrap { padding-block: 28px 36px; border-top: 1px solid var(--tint); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 32px; }
.site-footer .brand svg { height: 22px; }
.foot-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; font: 400 12px/18px var(--mono); }
.foot-meta .domain { color: var(--frost); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* Classi che sostituiscono gli attributi style dell'anteprima (la CSP non ammette stili inline) */
.sprite { position: absolute; }
.section-head--flush { margin-bottom: 0; }
.chart--flush { margin: 0; }
.band--flush-top { padding-top: 0; }

/* Pagine secondarie: informativa privacy e 404 */
.page-head .wrap { min-height: 64px; }
.prose { display: grid; gap: 18px; max-width: 44rem; }
.prose h1 { font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem); line-height: 1.12; letter-spacing: -.02em; }
.prose h2 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -.01em; margin-top: 18px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.prose a { color: var(--night); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose .mono { font-family: var(--mono); }
.page--night { background: var(--night); }
.not-found { display: grid; gap: 20px; max-width: 40rem; }
.not-found .h2 { color: var(--frost); }
.not-found .lede { color: var(--muted); }
.foot-meta a { color: inherit; text-decoration: none; }
.foot-meta a:hover { color: var(--frost); text-decoration: underline; text-underline-offset: 3px; }
