/* ==========================================================================
   Mio Indirizzo IP - foglio di stile unico
   Nessuna dipendenza esterna. Componenti documentati in docs/COMPONENTI.md
   Indice: 1 font · 2 token · 3 reset · 4 layout · 5 header · 6 footer
           7 hero e sezioni · 8 card strumenti · 9 articolo · 10 componenti
           11 home · 12 errore · 13 cookie · 14 utilità · 15 stampa
   ========================================================================== */

/* 1. Font ---------------------------------------------------------------- */
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
/* Metriche di ripiego simili a Geist: riducono lo spostamento al caricamento. */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial");
  size-adjust: 104%;
  ascent-override: 94%;
  descent-override: 24%;
  line-gap-override: 0%;
}

/* 2. Token --------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Marca: petrolio (superfici forti) + arancio segnale (azione principale) */
  --ink-950: #061a20;
  --ink-900: #0b2b33;
  --ink-800: #113843;
  --ink-700: #1b4955;
  --ink-600: #2c5d69;
  --on-ink: #f1f7f7;
  --on-ink-2: #b7cbce;
  --on-ink-line: #2a525c;
  --on-ink-strong: #fbfdfd;
  --on-ink-accent: #8fd8dd;

  --teal-700: #0e6b73;
  --teal-800: #0b5359;
  --teal-100: #d6ecec;
  --teal-50: #ecf6f6;

  --accent: #c2410c;
  --accent-hover: #a3360a;
  --accent-on: #ffffff;
  --accent-soft: #fdeee6;

  /* Neutri leggermente tinti verso il petrolio */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f6f7;
  --surface-3: #e7eef0;
  --line: #d6e0e2;
  --line-strong: #b4c4c8;
  --text: #0f2329;
  --text-2: #45575d;
  --text-3: #56686d;

  --link: var(--teal-700);
  --link-hover: var(--teal-800);
  --focus: #0e7c85;

  /* Stati */
  --ok: #156c31;      --ok-bg: #e6f4ea;    --ok-line: #a7d6b4;
  --warn: #8a4a00;    --warn-bg: #fdf2dd;  --warn-line: #efcd8f;
  --err: #b42318;     --err-bg: #fdecea;   --err-line: #f1b3ad;
  --info: #0b5d88;    --info-bg: #e7f2f9;  --info-line: #a9cde5;
  --neutral: #45575d; --neutral-bg: #eef3f4; --neutral-line: #d6e0e2;

  /* Terminale (sempre scuro) */
  --term-bg: #0a1d22;
  --term-text: #d7e6e8;
  --term-dim: #8fa9ae;
  --term-ok: #7ad69a;
  --term-err: #ff9b8f;

  /* Tipografia */
  --font: "Geist", "Geist Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --fs-xs: .8125rem;   /* 13 */
  --fs-sm: .875rem;    /* 14 */
  --fs-base: 1rem;     /* 16 */
  --fs-md: 1.125rem;   /* 18 */
  --fs-lg: 1.375rem;   /* 22 */
  --fs-xl: 1.75rem;    /* 28 */
  --fs-2xl: 2.25rem;   /* 36 */
  --fs-3xl: 2.75rem;   /* 44 */
  --lh-tight: 1.2;
  --lh: 1.55;
  --lh-prose: 1.68;

  /* Spaziature (base 4px) */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.25rem;
  --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem; --sp-12: 3rem; --sp-16: 4rem; --sp-20: 5rem;

  /* Forme: controlli 8px, contenitori 12px, badge e chip a pillola */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgb(11 43 51 / .06), 0 1px 3px rgb(11 43 51 / .06);
  --shadow-2: 0 12px 32px -12px rgb(11 43 51 / .28), 0 2px 6px rgb(11 43 51 / .08);

  --container: 1240px;
  --gutter: 1rem;
  --header-h: 64px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --t: 180ms;

  /* Livelli */
  --z-header: 50;
  --z-menu: 60;
  --z-drawer: 70;
  --z-consent: 90;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink-950: #040f13;
    --ink-900: #0c242b;
    --ink-800: #12313a;
    --ink-700: #1a404a;
    --on-ink-line: #24474f;

    --teal-100: #173b40;
    --teal-50: #11292e;

    --accent-soft: #3a1d10;

    --bg: #0a171b;
    --surface: #0f1f24;
    --surface-2: #12252b;
    --surface-3: #16292f;
    --line: #22383f;
    --line-strong: #345159;
    --text: #e3eeef;
    --text-2: #a8bcc0;
    --text-3: #98aeb3;

    --link: #6cc9cf;
    --link-hover: #9adde1;
    --focus: #6cc9cf;

    --ok: #7fd49a;      --ok-bg: #12301f;    --ok-line: #24573a;
    --warn: #f2c06b;    --warn-bg: #33250d;  --warn-line: #5f4516;
    --err: #ff9d92;     --err-bg: #3a1714;   --err-line: #6a2a24;
    --info: #8cc8ef;    --info-bg: #0f2a3b;  --info-line: #1f4c68;
    --neutral: #b2c3c7; --neutral-bg: #16292f; --neutral-line: #2a434a;

    --term-bg: #061216;

    --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-2: 0 16px 40px -12px rgb(0 0 0 / .7), 0 2px 6px rgb(0 0 0 / .4);
  }
}

@media (min-width: 640px)  { :root { --gutter: 1.5rem; } }
@media (min-width: 1024px) { :root { --gutter: 2rem; } }

/* 3. Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; display: block; }
h1, h2, h3, h4, p, ul, ol, dl, figure, blockquote, pre { margin: 0; }
h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 650; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); letter-spacing: -.025em; }
h2 { font-size: var(--fs-xl); letter-spacing: -.02em; }
h3 { font-size: var(--fs-md); letter-spacing: -.01em; }
p { text-wrap: pretty; }
ul, ol { padding: 0; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
code, kbd, samp, pre { font-family: var(--mono); font-size: .92em; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-8) 0; }
[hidden] { display: none !important; }
::selection { background: var(--teal-100); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 4. Layout -------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.narrow { max-width: calc(760px + var(--gutter) * 2); }
.section { padding-block: var(--sp-12); }
.section-alt { background: var(--surface-2); }
.section-head { margin-bottom: var(--sp-6); }
.section-head p { color: var(--text-2); margin-top: var(--sp-2); max-width: 70ch; }
@media (min-width: 1024px) { .section { padding-block: var(--sp-16); } }

.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
                             .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }

/* 5. Header e navigazione ------------------------------------------------- */
.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 100;
  background: var(--ink-900); color: var(--on-ink); padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); color: var(--on-ink); }

