/* MythicOlbia — wiki. Colori presi dal logo: ciano → indaco → viola → magenta.
   Nessun font o libreria esterna: font di sistema. Tema chiaro e scuro, sfondo animato (sfondo.js). */
:root {
  --bg: #f3f6fd;
  --bg-soft: #e9eefb;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --surface-2: #eef1fb;
  --border: rgba(20, 30, 70, .12);
  --border-strong: rgba(20, 30, 70, .24);
  --text: #0e1630;
  --text-2: #34405f;
  --muted: #536080;
  --accent: #006f99;
  --accent-2: #5b22d6;
  --accent-3: #a5128c;
  --link: #00648a;
  --code-bg: rgba(0, 111, 153, .09);
  --code-text: #4a1fb8;
  --tip: #04704c; --tip-bg: rgba(4, 112, 76, .07);
  --warn: #8a5300; --warn-bg: rgba(200, 120, 0, .09);
  --info: #1f5fc4; --info-bg: rgba(31, 95, 196, .07);
  --ex: #6a2fc9; --ex-bg: rgba(106, 47, 201, .07);
  --shadow: 0 1px 2px rgba(15, 23, 48, .06), 0 12px 28px -18px rgba(15, 23, 48, .32);
  --glow: 0 0 0 1px rgba(0, 111, 153, .22), 0 14px 32px -16px rgba(91, 34, 214, .45);
  --brand: linear-gradient(100deg, #0aa6c9 0%, #4f5bea 45%, #8b2fe0 72%, #c8237f 100%);
  --brand-text: linear-gradient(100deg, #00799f 0%, #4338ca 45%, #7c22c9 72%, #b0186e 100%);
  --brand-btn: linear-gradient(100deg, #0679a0 0%, #4338ca 45%, #7c22c9 72%, #b0186e 100%); /* testo bianco sopra: contrasto AA */
  --brand-soft: linear-gradient(135deg, rgba(0, 150, 200, .10), rgba(91, 34, 214, .08) 55%, rgba(165, 18, 140, .08));
  --static-op: .55;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --top: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060914; --bg-soft: #0a0f20; --surface: rgba(16, 23, 43, .80); --surface-solid: #10172b; --surface-2: #172041;
    --border: rgba(140, 170, 255, .15); --border-strong: rgba(140, 170, 255, .30);
    --text: #e9effb; --text-2: #b9c5de; --muted: #8f9cba;
    --accent: #3fd6f5; --accent-2: #a585ff; --accent-3: #f065c4; --link: #6fdcf6;
    --code-bg: rgba(0, 216, 255, .10); --code-text: #9ff0ff;
    --tip: #4fe0a8; --tip-bg: rgba(79, 224, 168, .08);
    --warn: #ffc15c; --warn-bg: rgba(255, 193, 92, .08);
    --info: #86b8ff; --info-bg: rgba(134, 184, 255, .08);
    --ex: #c8a8ff; --ex-bg: rgba(200, 168, 255, .08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -18px rgba(0, 0, 0, .75);
    --glow: 0 0 0 1px rgba(0, 216, 255, .28), 0 14px 44px -14px rgba(123, 47, 255, .6);
    --brand-text: linear-gradient(100deg, #22d3ee 0%, #818cf8 45%, #c084fc 72%, #f472b6 100%);
    --brand-soft: linear-gradient(135deg, rgba(0, 216, 255, .14), rgba(123, 47, 255, .11) 55%, rgba(232, 45, 205, .12));
    --static-op: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060914; --bg-soft: #0a0f20; --surface: rgba(16, 23, 43, .80); --surface-solid: #10172b; --surface-2: #172041;
  --border: rgba(140, 170, 255, .15); --border-strong: rgba(140, 170, 255, .30);
  --text: #e9effb; --text-2: #b9c5de; --muted: #8f9cba;
  --accent: #3fd6f5; --accent-2: #a585ff; --accent-3: #f065c4; --link: #6fdcf6;
  --code-bg: rgba(0, 216, 255, .10); --code-text: #9ff0ff;
  --tip: #4fe0a8; --tip-bg: rgba(79, 224, 168, .08);
  --warn: #ffc15c; --warn-bg: rgba(255, 193, 92, .08);
  --info: #86b8ff; --info-bg: rgba(134, 184, 255, .08);
  --ex: #c8a8ff; --ex-bg: rgba(200, 168, 255, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -18px rgba(0, 0, 0, .75);
  --glow: 0 0 0 1px rgba(0, 216, 255, .28), 0 14px 44px -14px rgba(123, 47, 255, .6);
  --brand-text: linear-gradient(100deg, #22d3ee 0%, #818cf8 45%, #c084fc 72%, #f472b6 100%);
  --brand-soft: linear-gradient(135deg, rgba(0, 216, 255, .14), rgba(123, 47, 255, .11) 55%, rgba(232, 45, 205, .12));
  --static-op: 1;
  color-scheme: dark;
}

/* transizioni morbide fra le pagine (solo i browser che le supportano) */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
body > .layout, body > .home { width: 100%; flex: 1 0 auto; }
body > .footer { flex: none; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent-2) 30%, transparent); }
code, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--code-bg); color: var(--code-text); padding: .12em .42em; border-radius: 6px; overflow-wrap: anywhere; }
code.copiabile { cursor: copy; transition: background .15s, box-shadow .15s; }
code.copiabile:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 .38em; color: var(--muted); background: var(--surface-solid); font-size: .75em; }
h1, h2, h3 { line-height: 1.22; letter-spacing: -.015em; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface-solid); color: var(--text); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 700; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }

