/*
    Stile della guida (Promisoft.Dashboard.Shell/wwwroot/docs).

    Pagine statiche servite dal pacchetto della shell: nessuna dipendenza esterna,
    nessun font remoto, nessun JavaScript. I colori seguono il tema del sistema
    operativo con prefers-color-scheme - la guida si apre in una scheda del browser,
    quindi non può leggere il cookie del tema dell'applicazione.
*/

:root {
    color-scheme: light dark;

    --guide-bg: #f5f7fa;
    --guide-surface: #ffffff;
    --guide-surface-alt: #eef2f7;
    --guide-border: #d7dee8;
    --guide-border-soft: #e7ecf3;
    --guide-ink: #16202c;
    --guide-ink-soft: #4a5768;
    --guide-ink-faint: #6b7889;
    --guide-brand: #0b3d70;
    --guide-accent: #1f6feb;
    --guide-accent-soft: #e8f0fe;
    --guide-note: #1f6feb;
    --guide-note-bg: #eaf2fe;
    --guide-todo: #b26a00;
    --guide-todo-bg: #fdf3e2;
    --guide-code-bg: #101823;
    --guide-code-ink: #e7edf5;
    --guide-radius: 10px;
    --guide-shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 8px 24px rgba(16, 32, 56, .07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --guide-bg: #0f141b;
        --guide-surface: #161d26;
        --guide-surface-alt: #1c242f;
        --guide-border: #2a343f;
        --guide-border-soft: #232c36;
        --guide-ink: #e7edf5;
        --guide-ink-soft: #aab6c4;
        --guide-ink-faint: #8593a3;
        --guide-brand: #9dc3f5;
        --guide-accent: #6ea8fe;
        --guide-accent-soft: #1b2837;
        --guide-note: #6ea8fe;
        --guide-note-bg: #16222f;
        --guide-todo: #e0a45c;
        --guide-todo-bg: #2a2216;
        --guide-code-bg: #0a0f16;
        --guide-code-ink: #dce5f0;
        --guide-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
    margin: 0;
    background: var(--guide-bg);
    color: var(--guide-ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ---- intestazione ------------------------------------------------------- */

.guide-top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: .75rem 1.5rem;
    background: var(--guide-surface);
    border-bottom: 1px solid var(--guide-border);
}

.guide-top-brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    color: var(--guide-ink);
    text-decoration: none;
    letter-spacing: -.01em;
}

.guide-chip {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 6px;
    background: var(--guide-brand);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}

@media (prefers-color-scheme: dark) {
    .guide-chip { background: #1d2a3a; color: var(--guide-brand); }
}

.guide-top nav {
    display: flex;
    gap: .35rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.guide-top nav a {
    padding: .35rem .7rem;
    border-radius: 7px;
    color: var(--guide-ink-soft);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
}

.guide-top nav a:hover { background: var(--guide-surface-alt); color: var(--guide-ink); }
.guide-top nav a[aria-current="page"] { background: var(--guide-accent-soft); color: var(--guide-accent); }

.guide-version { font-size: .8rem; color: var(--guide-ink-faint); font-variant-numeric: tabular-nums; }

/* ---- impaginazione ------------------------------------------------------ */

.guide-shell {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    gap: 2.5rem;
    max-width: 78rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
}

.guide-toc {
    position: sticky;
    top: 4.5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    font-size: .89rem;
}

.guide-toc strong {
    display: block;
    margin: 0 0 .5rem;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--guide-ink-faint);
}

.guide-toc ol { list-style: none; margin: 0; padding: 0; }
.guide-toc li { margin: 0; }

.guide-toc a {
    display: block;
    padding: .3rem .6rem;
    border-left: 2px solid var(--guide-border-soft);
    color: var(--guide-ink-soft);
    text-decoration: none;
}

.guide-toc a:hover { border-left-color: var(--guide-accent); color: var(--guide-ink); background: var(--guide-surface-alt); }
.guide-toc .sub a { padding-left: 1.4rem; font-size: .85rem; }

main { min-width: 0; }

/* ---- testo -------------------------------------------------------------- */

h1 {
    margin: 0 0 .35rem;
    font-size: 2.1rem;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.lead { margin: 0 0 2.5rem; font-size: 1.1rem; color: var(--guide-ink-soft); }

section { margin: 0 0 3.25rem; scroll-margin-top: 5rem; }

h2 {
    margin: 0 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--guide-border);
    font-size: 1.45rem;
    letter-spacing: -.015em;
}

h3 { margin: 2rem 0 .6rem; font-size: 1.1rem; }
h4 { margin: 1.5rem 0 .4rem; font-size: .97rem; color: var(--guide-ink-soft); }

p, ul, ol, dl { margin: 0 0 1rem; }
li { margin: .2rem 0; }
li > ul, li > ol { margin: .3rem 0; }

a { color: var(--guide-accent); text-underline-offset: 2px; }

code {
    padding: .1rem .32rem;
    border-radius: 5px;
    background: var(--guide-surface-alt);
    border: 1px solid var(--guide-border-soft);
    font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
    font-size: .87em;
}

pre {
    margin: 0 0 1.25rem;
    padding: .95rem 1.1rem;
    overflow-x: auto;
    border-radius: var(--guide-radius);
    background: var(--guide-code-bg);
    color: var(--guide-code-ink);
    font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
    font-size: .84rem;
    line-height: 1.6;
}

pre code { padding: 0; border: 0; background: none; color: inherit; font-size: 1em; }
pre .c { color: #8ba3bd; }

/* ---- tabelle ------------------------------------------------------------ */

.guide-table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--guide-surface);
    border: 1px solid var(--guide-border);
    border-radius: var(--guide-radius);
    font-size: .92rem;
}

th, td { padding: .55rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--guide-border-soft); }
th { background: var(--guide-surface-alt); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--guide-ink-soft); }
tbody tr:last-child td { border-bottom: 0; }