.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: flex; align-items: center; gap: var(--sp-6);
  height: var(--header-h);
  position: relative;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--text); text-decoration: none; flex-shrink: 0;
  border-radius: var(--r);
}
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; }
.brand-name { font-size: 1.0625rem; font-weight: 450; letter-spacing: -.02em; }
.brand-name strong { font-weight: 700; }

.site-nav { margin-left: auto; }
.nav-list { list-style: none; display: flex; align-items: center; gap: 2px; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: .3rem;
  height: 40px; padding: 0 .7rem;
  border: 0; background: none; border-radius: var(--r);
  color: var(--text); font-size: var(--fs-sm); font-weight: 550;
  text-decoration: none; white-space: nowrap;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.nav-link:hover, .nav-menu-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link .icon-sm { transition: transform var(--t) var(--ease); color: var(--text-3); }
.nav-menu-btn[aria-expanded="true"] .icon-sm { transform: rotate(180deg); }
.nav-link.is-active, .nav-item.is-active > .nav-link { color: var(--teal-700); box-shadow: inset 0 -2px 0 var(--teal-700); border-radius: var(--r) var(--r) 0 0; }
@media (prefers-color-scheme: dark) {
  .nav-link.is-active, .nav-item.is-active > .nav-link { color: var(--link); box-shadow: inset 0 -2px 0 var(--link); }
}
.nav-all {
  margin-left: var(--sp-2);
  border: 1px solid var(--line-strong);
}
.nav-all:hover { border-color: var(--teal-700); }

/* Pannello a tendina (mega menu di categoria) */
.nav-menu {
  display: none;
  position: absolute; top: calc(100% + 10px); left: 0; z-index: var(--z-menu);
  width: min(620px, calc(100vw - 2 * var(--gutter)));
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.nav-item:nth-last-child(-n+3) > .nav-menu { left: auto; right: 0; }
.nav-menu-btn[aria-expanded="true"] + .nav-menu { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .nav-menu-btn[aria-expanded="true"] + .nav-menu { animation: menu-in 160ms var(--ease); }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.nav-menu ul { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.nav-menu a {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3); border-radius: var(--r);
  color: var(--text); text-decoration: none;
}
.nav-menu a:hover { background: var(--surface-2); }
.nav-menu a[aria-current="page"] { background: var(--teal-50); }
.nav-menu a > .icon {
  flex: none; width: 36px; height: 36px; padding: 8px;
  border-radius: var(--r); background: var(--teal-50); color: var(--teal-700);
}
@media (prefers-color-scheme: dark) { .nav-menu a > .icon { color: var(--link); } }
.nav-menu strong { display: block; font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.nav-menu small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-2); line-height: 1.4; }

/* Pulsante hamburger */
.nav-toggle {
  display: none; margin-left: auto;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  align-items: center; justify-content: center;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Drawer mobile e tablet */
@media (max-width: 1099.98px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: fixed; inset: var(--header-h) 0 0 0; z-index: var(--z-drawer);
    margin: 0; padding: var(--sp-4) var(--gutter) var(--sp-12);
    background: var(--surface);
    overflow-y: auto; overscroll-behavior: contain;
    border-top: 1px solid var(--line);
  }
  .site-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; max-width: 640px; margin-inline: auto; }
  .nav-list > li { border-bottom: 1px solid var(--line); }
  .nav-link { width: 100%; height: 52px; padding: 0 var(--sp-2); font-size: var(--fs-base); justify-content: space-between; border-radius: 0; }
  .nav-link.is-active, .nav-item.is-active > .nav-link { box-shadow: none; }
  .nav-all { margin: var(--sp-4) 0 0; border: 1px solid var(--line-strong); border-radius: var(--r); justify-content: center; }
  .nav-list > li:last-child { border-bottom: 0; }
  .nav-menu {
    position: static; width: auto; padding: 0 0 var(--sp-3);
    border: 0; box-shadow: none; border-radius: 0; background: transparent;
  }
  .nav-menu-btn[aria-expanded="true"] + .nav-menu { animation: none; }
  .nav-menu ul { grid-template-columns: 1fr; }
  .nav-menu small { display: none; }
  .nav-menu a { align-items: center; padding: var(--sp-2); }
  .nav-menu a > .icon { width: 32px; height: 32px; padding: 7px; }
  body.nav-open { overflow: hidden; }
}
@media (min-width: 640px) and (max-width: 1099.98px) {
  .nav-menu ul { grid-template-columns: 1fr 1fr; }
}

/* Icone */
.icon { width: 1.25rem; height: 1.25rem; flex: none; stroke: currentColor; fill: none; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }

/* 6. Footer -------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  background: var(--ink-900);
  color: var(--on-ink-2);
  font-size: var(--fs-sm);
}
.site-footer a { color: var(--on-ink); text-decoration: none; }
.site-footer a:hover { color: var(--on-ink-strong); text-decoration: underline; }
.site-footer :focus-visible { outline-color: var(--on-ink-accent); }
.footer-top {
  display: grid; gap: var(--sp-6);
  padding-block: var(--sp-12) var(--sp-8);
  border-bottom: 1px solid var(--on-ink-line);
}
.footer-about p { max-width: 62ch; margin-top: var(--sp-3); line-height: 1.6; }
.brand-footer, .brand-footer:hover { color: var(--on-ink); text-decoration: none; }
.brand-footer img { width: 28px; height: 28px; box-shadow: 0 0 0 1px var(--on-ink-line); border-radius: 7px; }
.footer-grid {
  display: grid; gap: var(--sp-8) var(--sp-6);
  grid-template-columns: 1fr;
  padding-block: var(--sp-8) var(--sp-10);
}
@media (min-width: 480px)  { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px)  { .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .footer-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.footer-title {
  font-size: var(--fs-sm); font-weight: 650; letter-spacing: 0;
  color: var(--on-ink); margin-bottom: var(--sp-3);
}
.footer-col ul { list-style: none; display: grid; gap: .55rem; }
.site-footer .link-button { color: var(--on-ink); text-decoration: none; }
.site-footer .link-button:hover { color: var(--on-ink-strong); text-decoration: underline; }
.footer-bottom { background: var(--ink-950); }
.footer-bottom-inner {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6);
  justify-content: space-between; align-items: baseline;
  padding-block: var(--sp-5);
  font-size: var(--fs-xs);
}
.footer-legal-links { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
.footer-note { flex-basis: 100%; color: var(--on-ink-2); }

/* 7. Hero e testate ------------------------------------------------------- */
.breadcrumbs {
  background: var(--ink-900);
  color: var(--on-ink-2);
  font-size: var(--fs-xs);
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; padding-top: var(--sp-4); }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before {
  content: ""; width: 6px; height: 6px; margin: 0 .6rem;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .7;
}
.breadcrumbs a { color: var(--on-ink-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--on-ink); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--on-ink); }
.breadcrumbs :focus-visible, .tool-hero :focus-visible, .ip-hero :focus-visible { outline-color: var(--on-ink-accent); }