/* ── sfondo ── */
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.bg-static {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: var(--static-op);
  background:
    radial-gradient(60vmax 40vmax at 85% -10%, rgba(123, 47, 255, .20), transparent 60%),
    radial-gradient(50vmax 35vmax at -10% 10%, rgba(0, 216, 255, .15), transparent 60%),
    radial-gradient(45vmax 30vmax at 60% 110%, rgba(232, 45, 205, .12), transparent 60%);
}

/* ── barra in alto ── */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--border); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); opacity: .6; }
.topbar-in { max-width: 1440px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: 14px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; border-radius: 8px; }
.brand img { width: 132px; height: auto; display: block; transition: filter .2s; }
.brand:hover img { filter: drop-shadow(0 0 10px rgba(123, 62, 255, .45)); }
.brand-tag { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border-strong); padding: 1px 8px; border-radius: 999px; }
.topnav { display: flex; gap: 2px; overflow: hidden; flex: 1; min-width: 0; }
.topnav a { color: var(--text-2); text-decoration: none; font-size: 14.5px; font-weight: 600; padding: 7px 11px; border-radius: 10px; white-space: nowrap; transition: background .15s, color .15s; }
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a[aria-current] { color: var(--text); background: var(--brand-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); cursor: pointer; font-size: 17px; line-height: 1; padding: 0; transition: border-color .15s, background .15s, transform .15s; }
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(.95); }
.bg-btn[aria-pressed="false"] { opacity: .5; filter: grayscale(1); }
.search-btn { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; min-width: 200px; transition: border-color .15s, color .15s; }
.search-btn > span:first-child { font-size: 18px; }
.search-btn kbd { margin-left: auto; }
.search-btn:hover { border-color: var(--accent); color: var(--text); }
.menu-btn { display: none; }
.t-moon { display: none; }
:root[data-theme="dark"] .t-sun { display: none; }
:root[data-theme="dark"] .t-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .t-sun { display: none; }
  :root:not([data-theme="light"]) .t-moon { display: inline; }
}

