/* Layout: barra fissa con nome e navigazione; viste a colonna singola larghe max 1040px; la scheda di una hack ha l'intestazione a forma di cartuccia e due colonne (testo + "cosa ti serve") */
:root {
  --bg: #F1F2F5;
  --surface: #FFFFFF;
  --sunken: #E7E9EF;
  --ink: #151827;
  --muted: #565D76;
  --line: #D5D9E3;
  --accent: #2A45B0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1E6F8;
  --accent-line: #8597DA;
  --ok: #1D6E46;
  --ok-soft: #DBF0E3;
  --wip: #885200;
  --wip-soft: #F8E8C9;
  --none: #565D76;
  --none-soft: #E3E6EE;
  --bad: #A8271F;
  --bad-soft: #F8E0DC;
  --f-display: "Archivo", "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10121A; --surface: #191C27; --sunken: #222634; --ink: #E6E8F1; --muted: #9AA0B6; --line: #2D3243;
    --accent: #93A6F2; --accent-ink: #0D1330; --accent-soft: #212A4C; --accent-line: #4D5FA8;
    --ok: #74D3A3; --ok-soft: #15342A; --wip: #F1B65E; --wip-soft: #3A2B12; --none: #9AA0B6; --none-soft: #242838;
    --bad: #FF8F84; --bad-soft: #3D1D1A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10121A; --surface: #191C27; --sunken: #222634; --ink: #E6E8F1; --muted: #9AA0B6; --line: #2D3243;
  --accent: #93A6F2; --accent-ink: #0D1330; --accent-soft: #212A4C; --accent-line: #4D5FA8;
  --ok: #74D3A3; --ok-soft: #15342A; --wip: #F1B65E; --wip-soft: #3A2B12; --none: #9AA0B6; --none-soft: #242838;
  --bad: #FF8F84; --bad-soft: #3D1D1A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 20px; }
@media (max-width: 480px) { .wrap { padding-inline: 16px; } }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 1.12rem; letter-spacing: -0.01em; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 6px 12px; border-radius: 8px; font-size: 0.95rem; }
nav a:hover { color: var(--ink); background: var(--sunken); }
nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