.tool-hero, .page-hero {
  background-color: var(--ink-900);
  background-image: radial-gradient(rgb(255 255 255 / .07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  color: var(--on-ink);
  padding-block: var(--sp-6) var(--sp-10);
}
.breadcrumbs + .tool-hero, .breadcrumbs + .page-hero { padding-top: var(--sp-5); }
.tool-hero h1, .page-hero h1 { max-width: 30ch; }
.tool-hero .lead, .page-hero .lead {
  margin-top: var(--sp-3); max-width: 68ch;
  color: var(--on-ink-2); font-size: var(--fs-md); line-height: 1.55;
}
.tool-hero .lead a, .page-hero .lead a { color: var(--on-ink); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm); font-weight: 550; color: var(--text-2);
}
.tool-hero .eyebrow, .page-hero .eyebrow { color: var(--on-ink-accent); }
@media (min-width: 768px) {
  .tool-hero, .page-hero { padding-block: var(--sp-8) var(--sp-12); }
  .tool-hero h1, .page-hero h1 { font-size: var(--fs-3xl); }
}

.lead { font-size: var(--fs-md); color: var(--text-2); }

/* Area dello strumento: fondo neutro su cui stanno pannello e risultati */
.tool-area {
  background: var(--surface-2);
  padding-block: var(--sp-8) var(--sp-12);
  border-bottom: 1px solid var(--line);
}
.tool-area .container > * + * { margin-top: var(--sp-6); }

.related { padding-block: var(--sp-12); background: var(--surface-2); border-top: 1px solid var(--line); }
.related h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-5); }
.related + .related { background: var(--bg); }
@media (min-width: 1024px) { .tool-grid.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 8. Card strumenti ------------------------------------------------------- */
.tool-grid {
  list-style: none;
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}
.tool-grid > li { display: flex; }
.tool-card {
  flex: 1;
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--text); text-decoration: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.tool-card:hover {
  color: var(--text);
  border-color: var(--teal-700);
  box-shadow: var(--shadow-1);
}
@media (prefers-reduced-motion: no-preference) { .tool-card:hover { transform: translateY(-1px); } }
@media (prefers-color-scheme: dark) { .tool-card:hover { border-color: var(--link); } }
.tool-card-icon {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r);
  background: var(--teal-50); color: var(--teal-700);
}
@media (prefers-color-scheme: dark) { .tool-card-icon { color: var(--link); } }
.tool-card-body { display: grid; gap: 2px; min-width: 0; }
.tool-card-body strong { font-size: var(--fs-base); font-weight: 620; line-height: 1.3; }
.tool-card-body span { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.tool-card:hover .tool-card-body strong { color: var(--link); }

.tool-category { padding-block: var(--sp-10); }
.tool-category:nth-of-type(even) { background: var(--surface-2); }
.tool-category h2 {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-lg); margin-bottom: var(--sp-5);
}
.tool-category h2 .count { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
.tool-category:nth-of-type(even) .tool-card { background: var(--surface); }

/* 9. Articolo editoriale -------------------------------------------------- */
.article { padding-block: var(--sp-12) var(--sp-16); background: var(--bg); }
.article-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-10); }
.home-tools > .container > .lead { margin-bottom: var(--sp-8); max-width: 72ch; }
@media (min-width: 1024px) {
  .article-inner.has-toc { grid-template-columns: minmax(0, 1fr) 280px; gap: var(--sp-16); align-items: start; }
  .article-toc { position: sticky; top: calc(var(--header-h) + var(--sp-6)); grid-column: 2; grid-row: 1; }
  .article-body { grid-column: 1; grid-row: 1; }
}
.article-body { max-width: 72ch; font-size: 1.0625rem; line-height: var(--lh-prose); }
.article-body > section + section { margin-top: var(--sp-12); }
.article-body h2 { font-size: var(--fs-xl); margin-bottom: var(--sp-4); }
.article-body h3 { font-size: var(--fs-lg); margin: var(--sp-8) 0 var(--sp-3); }
.article-body p, .article-body ul, .article-body ol, .article-body table, .article-body pre,
.article-body .table-wrap, .article-body blockquote, .article-body .notice { margin-bottom: var(--sp-4); }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li + li { margin-top: .35rem; }
.article-body li::marker { color: var(--text-3); }
.article-body strong { font-weight: 640; }
.article-body :not(pre) > code {
  padding: .1em .35em; border-radius: var(--r-sm);
  background: var(--surface-3); font-size: .88em; overflow-wrap: anywhere;
}
.article-body pre {
  padding: var(--sp-4); border-radius: var(--r);
  background: var(--term-bg); color: var(--term-text);
  overflow-x: auto; font-size: var(--fs-sm); line-height: 1.6;
}
.article-body blockquote {
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
/* Tabelle semplici nei testi: stesso aspetto di .data-table; su schermi stretti scorrono nel proprio riquadro */
.article-body table, .prose table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  font-size: var(--fs-sm); line-height: 1.45;
}
.article-body th, .article-body td, .prose th, .prose td { padding: .75rem 1rem; text-align: left; vertical-align: top; }
.article-body thead th, .prose thead th { background: var(--ink-900); color: var(--on-ink); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.article-body tbody tr:nth-child(even), .prose tbody tr:nth-child(even) { background: var(--surface-2); }
.article-body tbody td, .prose tbody td { border-top: 1px solid var(--line); }
.article-body tbody tr:first-child td, .prose tbody tr:first-child td { border-top: 0; }
.article-body td:first-child, .prose td:first-child { white-space: nowrap; font-weight: 550; }
/* Tabelle avvolte in .table-wrap (wrap_tables()): il bordo e lo scorrimento sono del contenitore. */
.article-body .table-wrap > table, .prose .table-wrap > table { border: 0; border-radius: 0; overflow: visible; }
.prose .table-wrap { margin-bottom: var(--sp-4); }
@media (max-width: 767.98px) {
  .article-body table:not(.table-wrap > table), .prose table:not(.table-wrap > table) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .article-body td, .prose td { min-width: 16ch; }
  .article-body td:first-child, .prose td:first-child { min-width: 12ch; white-space: normal; }
  /* IP, URL e valori dentro le celle restano interi: la tabella scorre nel suo riquadro. */
  .article-body td code, .prose td code { white-space: nowrap; overflow-wrap: normal; }
}
@media (max-width: 639.98px) {
  .article-toc { padding: var(--sp-4); }
  .article-toc a { padding-block: .25rem; }
}

/* Passaggi numerati (HowTo) */
.steps { list-style: none; padding: 0 !important; counter-reset: step; display: grid; gap: var(--sp-3); }
.steps li {
  counter-increment: step; position: relative;
  margin: 0 !important; padding: var(--sp-1) 0 0 3rem; min-height: 2.25rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--ink-900); color: var(--on-ink);
  font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums;
}

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) 0; cursor: pointer; list-style: none;
  font-weight: 600; font-size: var(--fs-md); line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: translateY(-3px) rotate(45deg);
  transition: transform var(--t) var(--ease);
}
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq summary:hover { color: var(--link); }
.faq-answer { padding-bottom: var(--sp-5); color: var(--text); }
.faq-answer > :last-child { margin-bottom: 0; }