/* ---- immagini ----------------------------------------------------------- */

figure { margin: 1.5rem 0 1.75rem; }

/* Ogni schermata è un collegamento alla propria immagine a dimensione piena: nelle
   coppie affiancate il dettaglio non si legge, e un clic risolve senza JavaScript. */
figure a { display: block; cursor: zoom-in; }

figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--guide-border);
    border-radius: var(--guide-radius);
    box-shadow: var(--guide-shadow);
    background: var(--guide-surface);
}

figcaption { margin-top: .55rem; font-size: .85rem; color: var(--guide-ink-faint); }

.guide-figures { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); }
.guide-figures figure { margin: 0; }

/* ---- riquadri ----------------------------------------------------------- */

.note, .todo {
    margin: 1.25rem 0;
    padding: .85rem 1rem;
    border-left: 3px solid var(--guide-note);
    border-radius: 0 var(--guide-radius) var(--guide-radius) 0;
    background: var(--guide-note-bg);
    font-size: .95rem;
}

.note > :last-child, .todo > :last-child { margin-bottom: 0; }

.note-label, .todo-label {
    display: block;
    margin-bottom: .2rem;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--guide-note);
}

.todo { border-left-color: var(--guide-todo); background: var(--guide-todo-bg); }
.todo-label { color: var(--guide-todo); }

.steps { counter-reset: step; list-style: none; padding: 0; }

.steps > li {
    position: relative;
    margin: 0 0 1rem;
    padding-left: 2.2rem;
}

.steps > li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: .1rem;
    width: 1.55rem;
    height: 1.55rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--guide-accent-soft);
    color: var(--guide-accent);
    font-size: .8rem;
    font-weight: 700;
}

/* ---- copertina --------------------------------------------------------- */

.guide-hero {
    max-width: 78rem;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 1rem;
}

.guide-hero h1 { font-size: 2.6rem; }
.guide-hero p { max-width: 46rem; font-size: 1.15rem; color: var(--guide-ink-soft); }

.guide-cards {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    max-width: 78rem;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

.guide-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid var(--guide-border);
    border-radius: 14px;
    background: var(--guide-surface);
    box-shadow: var(--guide-shadow);
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, border-color .12s ease;
}

.guide-card:hover { transform: translateY(-2px); border-color: var(--guide-accent); }
.guide-card h2 { margin: .35rem 0 .5rem; border: 0; padding: 0; font-size: 1.3rem; }
.guide-card p { margin: 0 0 1rem; color: var(--guide-ink-soft); font-size: .95rem; }
.guide-card ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--guide-ink-faint); }

.guide-card-kind {
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--guide-accent);
}

.guide-foot {
    max-width: 78rem;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    color: var(--guide-ink-faint);
    font-size: .9rem;
}

/* ---- schermi stretti --------------------------------------------------- */

@media (max-width: 62rem) {
    .guide-shell { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .guide-toc { position: static; max-height: none; padding-bottom: 1rem; border-bottom: 1px solid var(--guide-border); }
    .guide-toc ol { display: flex; flex-wrap: wrap; gap: .25rem; }
    .guide-toc a { border-left: 0; border: 1px solid var(--guide-border-soft); border-radius: 7px; }
    .guide-toc .sub { display: none; }
}