/* ── impaginazione ── */
.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; border-right: 1px solid var(--border); padding: 18px 12px 40px; scrollbar-width: thin; }
.sb-home { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 700; margin-bottom: 6px; }
.sb-home:hover { background: var(--surface-2); }
.sb-one { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; font-weight: 650; font-size: 14.5px; color: var(--text); text-decoration: none; transition: background .15s, transform .15s; }
.sb-one:hover { background: var(--surface-2); transform: translateX(2px); }
.sb-one[aria-current="page"] { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sb-g summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: 10px; font-weight: 650; font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.sb-g summary::-webkit-details-marker { display: none; }
.sb-g summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.1em; transition: transform .2s; }
.sb-g[open] summary::after { transform: rotate(90deg); }
.sb-g summary:hover { background: var(--surface-2); }
.sb-g ul { list-style: none; margin: 2px 0 8px 18px; padding: 0 0 0 12px; border-left: 1px solid var(--border); }
.sb-g li a { display: block; padding: 6px 10px; font-size: 14px; color: var(--text-2); text-decoration: none; border-radius: 9px; transition: background .15s, color .15s, transform .15s; }
.sb-g li a:hover { color: var(--text); background: var(--surface-2); transform: translateX(2px); }
.sb-g li a[aria-current="page"] { color: var(--text); font-weight: 700; background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--accent); }
.scrim { position: fixed; inset: var(--top) 0 0 0; background: rgba(3, 6, 15, .55); z-index: 29; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; padding: 28px 32px 64px; min-width: 0; outline: none; }
.doc { max-width: 820px; min-width: 0; width: 100%; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.doc-head { display: flex; gap: 18px; align-items: flex-start; padding-bottom: 22px; margin-bottom: 8px; border-bottom: 1px solid var(--border); position: relative; }
.doc-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 120px; height: 2px; background: var(--brand); border-radius: 2px; }
.doc-ico { flex: none; width: 60px; height: 60px; display: grid; place-items: center; font-size: 30px; border-radius: 18px; background: var(--brand-soft); border: 1px solid var(--border-strong); box-shadow: var(--glow); }
.doc-head h1 { margin: 0 0 6px; font-size: clamp(30px, 4.2vw, 42px); font-weight: 800; letter-spacing: -.025em; }
.lead { margin: 0; color: var(--text-2); font-size: 18px; line-height: 1.55; }

.toc { position: sticky; top: calc(var(--top) + 28px); align-self: start; max-height: calc(100vh - var(--top) - 56px); overflow-y: auto; font-size: 13.5px; }
.toc-t { margin: 0 0 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; color: var(--text-2); text-decoration: none; border-left: 2px solid transparent; transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }
.toc-mob { display: none; margin: 16px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.toc-mob summary { cursor: pointer; padding: 11px 14px; font-weight: 700; }
.toc-mob ol { margin: 0; padding: 0 14px 12px 34px; }
.toc-mob a { color: var(--text-2); }

/* ── contenuto ── */
.prose { font-size: 16.5px; }
.prose > p:first-child { font-size: 17.5px; color: var(--text); }
.prose section { margin-top: 40px; }
.prose h2 { font-size: clamp(22px, 2.6vw, 27px); font-weight: 800; margin: 0 0 14px; position: relative; padding-left: 14px; }
.prose h2::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px; border-radius: 4px; background: var(--brand); }
.prose h3 { font-size: 18.5px; margin: 26px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 16px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); }
.anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; transition: opacity .15s; }
h2:hover .anchor, .anchor:focus { opacity: 1; }