.sources ul { font-size: var(--fs-sm); }
.updated { margin-top: var(--sp-10); font-size: var(--fs-sm); color: var(--text-3); }

/* Indice laterale */
.article-toc {
  padding: var(--sp-5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.article-toc h2 { font-size: var(--fs-sm); font-weight: 650; letter-spacing: 0; margin-bottom: var(--sp-3); }
.article-toc ol { list-style: none; display: grid; gap: 2px; margin-inline: -.6rem; }
.article-toc a {
  display: block; padding: .35rem .6rem; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; line-height: 1.4;
}
.article-toc a:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 1023.98px) { .article-toc { order: -1; } .article-toc ol { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }

/* Testo lungo per pagine statiche (privacy, chi siamo...) */
.prose { max-width: 72ch; font-size: 1.0625rem; line-height: var(--lh-prose); }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { margin-top: var(--sp-10); font-size: var(--fs-xl); }
.prose h3 { margin-top: var(--sp-6); font-size: var(--fs-lg); }
.prose ul, .prose ol { padding-left: 1.4rem; }

/* 10. Componenti degli strumenti ----------------------------------------- */

/* Pannello e form */
.tool-panel {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
@media (min-width: 768px) { .tool-panel { padding: var(--sp-6); } }
.tool-form { display: grid; gap: var(--sp-4); }
.tool-form-main { display: grid; gap: var(--sp-2); }
.input-group { display: flex; flex-direction: column; gap: var(--sp-2); }
@media (min-width: 640px) {
  .input-group { flex-direction: row; align-items: stretch; }
  .input-group > .input, .input-group > .input-wrap { flex: 1; min-width: 0; }
  .input-group > .select { flex: 0 0 auto; width: auto; }
}
.tool-options { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6); align-items: flex-end; }

.field { display: grid; gap: var(--sp-2); }
.field-inline { display: flex; align-items: center; gap: var(--sp-2); }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.label-lg { font-size: var(--fs-base); }
.hint { font-size: var(--fs-sm); color: var(--text-2); }
.hint code { font-size: .92em; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: .55rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: var(--text);
  font-size: var(--fs-base);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}
.input-lg { min-height: 52px; font-size: var(--fs-md); padding-inline: 1rem; }
.input-mono, .input-lg.input-mono { font-family: var(--mono); font-size: var(--fs-base); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356686d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px;
}
.input-lg + .button, .input-group .button { min-height: 52px; }
.input-group .select { min-height: 52px; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 22%, transparent); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.field-error {
  display: flex; align-items: flex-start; gap: .4rem;
  font-size: var(--fs-sm); font-weight: 550; color: var(--err);
}
.field-error .icon { width: 1.1rem; height: 1.1rem; margin-top: 1px; }

.check { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--teal-700); cursor: pointer; }

/* Esempi rapidi sotto il campo */
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  min-height: 30px; padding: .15rem .7rem;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text);
  font-family: var(--mono); font-size: var(--fs-xs); text-decoration: none;
}
.chip:hover { border-color: var(--teal-700); color: var(--text); }

/* Pulsanti */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.15rem;
  border: 1px solid transparent; border-radius: var(--r);
  background: var(--accent); color: var(--accent-on);
  font-size: var(--fs-base); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), transform 80ms ease;
}
.button:hover { background: var(--accent-hover); color: var(--accent-on); text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.button-secondary { background: var(--ink-900); color: var(--on-ink); }
.button-secondary:hover { background: var(--ink-700); color: var(--on-ink); }
@media (prefers-color-scheme: dark) {
  .button-secondary { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
  .button-secondary:hover { background: var(--line); color: var(--text); }
}
.button-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.button-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-3); }
.button-sm { min-height: 34px; padding: .3rem .75rem; font-size: var(--fs-sm); gap: .35rem; }
.button-lg { min-height: 52px; padding-inline: 1.5rem; font-size: var(--fs-md); }
.button-block { width: 100%; }
.button .icon { width: 1.1em; height: 1.1em; }
/* Pulsanti su fondo petrolio */
.on-ink .button-ghost, .tool-hero .button-ghost, .ip-hero .button-ghost { color: var(--on-ink); border-color: var(--on-ink-line); }
.on-ink .button-ghost:hover, .tool-hero .button-ghost:hover, .ip-hero .button-ghost:hover { background: var(--ink-800); color: var(--on-ink-strong); border-color: var(--ink-600); }

