/* Guida utente (/guida): indice fisso a sinistra, colonna di lettura a destra. Usa i token di app.css. */
.guide {
  --g-accent: #1f4dff;
  --g-accent-soft: rgba(31, 77, 255, .08);
  --g-ok: #1d7a46;
  --g-ok-soft: #e8f5ec;
  --g-warn: #8a5a00;
  --g-warn-soft: #fbf1dc;
  --g-code: rgba(28, 28, 28, .05);
  --g-mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  font-size: 1.0625rem; line-height: 1.65;
}
.guide a { color: var(--g-accent); text-underline-offset: 2px; }
.guide h2, .guide h3 { font-weight: 600; letter-spacing: -.025em; text-wrap: balance; line-height: 1.2; }
.guide code, .guide kbd { font-family: var(--g-mono); font-size: .84em; background: var(--g-code); padding: .1em .35em; border-radius: 4px; }
.guide kbd { border: 1px solid var(--hairline); }

.guide .wrap { max-width: var(--container); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; padding: 48px var(--gutter) 96px; }

/* Indice */
.guide .toc { position: sticky; top: 5.5rem; align-self: start; max-height: calc(100vh - 7rem); overflow-y: auto; font-size: .9rem; }
.guide .toc ol { list-style: none; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.guide .toc li { counter-increment: toc; }
.guide .toc a { display: grid; grid-template-columns: 26px 1fr; padding: 5px 8px; border-radius: var(--r-btn); color: var(--ink-muted); text-decoration: none; }
.guide .toc a::before { content: counter(toc); font-variant-numeric: tabular-nums; font-size: .78rem; padding-top: 2px; }
.guide .toc a:hover { color: var(--ink); background: var(--ink-4); }
.guide .toc a.is-active { color: var(--ink); background: var(--g-accent-soft); }
.guide .toc details summary { display: none; }

/* Contenuto */
.guide-main { min-width: 0; }
.guide .g-hero { padding-bottom: 40px; border-bottom: 1px solid var(--hairline); margin-bottom: 8px; }
.guide .eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--g-accent); font-weight: 600; }
.guide .g-hero h1 { font-size: clamp(2.1rem, 5vw, 3.25rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.08; margin: 10px 0 16px; max-width: 18ch; text-wrap: balance; }
.guide .g-hero p.lead { font-size: 1.2rem; color: var(--ink-muted); max-width: 62ch; }
.guide .flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 32px; list-style: none; padding: 0; counter-reset: step; }
.guide .flow li { counter-increment: step; background: var(--cream-2); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 16px; font-size: .95rem; line-height: 1.5; }
.guide .flow li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--cream); font-size: .8rem; font-weight: 600; margin-bottom: 10px; }
.guide .flow strong { display: block; margin-bottom: 2px; }
.guide .demo-note { margin-top: 24px; font-size: .9rem; color: var(--ink-muted); max-width: 70ch; }

.guide section { padding-top: 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.guide section > *, .guide .g-prose > * { min-width: 0; }
.guide section > h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); display: flex; align-items: baseline; gap: 14px; }
.guide section > h2 .n { font-size: .95rem; color: var(--g-accent); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.guide section h3 { font-size: 1.25rem; margin-top: 14px; }
.guide .g-prose { max-width: 68ch; display: grid; gap: 14px; }
.guide .g-prose ul, .guide .g-prose ol { padding-left: 1.25em; display: grid; gap: 6px; }

.guide figure { margin: 6px 0 4px; }
.guide figure button { all: unset; cursor: zoom-in; display: block; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--hairline); background: var(--cream-2); }
.guide figure button:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 3px; }
.guide figure img { display: block; width: 100%; height: auto; }
.guide figcaption { font-size: .875rem; color: var(--ink-muted); margin-top: 8px; max-width: 75ch; }
.guide figcaption b { color: var(--ink); font-weight: 600; }
.guide .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.guide .g-note, .guide .tip, .guide .warn { border-radius: var(--r-card); padding: 14px 18px; font-size: .97rem; max-width: 72ch; display: grid; gap: 6px; }
.guide .g-note { background: var(--g-accent-soft); }
.guide .tip { background: var(--g-ok-soft); }
.guide .warn { background: var(--g-warn-soft); }
.guide .g-note > b, .guide .tip > b, .guide .warn > b { font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; }
.guide .tip > b { color: var(--g-ok); }
.guide .warn > b { color: var(--g-warn); }
.guide .g-note > b { color: var(--g-accent); }