main section { padding-block: 36px 64px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font-family: var(--f-display); font-stretch: 116%; font-weight: 800; font-size: clamp(1.9rem, 4.2vw, 2.7rem); line-height: 1.06; letter-spacing: -0.015em; }
h2 { font-family: var(--f-display); font-stretch: 108%; font-weight: 700; font-size: 1.22rem; line-height: 1.25; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.eyebrow { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 0.95rem; border-radius: 8px; padding: 10px 16px; border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn-sm { font-size: 0.88rem; padding: 7px 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { background: var(--sunken); color: var(--muted); cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sunken); }
.btn-warn { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.wip, .pill.beta { color: var(--wip); background: var(--wip-soft); }
.pill.none { color: var(--none); background: var(--none-soft); }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.check .pill { white-space: normal; }

.plat { font-family: var(--f-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 5px 5px 2px 2px; padding: 3px 0; width: 46px; text-align: center; }

/* Catalogo */
.cat-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--surface); gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 0.88rem; border: 0; background: transparent; color: var(--muted); padding: 5px 11px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.search { font: inherit; font-size: 0.95rem; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 0; width: 220px; max-width: 100%; }
.count { font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 140px 150px 150px; gap: 16px; align-items: center; padding: 16px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .t { font-weight: 650; font-size: 1.04rem; color: var(--ink); text-decoration: none; }
.row a.t:hover { color: var(--accent); text-decoration: underline; }
.row .d { color: var(--muted); font-size: 0.92rem; }
.row .base small { display: block; font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.row .act { justify-self: end; font-size: 0.9rem; }
.row .act a { font-weight: 600; text-decoration: none; }
.row .act a:hover { text-decoration: underline; }
.row .act span { color: var(--muted); }
.empty { padding: 28px 18px; color: var(--muted); }
@media (max-width: 760px) {
  .row { grid-template-columns: 50px minmax(0, 1fr); gap: 6px 14px; align-items: start; }
  .row .plat { margin-top: 3px; }
  .row .base, .row .stat, .row .act { grid-column: 2; justify-self: start; }
  .row .base small { display: inline; margin-right: 6px; }
}

/* Scheda */
.cart { background: var(--accent); color: var(--accent-ink); border-radius: 18px 18px 8px 8px; clip-path: polygon(0 0, calc(100% - 44px) 0, 100% 44px, 100% 100%, 0 100%); padding: 30px 28px 28px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
.cart .eyebrow { color: inherit; opacity: 0.8; }
.cart .by { opacity: 0.88; }
.cart .pill { background: var(--accent-ink); color: var(--accent); align-self: flex-start; }
.back { display: inline-block; margin-bottom: 16px; font-size: 0.92rem; text-decoration: none; font-weight: 600; }
.sheet { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 860px) { .sheet { grid-template-columns: minmax(0, 1fr); } }
.prose { display: flex; flex-direction: column; gap: 22px; max-width: 64ch; }
.prose ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.note { background: var(--sunken); border-radius: 8px; padding: 12px 14px; font-size: 0.93rem; }
.note.warn { background: var(--wip-soft); color: var(--ink); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 0.95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; } .facts dd { margin-bottom: 8px; } }
.need { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 16px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 12px; }
.steps li::before { content: counter(s); grid-row: span 3; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--accent-line); color: var(--accent); font-family: var(--f-mono); font-weight: 600; font-size: 0.82rem; display: grid; place-items: center; }
.steps .meta { font-family: var(--f-mono); font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.file { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.file.rec { border-color: var(--accent-line); }
.file .ft { font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.file .tag { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent-line); padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.file .fm { font-family: var(--f-mono); font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.file .fb { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Patcher */
.ctx { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 24px; padding: 14px 16px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r); }
.ctx-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctx-text .muted { font-size: 0.92rem; overflow-wrap: anywhere; }
.ctx-act { display: flex; gap: 8px; flex-wrap: wrap; }
.zones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
@media (max-width: 700px) { .zones { grid-template-columns: minmax(0, 1fr); } }
.drop { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 132px; border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent-line); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.loaded { border-style: solid; border-color: var(--accent-line); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop .lbl { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.drop .fname { font-weight: 650; overflow-wrap: anywhere; }
.drop .fmeta { font-family: var(--f-mono); font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.drop .err { color: var(--bad); font-size: 0.9rem; }
.check { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.check .hint { background: var(--sunken); border-radius: 8px; padding: 10px 12px; font-size: 0.93rem; max-width: 72ch; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.msg { margin-top: 14px; font-size: 0.95rem; min-height: 1.2em; }
.msg.bad { color: var(--bad); }
.result { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.result p { overflow-wrap: anywhere; }
.sample { font-size: 0.82rem; color: var(--wip); font-weight: 600; }

/* Guida e contatti */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 26px; }
@media (max-width: 820px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.col .num { font-family: var(--f-mono); color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.tablewrap { overflow-x: auto; margin-top: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.block { margin-top: 36px; display: flex; flex-direction: column; gap: 8px; }
.faq { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-top: 6px; }
.faq details { border-top: 1px solid var(--line); padding: 14px 18px; }
.faq details:first-child { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 10px; color: var(--muted); max-width: 72ch; }
.policy { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; max-width: 64ch; }
.mailbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.mailbox a.mail { font-family: var(--f-mono); background: var(--sunken); padding: 8px 12px; border-radius: 8px; overflow-wrap: anywhere; text-decoration: none; }

footer { border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
footer .wrap { padding-block: 22px 32px; font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: no-preference) {
  [data-view]:not([hidden]) { animation: rise 0.22s ease-out; }
  @keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
}