.link-button {
  display: inline; padding: 0; border: 0; background: none;
  color: var(--link); font: inherit; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px;
}
.link-button:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* Caricamento */
.spinner {
  display: inline-block; width: 1.1em; height: 1.1em; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -.15em;
}
@keyframes spin { to { transform: rotate(360deg); } }
.button.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.button.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 1.1rem; height: 1.1rem; margin: -.55rem 0 0 -.55rem;
  border: 2px solid var(--accent-on); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.button-ghost.is-loading::after { border-color: var(--text); border-right-color: transparent; }
.loading {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-2); font-size: var(--fs-sm);
}
.loading .spinner { color: var(--teal-700); width: 1.25rem; height: 1.25rem; }
.skeleton {
  display: block; height: .9rem; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton + .skeleton { margin-top: .6rem; }
.skeleton-lg { height: 1.6rem; width: 40%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .button.is-loading::after { animation-duration: 1.6s; }
  .skeleton { animation: none; }
}

/* Card risultato */
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.result-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.result-title { font-size: var(--fs-md); font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.result-title .mono { font-weight: 550; overflow-wrap: anywhere; }
.result-meta { font-size: var(--fs-sm); color: var(--text-2); }
.result-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.result-summary {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.result-summary p { font-size: var(--fs-base); }
.result-summary .icon { width: 1.5rem; height: 1.5rem; margin-top: 1px; }
.result-summary.is-ok { background: var(--ok-bg); } .result-summary.is-ok .icon { color: var(--ok); }
.result-summary.is-warn { background: var(--warn-bg); } .result-summary.is-warn .icon { color: var(--warn); }
.result-summary.is-error { background: var(--err-bg); } .result-summary.is-error .icon { color: var(--err); }
.result-body { padding: var(--sp-5); }
.result-body > * + * { margin-top: var(--sp-5); }
.result-body-flush { padding: 0; }
.result-body-flush > .table-wrap { border: 0; border-radius: 0; }
.result-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-2); }
.result-section-title { font-size: var(--fs-base); font-weight: 650; margin-bottom: var(--sp-3); }

/* Tabella chiave/valore */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); font-size: var(--fs-sm); }
.kv > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); font-weight: 550; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
@media (min-width: 560px) {
  .kv > div { grid-template-columns: minmax(140px, 32%) minmax(0, 1fr); gap: var(--sp-4); align-items: baseline; }
}
@media (min-width: 900px) { .kv-2col { grid-template-columns: 1fr 1fr; column-gap: var(--sp-10); }
  .kv-2col > div:nth-last-child(2):nth-child(odd) { border-bottom: 0; } }

/* Tabella dati */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.table-wrap:focus-visible { outline-offset: 2px; }
.data-table { min-width: 560px; font-size: var(--fs-sm); line-height: 1.45; }
.data-table caption { caption-side: top; text-align: left; padding: var(--sp-3) var(--sp-4); font-weight: 600; color: var(--text-2); }
.data-table th, .data-table td { padding: .75rem 1rem; text-align: left; vertical-align: top; }
.data-table thead th {
  background: var(--ink-900); color: var(--on-ink);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; position: sticky; top: 0;
}
.data-table tbody tr:nth-child(even) { background: var(--surface-2); }
.data-table tbody tr:hover { background: var(--teal-50); }
.data-table tbody td { border-top: 1px solid var(--line); }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table .num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .mono, .data-table code { font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; }
.data-table .nowrap, .data-table td:first-child { white-space: nowrap; }
.data-table .wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; min-width: 16ch; }
.data-table-compact th, .data-table-compact td { padding: .5rem .75rem; }
.result .table-wrap { border-radius: var(--r); }

/* Badge di stato */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .6rem; min-height: 24px;
  border: 1px solid var(--neutral-line); border-radius: var(--r-pill);
  background: var(--neutral-bg); color: var(--neutral);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.3; white-space: nowrap;
}
.badge .icon { width: .95rem; height: .95rem; stroke-width: 2.25; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge-error { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-line); }
.badge-lg { font-size: var(--fs-sm); padding: .3rem .8rem; }

/* Avvisi */
.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border: 1px solid var(--info-line); border-radius: var(--r-lg);
  background: var(--info-bg); color: var(--text);
  font-size: var(--fs-sm); line-height: 1.55;
}
.notice > .icon { width: 1.3rem; height: 1.3rem; color: var(--info); margin-top: 1px; }
.notice-body > * + * { margin-top: var(--sp-2); }
.notice-title { font-weight: 650; font-size: var(--fs-base); }
.notice-info { border-color: var(--info-line); background: var(--info-bg); }
.notice-warning { border-color: var(--warn-line); background: var(--warn-bg); }
.notice-warning > .icon { color: var(--warn); }
.notice-error { border-color: var(--err-line); background: var(--err-bg); }
.notice-error > .icon { color: var(--err); }
.notice-success { border-color: var(--ok-line); background: var(--ok-bg); }
.notice-success > .icon { color: var(--ok); }