.guide .examples { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; max-width: 900px; }
.guide .ex { border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--cream-2); padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.guide .ex .tag { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.guide .ex.good .tag { color: var(--g-ok); }
.guide .ex.bad .tag { color: var(--g-warn); }
.guide q { font-style: italic; quotes: "«" "»"; }
.guide .ex p { font-size: .95rem; }

.guide .prompts { list-style: none; padding: 0; display: grid; gap: 8px; max-width: 900px; }
.guide .prompts li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: .97rem; }
.guide .prompts li span:first-child { color: var(--ink-muted); font-size: .875rem; }

.guide .table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--cream-2); }
.guide table { border-collapse: collapse; width: 100%; font-size: .94rem; min-width: 560px; }
.guide th, .guide td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.guide th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); font-weight: 600; }
.guide tr:last-child td { border-bottom: 0; }
.guide td.num, .guide th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide .yes { color: var(--g-ok); font-weight: 600; }
.guide .no { color: var(--ink-muted); }

.guide .steps-h { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.guide .steps-h li { border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 14px; font-size: .9rem; background: var(--cream-2); }
.guide .steps-h li + li::before { content: "→ "; color: var(--ink-muted); }

.guide pre { margin: 0; background: var(--g-code); border-radius: var(--r-card); padding: 14px 16px; overflow-x: auto; font-family: var(--g-mono); font-size: .875rem; line-height: 1.55; max-width: 100%; }
.guide .cmd { display: flex; gap: 8px; align-items: stretch; max-width: 900px; }
.guide .cmd pre { flex: 1; min-width: 0; }
.guide .copy { font-size: .875rem; border: 1px solid var(--hairline); background: var(--cream-2); border-radius: var(--r-btn); padding: 0 14px; cursor: pointer; }
.guide .copy:hover { border-color: var(--ink-40); }

.guide .g-faq { display: grid; gap: 8px; max-width: 900px; }
.guide .g-faq details { border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--cream-2); padding: 0 18px; }
.guide .g-faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.guide .g-faq summary::-webkit-details-marker { display: none; }
.guide .g-faq summary::after { content: "+"; color: var(--ink-muted); font-weight: 400; }
.guide .g-faq details[open] summary::after { content: "−"; }
.guide .g-faq details > div { padding-bottom: 16px; color: var(--ink-muted); max-width: 70ch; display: grid; gap: 8px; }

.guide dl.gloss { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 20px; max-width: 900px; font-size: .97rem; margin: 0; }
.guide dl.gloss dt { font-weight: 600; }
.guide dl.gloss dd { margin: 0; color: var(--ink-muted); }

.guide footer.end { margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--hairline); font-size: .875rem; color: var(--ink-muted); }

/* Ingrandimento screenshot */
.guide dialog { border: 0; padding: 0; background: transparent; max-width: min(1440px, 96vw); max-height: 94vh; }
.guide dialog::backdrop { background: rgba(10, 10, 10, .78); }
.guide dialog img { display: block; max-width: 100%; max-height: 90vh; border-radius: var(--r-card); }
.guide dialog p { color: #f1eee6; font-size: .875rem; margin-top: 8px; text-align: center; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media (max-width: 920px) {
  .guide .wrap { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; padding-bottom: 72px; }
  .guide .toc { position: static; max-height: none; margin-bottom: 28px; }
  .guide .toc details { border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--cream-2); padding: 0 12px; }
  .guide .toc details summary { display: flex; justify-content: space-between; padding: 12px 4px; cursor: pointer; font-weight: 600; list-style: none; }
  .guide .toc details summary::-webkit-details-marker { display: none; }
  .guide .toc details[open] ol { padding-bottom: 10px; }
  .guide .flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .guide .pair, .guide .examples { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .guide { font-size: 1rem; }
  .guide .flow { grid-template-columns: minmax(0, 1fr); }
  .guide .prompts li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .guide dl.gloss { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .guide dl.gloss dd { margin-bottom: 10px; }
}
