/* Scan Codice: mobile-first stylesheet. */
:root {
  --ink: #14213d;
  --ink-2: #33415c;
  --muted: #5b6577;
  --line: #dfe3ea;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --accent: #d63a2f;      /* laser red, used sparingly */
  --link: #0f5ea8;
  --link-hover: #0a4579;
  --ok: #17694a;
  --ok-bg: #e9f6ef;
  --warn: #8a4b00;
  --warn-bg: #fff4e0;
  --note-bg: #eef4fb;
  --radius: 10px;
  --wrap: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; font: 17px/1.65 var(--font); color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 2px; border-radius: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.1rem; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #ffb703; color: #000; padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }

/* ---------- header ---------- */
.site-header { background: var(--ink); color: #fff; position: relative; z-index: 5; }
.header-row { display: flex; align-items: center; gap: .75rem; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; font-size: 1.22rem; letter-spacing: -.01em; white-space: nowrap; }
.logo:hover { color: inherit; }
.logo b { font-weight: 800; }
.logo-mark { width: 32px; height: 32px; color: #24375f; }
.site-header .logo-mark { color: #2b4170; }
.search { flex: 1; display: flex; max-width: 420px; margin-left: auto; position: relative; }
.search input { width: 100%; font: inherit; font-size: .95rem; padding: .5rem 2.6rem .5rem .8rem; border-radius: 999px; border: 1px solid #3b4d74; background: #1d2c4f; color: #fff; }
.search input::placeholder { color: #aab4c8; }
.search button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: .35rem; cursor: pointer; color: #fff; }
.search svg, .menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: block; }
.menu-btn { background: none; border: 1px solid #3b4d74; color: #fff; border-radius: 8px; padding: .4rem; cursor: pointer; }
.menu { display: none; border-top: 1px solid #263a63; }
.menu.open { display: block; }
.menu ul { list-style: none; margin: 0 auto; padding: .4rem 1.1rem 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1rem; }
.menu a { display: block; color: #dfe6f3; text-decoration: none; padding: .5rem 0; font-size: .95rem; }
.menu a:hover, .menu a[aria-current] { color: #fff; text-decoration: underline; }
@media (max-width: 560px) {
  .header-row { flex-wrap: wrap; padding-bottom: .6rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .menu-btn { margin-left: auto; }
}
@media (min-width: 1000px) {
  .menu-btn { display: none; }
  .menu { display: block; }
  .menu ul { display: flex; flex-wrap: wrap; gap: 0 1.15rem; padding: .1rem 1.1rem .35rem; }
  .menu a { font-size: .86rem; padding: .35rem 0; }
}

/* ---------- breadcrumbs & heads ---------- */
.crumbs ol { list-style: none; padding: 0; margin: 1rem 0 .4rem; display: flex; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 .45rem; color: #9aa3b2; }
.crumbs a { color: var(--muted); }
.article-head { margin-bottom: 1.2rem; }
.kicker { margin: 0; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kicker a { color: var(--accent); text-decoration: none; }
h1 { font-size: clamp(1.75rem, 1.25rem + 2.4vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; margin: .3rem 0 .6rem; }
.byline { color: var(--muted); font-size: .9rem; margin: 0; }
.byline a { color: inherit; }

/* ---------- article layout ---------- */
.article-grid { display: block; }
.side { margin-bottom: 1.2rem; }
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; font-size: .92rem; }
.toc summary { font-weight: 700; cursor: pointer; }
.toc ol { margin: .5rem 0 .2rem; padding-left: 1.2rem; }
.toc li { margin: .25rem 0; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover, .toc a.active { color: var(--link); text-decoration: underline; }
@media (min-width: 1000px) {
  .article-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 3rem; }
  .side { order: 0; }
  .toc { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
  .page .article-grid:has(.side:empty) { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- prose ---------- */
.prose { max-width: 74ch; }
.prose h2 { font-size: 1.5rem; line-height: 1.25; margin: 2.4rem 0 .7rem; letter-spacing: -.01em; }
.prose h3 { font-size: 1.18rem; margin: 1.8rem 0 .5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose li { margin: .3rem 0; }
.prose .lead { font-size: 1.15rem; color: var(--ink-2); }
.prose code, .prose kbd { font-family: var(--mono); font-size: .88em; }
.prose code { background: #eef1f5; padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.prose kbd { border: 1px solid #c3cad6; border-bottom-width: 2px; border-radius: 4px; padding: .05em .4em; background: #fff; white-space: nowrap; }
.prose pre { font-family: var(--mono); font-size: .88rem; line-height: 1.5; overflow-x: auto; padding: .9rem 1rem; border-radius: var(--radius); margin: 0 0 1.2rem; }
.prose pre.out { background: #0f1830; color: #e6edf7; border-left: 4px solid var(--accent); white-space: pre; }
.prose abbr[title] { text-decoration: underline dotted; cursor: help; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.answer { background: var(--ok-bg); border: 1px solid #b7dfc8; border-radius: var(--radius); padding: .9rem 1.1rem; margin: 0 0 1.4rem; }
.answer p:last-child { margin-bottom: 0; }
.tip, .note, .warn, .case { border-radius: var(--radius); padding: .85rem 1.1rem; margin: 0 0 1.3rem; border-left: 5px solid; }
.tip p:last-child, .note p:last-child, .warn p:last-child, .case p:last-child { margin-bottom: 0; }
.tip { background: var(--ok-bg); border-color: var(--ok); }
.note { background: var(--note-bg); border-color: var(--link); }
.warn { background: var(--warn-bg); border-color: #d98a00; }
.case { background: var(--bg-soft); border-color: var(--ink-2); }
.tip::before, .note::before, .warn::before { display: block; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .25rem; }
.tip::before { content: "Consiglio pratico"; color: var(--ok); }
.note::before { content: "Nota tecnica"; color: var(--link); }
.warn::before { content: "Attenzione"; color: var(--warn); }

ol.steps { list-style: none; counter-reset: s; padding: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: .1rem 0 .7rem 2.7rem; margin: 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: .05rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: .92rem; display: grid; place-items: center; }
ol.steps > li:not(:last-child)::after { content: ""; position: absolute; left: .93rem; top: 2.1rem; bottom: .1rem; width: 2px; background: var(--line); }

.table-wrap { overflow-x: auto; margin: 0 0 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
caption { text-align: left; font-weight: 700; padding: .7rem .9rem; background: var(--bg-soft); border-bottom: 1px solid var(--line); caption-side: top; }
th, td { padding: .55rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: #f0f3f7; font-size: .85rem; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td code { white-space: nowrap; }

.faq details { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .6rem; background: #fff; }
.faq summary { cursor: pointer; padding: .8rem 1rem; font-weight: 650; list-style: none; position: relative; padding-right: 2.5rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 1rem; top: .6rem; font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 1rem .4rem; }
.sources { font-size: .92rem; color: var(--ink-2); border-top: 1px solid var(--line); margin-top: 2.2rem; }
.sources h2 { font-size: 1.15rem; }

dl.glossary dt { font-weight: 750; margin-top: 1.1rem; scroll-margin-top: 1rem; }
dl.glossary dd { margin: .25rem 0 0; }
dl.glossary dt:target { background: #fff4c2; }

.feedback { margin: 2.4rem 0 0; padding: 1rem 1.1rem; border: 1px dashed #b9c2d0; border-radius: var(--radius); font-size: .95rem; background: var(--bg-soft); }
.feedback p { margin: 0; }

/* ---------- cards / related ---------- */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cards a, .sec-grid a { display: flex; flex-direction: column; height: 100%; gap: .3rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.cards a:hover, .sec-grid a:hover { border-color: #9fb3d1; box-shadow: 0 4px 16px rgba(20,33,61,.08); color: var(--ink); }
.card-title { font-weight: 700; line-height: 1.3; }
.card-desc { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.related, .more { margin-top: 2.6rem; }
.related h2, .more h2, .other-sections h2 { font-size: 1.3rem; margin: 0 0 .9rem; }
.more ul { columns: 2 260px; padding-left: 1.1rem; margin: 0 0 .8rem; }
.more li { margin: .3rem 0; break-inside: avoid; }
.more-link { font-weight: 650; }

/* ---------- hubs ---------- */
.layout-hub { padding-bottom: 2rem; }
.hub-head { max-width: 80ch; margin-bottom: 1.6rem; }
.hub-lead { font-size: 1.12rem; color: var(--ink-2); margin: 0; }
.hub-body { margin-top: 2rem; }
.other-sections { margin-top: 2.6rem; border-top: 1px solid var(--line); padding-top: 1.6rem; }
.other-sections ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.other-sections a { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .92rem; color: var(--ink-2); }
.other-sections a:hover { border-color: var(--link); color: var(--link); }

/* ---------- home ---------- */
.hero { background: linear-gradient(180deg, var(--ink) 0%, #1c2d52 100%); color: #fff; padding: 2.6rem 0 2.8rem; position: relative; overflow: hidden; }
.hero h1 { color: #fff; max-width: 20ch; margin: 0 0 .8rem; }
.hero p { color: #d3dbea; max-width: 58ch; font-size: 1.1rem; margin: 0 0 1.4rem; }
.hero .search { max-width: 560px; margin: 0; }
.hero .search input { padding: .85rem 3rem .85rem 1.1rem; font-size: 1.05rem; background: #fff; color: var(--ink); border-color: #fff; }
.hero .search input::placeholder { color: #6b7587; }
.hero .search button { color: var(--ink); right: 8px; }
.scanline { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, #ff5a4e 20%, #ff5a4e 80%, transparent); opacity: .85; }
.home section.band { padding: 2.4rem 0; }
.home section.band.soft { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); letter-spacing: -.01em; margin: 0 0 .4rem; }
.home .sub { color: var(--muted); margin: 0 0 1.3rem; max-width: 70ch; }
.symptoms { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.symptoms a { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; line-height: 1.3; }
.symptoms a:hover { border-color: var(--accent); color: var(--ink); }
.symptoms .ic { flex: none; width: 34px; height: 34px; border-radius: 8px; background: #fde9e7; color: var(--accent); display: grid; place-items: center; font-weight: 800; font-family: var(--mono); font-size: .85rem; }
.sec-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tools-grid a { border-left: 4px solid var(--link); }
.home-split { display: grid; gap: 2rem; }
@media (min-width: 900px) { .home-split { grid-template-columns: 1.2fr 1fr; } }
.checklist { counter-reset: c; list-style: none; padding: 0; margin: 0; }
.checklist li { counter-increment: c; padding: .55rem 0 .55rem 2.4rem; position: relative; border-bottom: 1px solid var(--line); }
.checklist li::before { content: counter(c); position: absolute; left: 0; top: .55rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--ink); color: #fff; font-size: .85rem; font-weight: 700; display: grid; place-items: center; }
.trust { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.trust div { padding: 1rem 1.1rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.trust h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.trust p { margin: 0; color: var(--muted); font-size: .94rem; }

/* ---------- tools ---------- */
.tool-box { border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; background: var(--bg-soft); margin: 0 0 1.8rem; }
.tool-box label, .tool-box .lbl { display: block; font-weight: 650; font-size: .92rem; margin: 0 0 .3rem; }
.tool-box input[type=text], .tool-box input[type=number], .tool-box select, .tool-box textarea { width: 100%; font: inherit; font-size: 1rem; padding: .6rem .75rem; border: 1px solid #b9c2d0; border-radius: 8px; background: #fff; color: var(--ink); }
.tool-box textarea { min-height: 7rem; font-family: var(--mono); font-size: .92rem; }
.tool-box .row { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: .9rem; }
.tool-box .field { margin-bottom: .9rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 650; font-size: .95rem; padding: .6rem 1.05rem; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: #22345c; color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.ghost:hover { background: #eef1f5; color: var(--ink); }
.btns { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .2rem; }
.result { margin-top: 1rem; padding: 1rem; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.result:empty { display: none; }
.result .big { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; overflow-wrap: anywhere; }
.result.ok { border-color: #8fd0ad; }
.result.bad { border-color: #f0a8a2; background: #fff7f6; }
.hint { font-size: .86rem; color: var(--muted); margin: .3rem 0 0; }
.chars { display: flex; flex-wrap: wrap; gap: 4px; margin: .6rem 0; font-family: var(--mono); }
.chars span { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.1rem; padding: .25rem .3rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 1rem; line-height: 1.2; }
.chars span small { font-size: .66rem; color: var(--muted); }
.chars span.ctl { background: #fde9e7; border-color: #f2b1ab; color: #9b2017; font-weight: 700; }
.chars span.sp { background: #eef4fb; }
.chars span.ext { background: #fff4e0; border-color: #f0c98a; }
.barcode-out { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; text-align: center; overflow-x: auto; }
.barcode-out svg, .barcode-out canvas, .barcode-out img { max-width: 100%; height: auto; }
.video-wrap { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; max-width: 560px; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-wrap .aim { position: absolute; inset: 22% 12%; border: 2px solid rgba(255,255,255,.8); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.video-wrap .aim::after { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: #ff5a4e; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { font-weight: 650; color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #eef1f5; color: var(--ink-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: #fde9e7; color: #9b2017; }
.test-codes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 1rem 0; }
.test-codes figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; text-align: center; }
.test-codes figcaption { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.search-results { list-style: none; padding: 0; }
.search-results li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.search-results a { font-weight: 700; font-size: 1.08rem; }
.search-results p { margin: .2rem 0 0; color: var(--muted); font-size: .94rem; }
.search-results .badge { margin-left: .4rem; vertical-align: middle; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c9d2e3; margin-top: 3.5rem; font-size: .92rem; }
.footer-grid { display: grid; gap: 1.6rem; padding-top: 2.4rem; padding-bottom: 1.4rem; }
.footer-grid nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.footer-grid nav[aria-label="Informazioni"] { grid-template-columns: 1fr; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: .35rem 0; }
.site-footer a { color: #e3e9f4; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.footer-brand p { max-width: 36ch; }
.footer-bottom { border-top: 1px solid #2a3b62; padding-top: 1rem; padding-bottom: 1.6rem; font-size: .82rem; color: #9fabc2; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.2fr 2fr 1fr; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .side, .related, .more, .feedback, .other-sections { display: none !important; }
  body { font-size: 12pt; }
  .prose { max-width: none; }
  a { color: inherit; }
}

/* hero demo + home header */
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero-demo { display: none; margin: 0; background: #0f1830; border: 1px solid #2f4370; border-radius: 14px; padding: 1.1rem 1.2rem; box-shadow: 0 18px 40px rgba(0,0,0,.25); }
.demo-row { display: grid; gap: .2rem; padding: .7rem 0; border-bottom: 1px solid #22345c; }
.demo-row code { font-family: var(--mono); font-size: 1.02rem; color: #fff; overflow-wrap: anywhere; }
.demo-row.bad code { color: #ffb4ad; }
.demo-row.ok span:last-child { color: #c9f1da; }
.demo-lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #8fa0c4; font-weight: 700; }
.hero-demo figcaption { padding-top: .8rem; font-size: .92rem; }
.hero-demo a { color: #9cc7ff; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.15fr .85fr; } .hero-demo { display: block; } }
@media (max-width: 999px) { .is-home .site-header .search { display: none; } .is-home .header-row { flex-wrap: nowrap; padding-bottom: 0; } }
[hidden] { display: none !important; }
.hub-body { margin-top: 0; }
.hub-body > h2:first-child { margin-top: .5rem; }
.hub-list { margin-top: 2.2rem; }
.hub-list h2 { font-size: 1.4rem; margin: 0 0 1rem; }