/* Blocco codice con copia */
.code-block {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--ink-800);
}
.code-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: .5rem .5rem .5rem 1rem;
  border-bottom: 1px solid rgb(255 255 255 / .08);
  font-size: var(--fs-xs); color: var(--term-dim);
}
.code-block pre {
  margin: 0; padding: var(--sp-4);
  overflow-x: auto;
  font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.code-block .copy-btn, .terminal .copy-btn {
  background: rgb(255 255 255 / .06); color: var(--term-text); border-color: rgb(255 255 255 / .16);
}
.code-block .copy-btn:hover, .terminal .copy-btn:hover { background: rgb(255 255 255 / .12); color: var(--on-ink-strong); }
.code-block :focus-visible, .terminal :focus-visible { outline-color: var(--on-ink-accent); }

/* Pulsante copia generico */
.copy-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 32px; padding: .25rem .65rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.copy-btn:hover { background: var(--surface-2); }
.copy-btn .icon { width: 1rem; height: 1rem; }
.copy-btn .icon-done { display: none; }
.copy-btn.is-copied .icon-copy { display: none; }
.copy-btn.is-copied .icon-done { display: block; color: var(--ok); }
.code-block .copy-btn.is-copied .icon-done, .terminal .copy-btn.is-copied .icon-done { color: var(--term-ok); }
.copy-inline { min-height: 28px; padding: .15rem .5rem; }

/* Terminale (ping, traceroute) */
.terminal {
  border-radius: var(--r-lg);
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--ink-800);
  overflow: hidden;
}
.terminal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: .5rem .5rem .5rem 1rem;
  border-bottom: 1px solid rgb(255 255 255 / .08);
  font-size: var(--fs-xs); color: var(--term-dim);
}
.terminal-status { display: inline-flex; align-items: center; gap: .5rem; }
.terminal-status .spinner { width: .9rem; height: .9rem; color: var(--term-ok); }
.terminal-output {
  margin: 0; padding: var(--sp-4);
  height: 360px; overflow: auto;
  font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.65;
  white-space: pre; tab-size: 4;
}
.terminal-output.is-auto { height: auto; max-height: 480px; min-height: 160px; }
.terminal .t-dim { color: var(--term-dim); }
.terminal .t-ok { color: var(--term-ok); }
.terminal .t-err { color: var(--term-err); }
.terminal .t-strong { color: var(--on-ink-strong); font-weight: 600; }
.terminal-output:focus-visible { outline: 2px solid var(--on-ink-accent); outline-offset: -2px; }
@media (max-width: 640px) { .terminal-output { height: 300px; font-size: var(--fs-xs); } }

/* Barra di avanzamento */
.progress { display: grid; gap: var(--sp-2); }
.progress-head { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.progress-head strong { color: var(--text); font-variant-numeric: tabular-nums; }
.progress-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress-bar > span {
  display: block; height: 100%; width: var(--value, 0%);
  background: var(--teal-700); border-radius: inherit;
  transition: width 300ms var(--ease);
}
.progress-bar.is-ok > span { background: var(--ok); }
.progress-bar.is-warn > span { background: var(--warn); }
.progress-bar.is-error > span { background: var(--err); }
.progress-bar.is-indeterminate > span { width: 35%; animation: indeterminate 1.2s var(--ease) infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-color-scheme: dark) { .progress-bar > span { background: var(--link); } }
@media (prefers-color-scheme: dark) {
  .data-table thead th, .prop-head, .article-body thead th, .prose thead th { background: var(--ink-700); }
  .tool-hero, .page-hero, .ip-hero { border-bottom: 1px solid var(--line); }
  .site-footer { background: var(--ink-950); }
  .footer-bottom { background: rgb(0 0 0 / .35); }
  .progress-bar.is-warn > span { background: var(--warn); }
}

/* Mappa (Leaflet): altezza fissa contro lo spostamento del layout */
.map {
  position: relative;
  height: 340px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-3);
  overflow: hidden;
  isolation: isolate;
}
.map-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
  padding: var(--sp-4); color: var(--text-2); font-size: var(--fs-sm);
}
.map-caption { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-2); }
@media (max-width: 640px) { .map { height: 260px; } }
.leaflet-container { font-family: var(--font); }

/* Griglia di valori sintetici */
.stats { display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); } }
.stat { background: var(--surface); padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column-reverse; gap: var(--sp-1); }
.stat-value { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 400px) { .stat-value { font-size: var(--fs-lg); } }
.stat-value small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); letter-spacing: 0; margin-left: 2px; }
.stat-label { font-size: var(--fs-sm); color: var(--text-2); }
.stat.is-ok .stat-value { color: var(--ok); }
.stat.is-warn .stat-value { color: var(--warn); }
.stat.is-error .stat-value { color: var(--err); }