.steps { list-style: none; counter-reset: s; padding: 0 !important; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 12px 16px 12px 54px; margin: 0 !important; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.steps li::before { content: counter(s); position: absolute; left: 13px; top: 11px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: var(--brand-btn); box-shadow: 0 4px 14px -4px rgba(91, 34, 214, .6); }
.steps.big li { padding: 15px 18px 15px 60px; }
.steps.big li::before { top: 14px; left: 16px; }

.cmds { list-style: none; padding: 0 !important; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cmds li { display: grid; grid-template-columns: minmax(150px, 40%) 1fr; gap: 14px; padding: 11px 14px; margin: 0; border-top: 1px solid var(--border); align-items: start; transition: background .15s; }
.cmds li:first-child { border-top: 0; }
.cmds li:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cmd-k { display: flex; flex-wrap: wrap; gap: 6px; }
.cmd { font: 600 14px/1.4 var(--mono); color: var(--code-text); background: var(--code-bg); border: 1px solid transparent; border-radius: 8px; padding: 3px 9px; cursor: copy; text-align: left; overflow-wrap: anywhere; transition: border-color .15s, transform .15s; }
.cmd:hover { border-color: var(--accent-2); }
.cmd:active { transform: scale(.97); }
.cmds li > span { color: var(--text-2); }

.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
thead th { border-top: 0; background: var(--surface-2); font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; position: sticky; top: 0; }
tbody tr { transition: background .15s; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
td:first-child { font-weight: 600; }

.callout { display: flex; gap: 12px; padding: 14px 16px; margin: 0 0 18px; border-radius: var(--radius); border: 1px solid var(--border); border-left-width: 4px; color: var(--text-2); }
.callout p { margin: 2px 0 0; }
.callout > div > strong { font-size: 14px; letter-spacing: .02em; }
.c-ico { font-size: 20px; line-height: 1.3; flex: none; }
.c-tip { background: var(--tip-bg); border-left-color: var(--tip); }
.c-tip > div > strong { color: var(--tip); }
.c-warn { background: var(--warn-bg); border-left-color: var(--warn); }
.c-warn > div > strong { color: var(--warn); }
.c-info { background: var(--info-bg); border-left-color: var(--info); }
.c-info > div > strong { color: var(--info); }
.c-example { background: var(--ex-bg); border-left-color: var(--ex); }
.c-example > div > strong { color: var(--ex); }

.grid { display: grid; gap: 14px; margin: 0 0 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card h3 { margin: 12px 0 4px; font-size: 16.5px; }
.card p { margin: 0; color: var(--text-2); font-size: 15px; }
.card-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--brand-soft); border: 1px solid var(--border); flex: none; }
.card-link { display: block; text-decoration: none; color: inherit; }
.go { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 700; font-size: 14px; }

/* sollevamento e luce che segue il puntatore */
.card, .gcard, .ip-card, .stat, .pn, .news { transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.card::after, .gcard::after, .ip-card::after, .stat::after, .pn::after, .news::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(0, 216, 255, .14), transparent 60%);
}
.card:hover::after, .gcard:hover::after, .ip-card:hover::after, .stat:hover::after, .pn:hover::after, .news:hover::after { opacity: 1; }
.card-link:hover, .gcard:hover, .pn:hover, .stat:hover { transform: translateY(-3px); box-shadow: var(--glow); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.faq { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 18px; overflow: hidden; }
.faq details { border-top: 1px solid var(--border); }
.faq details:first-child { border-top: 0; }
.faq summary { cursor: pointer; padding: 14px 46px 14px 16px; font-weight: 700; position: relative; list-style: none; transition: background .15s; }
.faq summary:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--accent); transition: transform .25s; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.answer { padding: 0 16px 14px; color: var(--text-2); }
.answer p { margin: 0; }

.glossary { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.glossary > div { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 11px 16px; border-top: 1px solid var(--border); }
.glossary > div:first-child { border-top: 0; }
.glossary > div:target { background: var(--brand-soft); }
.glossary dt { font-weight: 750; }
.glossary dd { margin: 0; color: var(--text-2); }

.patch { position: relative; padding: 22px 22px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.patch::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: var(--radius) var(--radius) 0 0; background: var(--brand); }
.patch h2 { padding-left: 0; }
.patch h2::before { display: none; }
.patch-date { display: inline-block; font: 700 12.5px var(--mono); padding: 2px 10px; border-radius: 999px; background: var(--code-bg); color: var(--code-text); margin-bottom: 8px; }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 52px; padding-top: 24px; border-top: 1px solid var(--border); }
.pn { display: flex; flex-direction: column; gap: 2px; padding: 15px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; background: var(--surface); position: relative; overflow: hidden; }
.pn span { font-size: 13px; color: var(--muted); }
.pn strong { color: var(--text); font-size: 16.5px; }
.pn.next { text-align: right; }

/* ── home ── */
.home { outline: none; }
.hero { border-bottom: 1px solid var(--border); position: relative; }
.hero-in { max-width: 980px; margin: 0 auto; padding: 52px 16px 48px; text-align: center; }
.hero.small .hero-in { padding: 88px 16px; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.badge { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); }
.badge:first-child { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.hero h1 { margin: 20px 0 6px; }
.hero-logo { width: min(600px, 92%); filter: drop-shadow(0 12px 44px rgba(123, 47, 255, .4)); }
.hero-title { font-size: clamp(26px, 4.6vw, 40px); font-weight: 850; letter-spacing: -.02em; line-height: 1.15; margin: 4px auto 12px; }
.hero-title .word { display: inline-block; background: var(--brand-text); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { max-width: 640px; margin: 0 auto 28px; color: var(--text-2); font-size: 18px; }
.ip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; max-width: 780px; margin: 0 auto 24px; text-align: left; }
.ip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow); position: relative; }
.ip-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: var(--brand); opacity: .65; pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.ip-l { margin: 0; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ip-v { margin: 6px 0 10px; font-size: 17.5px; }
.ip-v code { font-size: 1em; background: none; color: var(--text); padding: 0; font-weight: 700; }
.port { color: var(--muted); font-size: 14px; }
.port code { color: var(--text) !important; }
.ip-note { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row.center { justify-content: center; }
.copy { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; position: relative; z-index: 1; transition: border-color .15s, transform .15s; }
.copy:hover { border-color: var(--accent); }
.copy:active { transform: scale(.97); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text); font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .18s var(--ease), border-color .18s, filter .18s, box-shadow .18s; }
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn-primary { background: var(--brand-btn); color: #fff; border: 0; box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-discord { background: #4752c4; border-color: #4752c4; color: #fff; }
.btn-discord:hover { filter: brightness(1.12); }
.search-hero { margin: 24px auto 0; display: flex; align-items: center; gap: 10px; width: min(560px, 100%); min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; text-align: left; transition: border-color .15s, color .15s, box-shadow .15s; }
.search-hero kbd { margin-left: auto; }
.search-hero:hover { border-color: var(--accent); color: var(--text); box-shadow: var(--glow); }
.home-sec { max-width: 1180px; margin: 0 auto; padding: 52px 16px 0; }
.home-sec > h2 { font-size: clamp(25px, 3.2vw, 32px); font-weight: 800; margin: 0 0 20px; letter-spacing: -.02em; }
.eyebrow { margin: 0 0 6px; font-size: 12.5px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; text-align: center; position: relative; overflow: hidden; }
.stat strong { display: block; font-size: clamp(30px, 4vw, 38px); line-height: 1.15; font-weight: 850; font-variant-numeric: tabular-nums; background: var(--brand-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--text-2); font-size: 14px; }
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.gcard-h { display: flex; gap: 12px; text-decoration: none; color: var(--text); align-items: flex-start; position: relative; z-index: 1; }
.gcard-h strong { display: block; font-size: 17px; }
.gcard-h small { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.gcard-h:hover strong { color: var(--accent); }
.gcard ul { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--border-strong); display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.gcard li a { display: inline-block; font-size: 13.5px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); text-decoration: none; border: 1px solid var(--border); transition: color .15s, border-color .15s; }
.gcard li a:hover { color: var(--accent); border-color: var(--accent); }
.gcard li.more { font-size: 13px; color: var(--muted); padding: 3px 4px; }
.news { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.news::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--brand); }
.news h2 { margin: 0; font-size: 23px; }
.news .btn { position: relative; z-index: 1; }
.muted { color: var(--muted); margin: 4px 0 0; }
.big404 { font-size: clamp(96px, 18vw, 150px); line-height: 1; font-weight: 900; margin: 0 0 8px; background: var(--brand-text); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -.04em; }
.hero.small h1 { font-size: clamp(28px, 4.5vw, 40px); font-weight: 850; }

/* ── piè di pagina ── */
.footer { margin-top: 72px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg-soft) 80%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.footer-in { max-width: 1180px; margin: 0 auto; padding: 32px 16px 12px; display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.footer-in p { max-width: 460px; color: var(--muted); font-size: 14px; }
.f-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: flex-start; }
.f-links a { color: var(--text-2); text-decoration: none; font-weight: 600; }
.f-links a:hover { color: var(--accent); }
.f-note { max-width: 1180px; margin: 0 auto; padding: 0 16px 28px; font-size: 13px; color: var(--muted); }
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 35; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.to-top.on { opacity: 1; pointer-events: auto; transform: none; }

/* ── ricerca ── */
.search { position: fixed; inset: 0; z-index: 60; background: rgba(3, 6, 15, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search-box { width: min(680px, 100%); max-height: 78vh; display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); overflow: hidden; }
.search-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); font-size: 20px; color: var(--muted); }
.search-row input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 17px; height: 40px; }
.search-row input::-webkit-search-cancel-button { display: none; }
.search-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-list a { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--text); }
.search-list a small { display: block; color: var(--muted); font-size: 12.5px; }
.search-list a span { display: block; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.search-list li[aria-selected="true"] a, .search-list a:hover { background: var(--brand-soft); outline: 1px solid var(--border-strong); }
.search-list mark { background: color-mix(in srgb, #f5b400 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 18px 12px; color: var(--muted); text-align: center; }
.search-hint { margin: 0; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .2s; z-index: 70; background: var(--surface-solid); color: var(--text); border: 1px solid var(--tip); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; pointer-events: none; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── animazioni (solo se il sistema non chiede meno movimento) ── */
@media (prefers-reduced-motion: no-preference) {
  .hero-logo { animation: galleggia 7s ease-in-out infinite; }
  @keyframes galleggia { 50% { transform: translateY(-7px); } }
  .hero-title .word { opacity: 0; transform: translateY(14px); animation: parola .7s var(--ease) forwards, luccica 8s linear 1.2s infinite; }
  .hero-title .word:nth-child(2) { animation-delay: .12s, 1.2s; }
  .hero-title .word:nth-child(3) { animation-delay: .24s, 1.2s; }
  .hero-title .word:nth-child(4) { animation-delay: .36s, 1.2s; }
  .hero-title .word:nth-child(5) { animation-delay: .48s, 1.2s; }
  @keyframes parola { to { opacity: 1; transform: none; } }
  @keyframes luccica { to { background-position: -200% 0; } }
  .js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .reveal .grid > *, .js .reveal .gcards > *, .js .reveal .stats > * { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease), box-shadow .25s, border-color .25s; }
  .js .reveal.in .grid > *, .js .reveal.in .gcards > *, .js .reveal.in .stats > * { opacity: 1; transform: none; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :nth-child(2) { transition-delay: .06s; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :nth-child(3) { transition-delay: .12s; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :nth-child(4) { transition-delay: .18s; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :nth-child(5) { transition-delay: .24s; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :nth-child(n+6) { transition-delay: .3s; }
  .js .reveal.in :is(.grid, .gcards, .stats) > :hover { transition-delay: 0s; }
  .doc-head, .hero-in > .badges, .hero-in > .hero-sub, .hero-in > .ip-grid, .hero-in > .row { animation: entra .5s var(--ease) both; }
  .hero-in > .hero-sub { animation-delay: .25s; }
  .hero-in > .ip-grid { animation-delay: .35s; }
  .hero-in > .row { animation-delay: .45s; }
  @keyframes entra { from { opacity: 0; transform: translateY(10px); } }
  .search-box { animation: scende .22s var(--ease); }
  @keyframes scende { from { opacity: 0; transform: translateY(-8px); } }
  .faq details[open] .answer { animation: scende .3s var(--ease); }
}
/* foto di prova (?foto=1): tutto già visibile */
.foto .hero-title .word, .foto .doc-head, .foto .hero-in > * { animation: none !important; opacity: 1 !important; transform: none !important; }
.foto .reveal, .foto .reveal * { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ── schermi più piccoli ── */
@media (max-width: 1180px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mob { display: block; }
  .topnav a:nth-child(n+6) { display: none; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .topnav { display: none; }
  .sidebar { position: fixed; top: var(--top); left: 0; bottom: 0; height: auto; width: min(320px, 86vw); background: var(--bg); z-index: 30; transform: translateX(-105%); transition: transform .28s var(--ease); box-shadow: var(--shadow); visibility: hidden; }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  .main { padding: 20px 16px 48px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  :root { --top: 58px; }
  .topbar-in { gap: 8px; padding: 0 12px; }
  .top-actions { gap: 6px; }
  .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .search-btn .sb-label, .search-btn kbd { display: none; }
  .brand img { width: 108px; }
  .brand-tag { display: none; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .cmds li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .glossary > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-head { gap: 14px; }
  .doc-ico { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
  .lead { font-size: 16.5px; }
  .prevnext { grid-template-columns: minmax(0, 1fr); }
  .pn.next { text-align: left; }
  .search-hero kbd { display: none; }
  .hero-in { padding-top: 34px; }
  .hero-sub { font-size: 16.5px; }
  .ip-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 10px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .search { padding-top: 12px; }
  th, td { padding: 9px 11px; }
  thead th { white-space: normal; }
  table { font-size: 14.5px; }
}
@media (max-width: 360px) {
  .brand img { width: 92px; }
  .icon-btn, .search-btn { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .sidebar, .toc, .toc-mob, .prevnext, .footer, .search, #bg-canvas, .bg-static, .to-top { display: none !important; }
  .layout, .main { display: block; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