/* Propagazione DNS */
.prop { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.prop-head, .prop-row {
  display: grid; align-items: center; gap: var(--sp-2) var(--sp-4);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .75rem 1rem;
}
.prop-head {
  background: var(--ink-900); color: var(--on-ink);
  font-size: var(--fs-xs); font-weight: 600;
  display: none;
}
.prop-list { list-style: none; }
.prop-row { border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.prop-list > .prop-row:first-child { border-top: 0; }
.prop-row:nth-child(even) { background: var(--surface-2); }
.prop-loc { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.prop-loc strong { font-weight: 600; display: block; line-height: 1.3; }
.prop-loc small { display: block; color: var(--text-2); font-size: var(--fs-xs); line-height: 1.35; }
.prop-server { grid-column: 1 / -1; color: var(--text-2); font-family: var(--mono); font-size: var(--fs-xs); }
.prop-value { grid-column: 1 / -1; font-family: var(--mono); font-size: var(--fs-xs); color: var(--text); overflow-wrap: anywhere; }
.prop-value span + span::before { content: ""; display: block; }
.prop-status { grid-column: 2; grid-row: 1; justify-self: end; }
.prop-head > span:last-child { text-align: right; }
.prop-row.is-pending .prop-value { color: var(--text-3); }
@media (min-width: 860px) {
  .prop-head { display: grid; }
  .prop-head, .prop-row { grid-template-columns: minmax(200px, 1.3fr) minmax(140px, 1fr) minmax(0, 1.6fr) 120px; }
  .prop-value, .prop-server { grid-column: auto; font-size: var(--fs-sm); }
  .prop-status { grid-column: auto; grid-row: auto; }
}
.flag {
  flex: none; display: inline-grid; place-items: center;
  width: 30px; height: 22px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
img.flag { object-fit: cover; padding: 0; }

/* Schede */
.tabs-list {
  display: flex; gap: var(--sp-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin;
}
.tab {
  flex: none;
  min-height: 44px; padding: .5rem 1rem;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--teal-700); border-bottom-color: var(--teal-700); }
@media (prefers-color-scheme: dark) { .tab[aria-selected="true"] { color: var(--link); border-bottom-color: var(--link); } }
.tab .badge { margin-left: .35rem; }
.tab-panel { padding-top: var(--sp-5); }
.tab-panel:focus-visible { outline-offset: 4px; }

/* Stato vuoto */
.empty {
  display: grid; justify-items: center; text-align: center; gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-5);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text-2);
}
.empty > .icon { width: 2.5rem; height: 2.5rem; padding: .5rem; border-radius: 50%; background: var(--teal-50); color: var(--teal-700); box-sizing: content-box; }
.empty h3 { color: var(--text); font-size: var(--fs-md); }
.empty p { max-width: 52ch; font-size: var(--fs-sm); }

/* Testo monospazio e valori */
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.value-ok { color: var(--ok); } .value-warn { color: var(--warn); } .value-error { color: var(--err); }

/* 11. Home --------------------------------------------------------------- */
.ip-hero {
  background-color: var(--ink-900);
  background-image: radial-gradient(rgb(255 255 255 / .07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  color: var(--on-ink);
  padding-block: var(--sp-8) var(--sp-10);
}
.ip-hero-grid { display: grid; gap: var(--sp-8); align-items: start; }
@media (min-width: 1024px) {
  .ip-hero { padding-block: var(--sp-12) var(--sp-16); }
  .ip-hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--sp-12); align-items: center; }
}
.ip-hero h1 { font-size: var(--fs-xl); font-weight: 650; color: var(--on-ink); letter-spacing: -.02em; }
@media (min-width: 1024px) { .ip-hero h1 { font-size: var(--fs-2xl); } }
.ip-hero-sub { margin-top: var(--sp-2); color: var(--on-ink-2); font-size: var(--fs-md, 1.0625rem); }
.ip-main { margin-top: var(--sp-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); }
.ip-value {
  font-family: var(--mono); font-feature-settings: "zero" 1;
  font-size: clamp(2rem, 7.4vw, 3.75rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.05;
  color: var(--on-ink-strong); overflow-wrap: anywhere;
}
.ip-value.is-v6 { font-size: clamp(1.25rem, 4.2vw, 2.25rem); letter-spacing: -.02em; }
.ip-hero .copy-btn {
  min-height: 40px; padding-inline: .9rem; font-size: var(--fs-sm);
  background: var(--accent); color: var(--accent-on); border-color: transparent;
}
.ip-hero .copy-btn:hover { background: var(--accent-hover); }
.ip-hero .copy-btn.is-copied .icon-done { color: var(--accent-on); }
.ip-versions { margin-top: var(--sp-5); display: grid; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--on-ink-2); }
.ip-versions div { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; }
.ip-versions dt { min-width: 3.5rem; }
.ip-versions dd { margin: 0; font-family: var(--mono); color: var(--on-ink); overflow-wrap: anywhere; }
.ip-lookup { margin-top: var(--sp-8); }
@media (min-width: 1024px) { .ip-lookup { max-width: 560px; } }
.ip-lookup .label { color: var(--on-ink); }
.ip-lookup .input { background: var(--ink-950); border-color: var(--ink-600); color: var(--on-ink); }
.ip-lookup .input::placeholder { color: var(--on-ink-2); }
.ip-lookup .input:focus { border-color: var(--on-ink-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--on-ink-accent) 25%, transparent); }

.ip-details {
  background: var(--ink-800);
  border: 1px solid var(--on-ink-line);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
}
.ip-details h2 { font-size: var(--fs-base); font-weight: 650; color: var(--on-ink); margin-bottom: var(--sp-2); display: flex; align-items: center; gap: var(--sp-2); }
.ip-details .kv > div { border-bottom-color: var(--on-ink-line); }
.ip-details .kv dt { color: var(--on-ink-2); }
.ip-details .kv dd { color: var(--on-ink); }
.ip-details .hint { color: var(--on-ink-2); margin-top: var(--sp-3); font-size: var(--fs-xs); }
.ip-details a { color: var(--on-ink-accent); }

.home-tools { padding-block: var(--sp-12) var(--sp-16); background: var(--surface-2); }
.home-tools-head h2 { font-size: var(--fs-lg); }
.home-tools-head { margin-bottom: var(--sp-8); display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6); align-items: baseline; justify-content: space-between; }
.home-tools-head p { color: var(--text-2); max-width: 64ch; }
.home-cat + .home-cat { margin-top: var(--sp-10); }
.home-cat h3 {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-md); margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line);
}
.home-cat h3 a { margin-left: auto; font-size: var(--fs-sm); font-weight: 550; }

/* 12. Pagina di errore --------------------------------------------------- */
.error-page { padding-block: var(--sp-16) var(--sp-20); background: var(--surface-2); flex: 1; }
.error-grid { display: grid; gap: var(--sp-10); align-items: start; }
@media (min-width: 900px) { .error-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-16); } }
.error-code {
  font-family: var(--mono); font-size: var(--fs-sm); font-weight: 600;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .7rem; border-radius: var(--r-pill);
  background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line);
  margin-bottom: var(--sp-4);
}
.error-page h1 { font-size: var(--fs-2xl); }
.error-page .lead { margin-top: var(--sp-3); max-width: 52ch; }
.error-page .button-row { margin-top: var(--sp-6); }
.error-page h2 { font-size: var(--fs-base); margin-bottom: var(--sp-3); }
.error-links { list-style: none; display: grid; gap: var(--sp-2); }
.error-links .tool-card { padding: var(--sp-3) var(--sp-4); }

/* 13. Banner cookie e pannello preferenze (logica in consent.js, docs/CONSENT.md) */
[data-consent-banner][hidden], [data-consent-prefs][hidden] { display: none !important; }
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-consent);
  padding: 0 var(--sp-2) var(--sp-2);
  pointer-events: none;
}
.consent-box {
  pointer-events: auto;
  position: relative;
  display: grid; gap: var(--sp-2) var(--sp-8);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-width: 1180px; max-height: 40vh; margin-inline: auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: 0 -4px 32px -8px rgb(11 43 51 / .35), var(--shadow-2);
  font-size: var(--fs-sm);
}
.consent-box:focus { outline: none; }
.consent-box:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.consent-title { font-size: var(--fs-base); font-weight: 650; letter-spacing: -.01em; padding-right: 2.5rem; }
.consent-text { color: var(--text-2); line-height: 1.5; max-width: 80ch; overflow-y: auto; font-size: var(--fs-sm); }
.consent-text a { color: var(--link); }
.consent-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
/* Tre pulsanti identici: stessa classe, stessi colori e dimensioni (Garante, linee guida 2021) */
.consent-btn {
  min-height: 44px; padding: .5rem .75rem;
  border: 1px solid var(--ink-900); border-radius: var(--r);
  background: var(--ink-900); color: var(--on-ink);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.2;
  transition: background-color var(--t) var(--ease);
}
.consent-btn:hover { background: var(--ink-700); border-color: var(--ink-700); }
@media (prefers-color-scheme: dark) {
  .consent-btn { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
  .consent-btn:hover { background: var(--line); }
}
.consent-close {
  position: absolute; top: var(--sp-2); right: var(--sp-2);
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: var(--text-2);
}
.consent-close:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
@media (min-width: 900px) {
  .consent { padding: 0 var(--sp-4) var(--sp-4); }
  .consent-box {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    padding: var(--sp-5) var(--sp-6);
    align-items: center;
  }
  .consent-box .consent-title { grid-column: 1; }
  .consent-box .consent-text { grid-column: 1; grid-row: 2; }
  .consent-box .consent-actions { grid-column: 2; grid-row: 1 / span 2; grid-template-columns: repeat(3, auto); margin-right: 2.5rem; }
  .consent-btn { padding-inline: 1.1rem; }
}

/* Pannello preferenze (modale) */
.consent-prefs {
  position: fixed; inset: 0; z-index: calc(var(--z-consent) + 1);
  display: grid; place-items: center;
  padding: var(--sp-3);
  background: rgb(6 26 32 / .6);
}
.consent-panel {
  position: relative;
  width: min(620px, 100%); max-height: 90vh; overflow: auto;
  padding: var(--sp-6);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm);
}
.consent-panel:focus { outline: none; }
.consent-panel-head { position: relative; margin-bottom: var(--sp-3); }
.consent-panel-head .consent-title { font-size: var(--fs-lg); }
.consent-panel-head .consent-close { top: -6px; right: -6px; }
.consent-panel .consent-text { overflow: visible; }
.consent-cats { border: 0; padding: 0; margin: var(--sp-5) 0; display: grid; gap: var(--sp-3); }
.consent-cat { padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.consent-cat-head { display: flex; align-items: center; gap: var(--sp-3); }
.consent-cat-head input { width: 20px; height: 20px; margin: 0; accent-color: var(--teal-700); flex: none; }
.consent-cat-head label { font-weight: 650; font-size: var(--fs-base); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.consent-badge {
  display: inline-block; padding: .1rem .55rem; border-radius: var(--r-pill);
  background: var(--neutral-bg); border: 1px solid var(--neutral-line); color: var(--neutral);
  font-size: var(--fs-xs); font-weight: 600;
}
.consent-cat-desc { margin-top: var(--sp-2); padding-left: calc(20px + var(--sp-3)); color: var(--text-2); line-height: 1.5; }
.consent-panel .consent-actions { grid-template-columns: 1fr; }
@media (min-width: 560px) { .consent-panel .consent-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
html.consent-modal-open, html.consent-modal-open body { overflow: hidden; }
@media (max-width: 380px) {
  .consent-btn { font-size: var(--fs-xs); padding-inline: .4rem; }
}

/* 14. Utilità ------------------------------------------------------------ */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* Guida di stile (solo sviluppo) */
.sg-section { padding-block: var(--sp-10); border-top: 1px solid var(--line); }
.sg-section:nth-of-type(even) { background: var(--surface-2); }
.sg-section > .container > h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.sg-section > .container > p.muted { margin-bottom: var(--sp-5); font-size: var(--fs-sm); }
.sg-swatches { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); list-style: none; }
.sg-swatch { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: var(--fs-xs); background: var(--surface); }
.sg-swatch span { display: block; height: 56px; }
.sg-swatch code { display: block; padding: .5rem .6rem; }

/* 15. Stampa ------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .consent, .related, .nav-toggle, .copy-btn, .article-toc, .tool-form { display: none !important; }
  .tool-hero, .page-hero, .ip-hero, .breadcrumbs { background: none !important; color: #000 !important; }
  .tool-hero .lead, .breadcrumbs a { color: #333 !important; }
  .terminal, .code-block { background: #fff !important; color: #000 !important; border-color: #999 !important; }
  .terminal-output { height: auto !important; white-space: pre-wrap; }
  a { color: #000; }
}

/* Rifiniture dalla revisione grafica finale (5/10/2026) */
/* CIDR e altri valori monospazio nelle stat: su schermi stretti la tile occupa tutta la riga, il valore non si spezza. */
@media (max-width: 400px) { .stats .stat:has(.stat-value.mono) { grid-column: 1 / -1; } }
/* Comandi lunghi nelle tabelle: possono andare a capo (gli IP e gli URL brevi restano interi). */
@media (max-width: 767.98px) { .prose td code.is-long, .article-body td code.is-long { white-space: normal; overflow-wrap: anywhere; } }
/* IPv6 in home: dimensione proporzionata all'H1 anche su mobile. */
.ip-value.is-v6 { font-size: clamp(1.5rem, 4.2vw, 2.5rem); }
/* Paragrafo subito dopo una tabella: respiro dal bordo. */
.table-wrap + p { margin-top: var(--sp-3); }
.prose td.num, .article-body td.num, .prose th.num, .article-body th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Rifiniture dalla revisione grafica delle sezioni nuove (notte 5-6/10/2026) */
.data-table td.mono { overflow-wrap: normal; word-break: normal; min-width: 9ch; }
.chip[aria-current="true"] { background: var(--ink-900); color: var(--on-ink); border-color: var(--ink-900); font-weight: 600; }
@media (max-width: 767px) { .result-body .chip { min-height: 44px; display: inline-flex; align-items: center; } }
/* Tabelle molto lunghe: altezza massima, così l'intestazione resta visibile e la barra orizzontale è a portata. */
.table-wrap.is-long { max-height: 70vh; overflow: auto; }
@media (max-width: 599px) {
  [aria-labelledby="vpn-verdict-title"] .data-table { min-width: 0; }
  .tool-area .data-table-compact { min-width: 0; }
  .tool-area .data-table-compact td.mono { white-space: nowrap; }
}
.hint > .icon { display: inline-block; vertical-align: -.15em; margin-right: .3rem; }
.tool-options:has(.hint) { align-items: flex-start; }
.article-body .table-wrap > table, .prose .table-wrap > table { margin-bottom: 0; }
.result-body ul:not([class]) { padding-left: 1.25rem; }
.code-block pre { white-space: pre; overflow-wrap: normal; }
.data-table-compact td { vertical-align: middle; }
.stat-value small { margin-left: .25em; }
.related .tool-grid + p { margin-top: var(--sp-5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .data-table tbody tr:nth-child(even) { background: #16303a; }
}
