/* =====================================================================
   BIOS LAB — Tema comune a sito e amministrazione
   Laboratorio notturno · celeste per le azioni · rosa per i metadati

   Si carica dopo bioslab.css in entrambi i layout e vale sotto
   body.bl-theme. Qui stanno i token, i componenti condivisi e la scena
   di sfondo con le sue varianti stagionali; site.css e admin.css
   aggiungono solo ciò che serve alle rispettive strutture.

   Due soli accenti con compiti fissi: il celeste è ciò che si clicca
   (bottoni, link, marchio), il rosa è ciò che descrive (eyebrow, codici,
   badge, tag). Angoli quasi vivi, nessun bagliore colorato.
   ===================================================================== */

.bl-theme {
    --bl-bg:            #06080a;
    --bl-bg-alt:        #0a0e13;
    --bl-surface:       rgba(12, 17, 23, .82);
    --bl-surface-2:     rgba(15, 21, 29, .88);
    --bl-surface-3:     #18202a;
    --bl-border:        rgba(255, 255, 255, .09);
    --bl-border-strong: rgba(255, 255, 255, .14);
    --bl-line:          rgba(255, 255, 255, .07);

    --bl-text:          #e8edf2;
    --bl-text-soft:     #9dabb7;
    --bl-text-dim:      #7d8b98;
    --bl-text-label:    #8a97a4;
    --bl-text-nav:      #a9b6c2;

    --bl-accent:        #6fc8f2;
    --bl-accent-deep:   rgba(111, 200, 242, .42);
    --bl-accent-soft:   #a9dcf8;
    --bl-accent-glow:   rgba(111, 200, 242, .16);
    --bl-accent-ink:    #06080a;
    --bl-pink:          #f2a0c4;

    --bl-armed:         #6fc8f2;
    --bl-armed-glow:    rgba(111, 200, 242, .18);

    --bl-radius:        3px;
    --bl-radius-sm:     2px;
    --bl-radius-lg:     3px;

    --bl-shadow:        0 30px 60px -30px rgba(0, 0, 0, .9);
    --bl-shadow-sm:     0 16px 32px -16px rgba(0, 0, 0, .9);
    --bl-popup:         #0c1117;

    --bl-font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --bl-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", monospace;

    --bl-ease: cubic-bezier(.2, .7, .3, 1);

    /* Nero con trama a puntini e righe sottili: i pannelli sono
       traslucidi apposta perché la trama si legga sotto. */
    background-color: var(--bl-bg);
    background-image:
        radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .016) 0 2px, transparent 2px 7px);
    background-size: 24px 24px, auto;
    background-attachment: fixed;
    overflow-x: hidden;
}

.bl-theme :focus-visible { border-radius: var(--bl-radius-sm); }

/* La pagina non scorre: scorre il contenitore sotto la barra, così la
   barra di scorrimento comincia dal bordo inferiore della barra. */
.bl-theme {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.bl-theme .bl-header { flex: none; }

.bl-page,
.bl-theme .adm-main,
.bl-theme .adm-side {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

/* In una colonna flessibile di altezza fissa gli elementi con overflow
   diverso da visible verrebbero schiacciati fino a zero (la hero, per
   esempio): nessun figlio deve restringersi. */
.bl-page > * { flex-shrink: 0; }

.bl-page {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

/* Il contenitore riceve il focus da app.js a ogni caricamento: senza questa
   regola il contorno di :focus-visible (in admin.css più specifico) compare
   come una linea sul bordo durante il cambio pagina. */
.bl-theme [data-scroll-root]:focus,
.bl-theme [data-scroll-root]:focus-visible { outline: none; }

.bl-page::-webkit-scrollbar,
.bl-theme .adm-main::-webkit-scrollbar,
.bl-theme .adm-side::-webkit-scrollbar { width: 10px; }

.bl-page::-webkit-scrollbar-thumb,
.bl-theme .adm-main::-webkit-scrollbar-thumb,
.bl-theme .adm-side::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, .18) padding-box;
}

.bl-page::-webkit-scrollbar-thumb:hover,
.bl-theme .adm-main::-webkit-scrollbar-thumb:hover { background-color: rgba(111, 200, 242, .45); }

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

/* ------------------------------------------------------------------ */
/* Pezzi di base                                                       */
/* ------------------------------------------------------------------ */

.bl-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--bl-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--bl-pink);
}

.bl-eyebrow--accent { color: var(--bl-accent); }

.bl-eyebrow--dot::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
}

.bl-crumb {
    font-family: var(--bl-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--bl-text-label);
}

.bl-crumb a { color: var(--bl-accent); }
.bl-crumb a:hover { color: var(--bl-accent-soft); }

.bl-h2 {
    margin: 12px 0 0;
    font-size: clamp(28px, 3.2vw, 40px);
    line-height: 1.1;
    letter-spacing: -.025em;
}

/* Area immagine in attesa del materiale reale: righe diagonali e una
   didascalia che dice cosa andrà messo lì. */
.bl-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 8px, transparent 8px 16px);
}

.bl-ph--dashed { border: 1px dashed rgba(255, 255, 255, .12); }

.bl-ph__caption {
    padding: 0 12px;
    font-family: var(--bl-mono);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    text-align: center;
    color: var(--bl-text-label);
}

.bl-theme .bl-label { letter-spacing: .16em; color: var(--bl-text-label); }
.bl-theme .bl-label--accent { color: var(--bl-accent); }

.bl-theme .bl-badge { border-radius: var(--bl-radius-sm); background: rgba(6, 8, 10, .8); }
.bl-theme .bl-badge--armed,
.bl-theme .bl-badge--info { border-color: rgba(111, 200, 242, .35); }

.bl-theme .bl-panel {
    background: var(--bl-surface);
    border-color: var(--bl-border);
}

.bl-theme .bl-panel--ticks::before,
.bl-theme .bl-panel--ticks::after,
.bl-theme .bl-sheen::after { display: none; }

.bl-theme .bl-panel__header { border-bottom-color: var(--bl-line); }

.bl-theme .bl-empty {
    border-color: rgba(255, 255, 255, .12);
    background: var(--bl-surface);
}

.bl-theme hr { border-top-color: var(--bl-line); }

.bl-theme .bl-table-wrap { background: var(--bl-surface); }
.bl-theme .bl-table th { background: rgba(10, 14, 19, .9); }

/* I popup stanno sopra al contenuto: fondo pieno, non traslucido. */
.bl-theme .bl-flash { background: var(--bl-popup); border-color: var(--bl-border); }

/* ------------------------------------------------------------------ */
/* Bottoni                                                             */
/* ------------------------------------------------------------------ */

.bl-theme .bl-btn {
    padding: 11px 20px;
    border-color: rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .03);
    font-size: 14.5px;
    font-weight: 500;
    transition: background .2s var(--bl-ease), border-color .2s var(--bl-ease),
                color .2s var(--bl-ease), transform .2s var(--bl-ease);
}

.bl-theme .bl-btn:hover {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(111, 200, 242, .5);
    color: var(--bl-text);
    transform: translateY(-2px);
}

.bl-theme .bl-btn:active { transform: none; }

.bl-theme .bl-btn--primary {
    background: var(--bl-accent);
    border-color: var(--bl-accent);
    color: var(--bl-accent-ink);
    font-weight: 500;
}

.bl-theme .bl-btn--primary:hover {
    background: var(--bl-accent-soft);
    border-color: var(--bl-accent-soft);
    color: var(--bl-accent-ink);
    box-shadow: none;
}

.bl-theme .bl-btn--ghost { background: transparent; color: var(--bl-text-nav); }

.bl-theme .bl-btn--danger { border-color: rgba(255, 93, 107, .4); color: var(--bl-fail); background: rgba(255, 93, 107, .07); }
.bl-theme .bl-btn--danger:hover { border-color: var(--bl-fail); color: var(--bl-fail); background: rgba(255, 93, 107, .14); }

/* Contorno neutro che al passaggio vira sul rosa */
.bl-theme .bl-btn--outline {
    background: transparent;
    border-color: rgba(255, 255, 255, .18);
    color: var(--bl-text);
}

.bl-theme .bl-btn--outline:hover {
    background: rgba(242, 160, 196, .08);
    border-color: rgba(242, 160, 196, .6);
    transform: none;
}

.bl-theme .bl-btn--mono {
    padding: 10px 16px;
    background: transparent;
    font-family: var(--bl-mono);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--bl-text-nav);
}

.bl-theme .bl-btn--mono:hover { color: var(--bl-accent); transform: none; }

.bl-theme .bl-btn--sm { padding: 7px 12px; font-size: 12px; }
.bl-theme .bl-btn--lg { padding: 14px 26px; font-size: 15px; }

/* ------------------------------------------------------------------ */
/* Moduli                                                              */
/* ------------------------------------------------------------------ */

.bl-theme .bl-input,
.bl-theme .bl-select,
.bl-theme .bl-textarea {
    padding: 12px 14px;
    background: rgba(255, 255, 255, .03);
    border-color: rgba(255, 255, 255, .12);
    font-size: 14px;
    color-scheme: dark;
}

.bl-theme .bl-select { background-color: var(--bl-bg-alt); }

.bl-theme .bl-input:focus,
.bl-theme .bl-select:focus,
.bl-theme .bl-textarea:focus {
    border-color: rgba(111, 200, 242, .6);
    box-shadow: none;
}

.bl-theme .bl-textarea { min-height: 0; }

/* ------------------------------------------------------------------ */
/* Barra superiore: aspetto comune                                     */
/* ------------------------------------------------------------------ */

.bl-theme .bl-header {
    background: rgba(6, 8, 10, .82);
    border-bottom-color: var(--bl-line);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.bl-theme .bl-brand {
    gap: 10px;
    font-family: var(--bl-mono);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .16em;
}

.bl-theme .bl-brand__mark { width: 11px; height: 11px; }
.bl-theme .bl-brand__dim { color: var(--bl-text-label); }

.bl-theme .bl-search {
    background: rgba(255, 255, 255, .03);
    border-color: var(--bl-border);
    border-radius: var(--bl-radius-sm);
    transition: border-color .18s var(--bl-ease);
}

.bl-theme .bl-search:hover,
.bl-theme .bl-search:focus-within { border-color: rgba(111, 200, 242, .45); }

.bl-theme .bl-search__icon { font-size: 13px; color: var(--bl-text-label); }
.bl-theme .bl-search__field::-webkit-search-cancel-button { display: none; }

.bl-theme .bl-search__key {
    border-color: rgba(255, 255, 255, .12);
    font-size: 10px;
    color: var(--bl-text-label);
}

.bl-theme .bl-nav__link {
    padding: 8px 12px;
    border-radius: var(--bl-radius-sm);
    font-size: 14px;
    font-weight: 400;
    color: var(--bl-text-nav);
    transition: color .18s, background .18s;
}

.bl-theme .bl-nav__link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.bl-theme .bl-nav__link.is-active { color: var(--bl-accent); background: rgba(111, 200, 242, .10); }

.bl-theme .bl-user { padding: 4px 6px; border-radius: var(--bl-radius-sm); }
.bl-theme a.bl-user:hover { background: rgba(255, 255, 255, .06); }
.bl-theme .bl-user__avatar { border-radius: var(--bl-radius-sm); }

.bl-theme .bl-pill { border-radius: var(--bl-radius-sm); background: rgba(111, 200, 242, .08); border-color: rgba(111, 200, 242, .25); }
.bl-theme .bl-pill__dot { background: var(--bl-accent); }

/* =====================================================================
   Scena della hero

   Riempie la sezione di apertura della home: la fotografia del
   laboratorio, la trama a puntini e gli effetti della stagione.
   data-season e data-event arrivano dal server (SceneService); scene.js
   disegna le particelle sul canvas. La velatura che tiene leggibile il
   titolo è .bl-hero__shade, sopra la scena.

   Gli effetti sono volutamente deboli: si notano, non distraggono.
   ===================================================================== */

.bl-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: #05070a;
}

.bl-scene > * { position: absolute; inset: 0; }

/* L'immagine arriva da un <style> con il nonce della CSP, che non ammette
   attributi style; senza immagine resta il gradiente notturno. */
.bl-scene__img {
    background:
        radial-gradient(ellipse at 18% 30%, rgba(111, 200, 242, .10), transparent 45%),
        radial-gradient(ellipse at 85% 35%, rgba(242, 160, 196, .07), transparent 40%),
        #05070a;
    background-size: cover;
    background-position: center;
    transition: filter 1s ease;
}

.bl-scene__grain {
    background-image:
        radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .016) 0 2px, transparent 2px 7px);
    background-size: 24px 24px, auto;
}

.bl-scene__tint,
.bl-scene__glow,
.bl-scene__frost,
.bl-scene__lights,
.bl-scene__hidden { opacity: 0; transition: opacity 1.2s ease; }

.bl-scene__fx { width: 100%; height: 100%; }

/* ---- Base: laboratorio notturno, luci cyan e blu ------------------ */

.bl-scene[data-season="base"] .bl-scene__glow {
    opacity: 1;
    background:
        radial-gradient(ellipse 40% 50% at 8% 40%, rgba(80, 170, 255, .10), transparent 70%),
        radial-gradient(ellipse 40% 50% at 92% 45%, rgba(60, 200, 255, .08), transparent 70%);
}

/* ---- Inverno: aria fredda, vetri appena ghiacciati ---------------- */

.bl-scene[data-season="inverno"] .bl-scene__img { filter: saturate(.85) brightness(1.02) hue-rotate(8deg); }

.bl-scene[data-season="inverno"] .bl-scene__tint {
    opacity: 1;
    background: linear-gradient(180deg, rgba(170, 205, 255, .10), transparent 45%, rgba(170, 205, 255, .05));
}

.bl-scene[data-season="inverno"] .bl-scene__frost {
    opacity: 1;
    background:
        radial-gradient(ellipse 26% 34% at 0 0, rgba(225, 238, 255, .32), transparent 70%),
        radial-gradient(ellipse 26% 34% at 100% 0, rgba(225, 238, 255, .28), transparent 70%),
        radial-gradient(ellipse 22% 30% at 0 100%, rgba(225, 238, 255, .22), transparent 70%),
        radial-gradient(ellipse 22% 30% at 100% 100%, rgba(225, 238, 255, .22), transparent 70%);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.3 -.05'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23f)'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.3 -.05'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23f)'/%3E%3C/svg%3E");
}

/* ---- Natale: una fila di lucine calde sotto la barra, quasi spenta - */

.bl-scene[data-event="natale"] .bl-scene__lights {
    opacity: 1;
    inset: auto 0 auto 0;
    top: 10px;
    height: 18px;
}

.bl-scene[data-event="natale"] .bl-scene__lights::before,
.bl-scene[data-event="natale"] .bl-scene__lights::after {
    content: "";
    position: absolute;
    inset: 0;
    background-repeat: repeat-x;
    animation: bl-twinkle 5.5s ease-in-out infinite;
}

.bl-scene[data-event="natale"] .bl-scene__lights::before {
    background-image: radial-gradient(circle at 50% 60%, rgba(255, 220, 170, .95) 0 2.2px, rgba(255, 190, 120, .28) 3.2px, transparent 8px);
    background-size: 88px 18px;
}

.bl-scene[data-event="natale"] .bl-scene__lights::after {
    background-image:
        radial-gradient(circle at 50% 40%, rgba(255, 130, 130, .8) 0 2px, transparent 7px),
        radial-gradient(circle at 50% 40%, rgba(150, 235, 180, .7) 0 2px, transparent 7px);
    background-size: 176px 18px, 176px 18px;
    background-position: 44px 0, 132px 0;
    animation-delay: -2.7s;
}

@keyframes bl-twinkle {
    0%, 100% { opacity: .45; }
    50%      { opacity: 1; }
}

/* ---- Primavera: alba chiara, riflessi cyan e verdi ---------------- */

.bl-scene[data-season="primavera"] .bl-scene__img { filter: brightness(1.18) saturate(1.05) hue-rotate(-14deg); }

.bl-scene[data-season="primavera"] .bl-scene__tint {
    opacity: 1;
    background:
        linear-gradient(180deg, rgba(255, 214, 180, .10), rgba(150, 235, 210, .08) 35%, transparent 65%),
        radial-gradient(ellipse 60% 40% at 50% 0, rgba(190, 255, 225, .10), transparent 70%);
}

.bl-scene[data-season="primavera"] .bl-scene__glow {
    opacity: 1;
    background: radial-gradient(ellipse 35% 45% at 12% 85%, rgba(90, 210, 150, .10), transparent 70%);
}

/* ---- Estate: luce calda da fuori, interno blu --------------------- */

.bl-scene[data-season="estate"] .bl-scene__tint {
    opacity: 1;
    background: linear-gradient(180deg, rgba(255, 150, 80, .12), rgba(255, 120, 90, .05) 40%, transparent 70%);
    mix-blend-mode: screen;
}

.bl-scene[data-season="estate"] .bl-scene__glow {
    opacity: 1;
    background:
        radial-gradient(ellipse 45% 35% at 50% 8%, rgba(255, 170, 90, .14), transparent 70%),
        radial-gradient(ellipse 30% 50% at 6% 60%, rgba(80, 170, 255, .10), transparent 70%),
        radial-gradient(ellipse 30% 50% at 94% 60%, rgba(80, 170, 255, .10), transparent 70%);
}

/* ---- Autunno: pioggia, toni arancio e viola ----------------------- */

.bl-scene[data-season="autunno"] .bl-scene__img { filter: saturate(.9) brightness(.95); }

.bl-scene[data-season="autunno"] .bl-scene__tint {
    opacity: 1;
    background:
        linear-gradient(180deg, rgba(140, 70, 170, .12), transparent 50%, rgba(210, 110, 40, .10)),
        radial-gradient(ellipse 40% 40% at 90% 90%, rgba(230, 120, 40, .08), transparent 70%);
}

/* ---- Halloween: dettagli quasi nascosti ai margini ---------------- */

.bl-scene[data-event="halloween"] .bl-scene__hidden { opacity: 1; }

.bl-scene__hidden svg { position: absolute; fill: #020304; }

/* Un ragno sottile che scende dall'angolo in alto a destra */
.bl-scene__spider {
    top: 0;
    right: 7%;
    width: 22px;
    height: 150px;
    opacity: .55;
    animation: bl-spider 14s ease-in-out infinite;
    transform-origin: top center;
}

.bl-scene__spider line { stroke: rgba(200, 210, 220, .18); stroke-width: .6; }

@keyframes bl-spider {
    0%, 100% { transform: translateY(-40px) rotate(0); }
    50%      { transform: translateY(0) rotate(2deg); }
}

/* Un pipistrello che attraversa lo schermo di rado */
.bl-scene__bat {
    top: 18%;
    left: -60px;
    width: 34px;
    height: 16px;
    opacity: .5;
    animation: bl-bat 70s linear infinite;
}

@keyframes bl-bat {
    0%, 88%  { transform: translate(0, 0); }
    94%      { transform: translate(55vw, -6vh); }
    100%     { transform: translate(115vw, 3vh); }
}

/* Due occhi che si accendono per un istante nell'angolo più scuro */
.bl-scene__eyes {
    left: 3%;
    bottom: 14%;
    width: 26px;
    height: 8px;
    opacity: 0;
    animation: bl-eyes 38s ease-in-out infinite;
}

.bl-scene__eyes circle { fill: rgba(255, 160, 60, .55); }

@keyframes bl-eyes {
    0%, 90%, 100% { opacity: 0; }
    92%, 96%      { opacity: .55; }
    94%           { opacity: .1; }
}

.bl-scene[data-event="halloween"] .bl-scene__glow {
    opacity: 1;
    background: radial-gradient(ellipse 18% 16% at 4% 92%, rgba(255, 130, 40, .09), transparent 70%);
}

@media (prefers-reduced-motion: reduce) {
    .bl-scene__lights::before,
    .bl-scene__lights::after,
    .bl-scene__spider,
    .bl-scene__bat,
    .bl-scene__eyes { animation: none; }
    .bl-scene__bat,
    .bl-scene__eyes { display: none; }
}

/* ------------------------------------------------------------------ */
/* Fascia di manutenzione                                              */
/* ------------------------------------------------------------------ */

/* Si vede solo mentre il sito e' chiuso, e solo a chi lo amministra: e'
   l'unico promemoria che la manutenzione e' ancora accesa. */
.bl-theme .bl-maint {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 9px 22px;
    background: rgba(242, 160, 196, .1);
    border-bottom: 1px solid rgba(242, 160, 196, .32);
    font-size: 13px;
    color: var(--bl-text);
}

.bl-maint__dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bl-pink);
    box-shadow: 0 0 0 3px rgba(242, 160, 196, .16);
}

.bl-maint a { margin-left: auto; color: var(--bl-accent); }

/* ------------------------------------------------------------------ */
/* Voti in stelle                                                      */
/* ------------------------------------------------------------------ */

/* Il voto descrive, non si clicca: rosa come le altre diciture. */
.bl-stars {
    display: inline-flex;
    gap: 2px;
    font-size: 13px;
    line-height: 1;
    color: rgba(255, 255, 255, .2);
}

.bl-stars__s.is-on { color: var(--bl-pink); }

/* =====================================================================
   Passaggio tra pagine

   Dove il browser supporta le View Transitions fra documenti (Chrome,
   Edge, Safari), il contenuto vecchio sfuma e il nuovo entra salendo di
   pochi pixel. Si anima solo l'area che scorre ([data-scroll-root]):
   barre e sfondo a trama restano fermi, quindi a fine animazione non c'è
   nulla da "riallineare". Altrove (html.bl-no-vt) la stessa sensazione la
   danno app.js all'uscita e un'animazione CSS all'entrata.

   Solo opacità e spostamento verticale: scala e sfocatura, quando
   l'istantanea lascia il posto alla pagina vera, fanno scattare il testo.
   ===================================================================== */

@view-transition { navigation: auto; }

.bl-theme .bl-header { view-transition-name: bl-header; }
.bl-theme .adm-side { view-transition-name: bl-side; }
.bl-theme [data-scroll-root] { view-transition-name: bl-content; }

/* Tutto ciò che non è contenuto resta com'è: niente dissolvenza incrociata */
::view-transition-group(root),
::view-transition-old(root),
::view-transition-new(root),
::view-transition-group(bl-header),
::view-transition-group(bl-side),
::view-transition-new(bl-header),
::view-transition-new(bl-side),
::view-transition-group(bl-content) { animation: none; }

/* Barre: si vede subito la versione nuova. Con la sola animation: none
   l'istantanea vecchia resterebbe sopra per tutta la transizione, e dopo
   un'uscita la barra mostrerebbe ancora l'utente collegato. */
::view-transition-old(bl-header),
::view-transition-old(bl-side) { display: none; }

/* Le due istantanee non si sommano in trasparenza: la vecchia se ne va
   prima che la nuova diventi visibile. */
::view-transition-image-pair(bl-content) { isolation: auto; }

::view-transition-old(bl-content) {
    animation: bl-content-out .18s cubic-bezier(.4, 0, 1, 1) both;
    mix-blend-mode: normal;
}

::view-transition-new(bl-content) {
    animation: bl-content-in .5s cubic-bezier(.16, 1, .3, 1) .08s both;
    mix-blend-mode: normal;
}

@keyframes bl-content-out {
    to { opacity: 0; transform: translateY(-4px); }
}

@keyframes bl-content-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Ripiego senza View Transitions: entrata del contenuto al caricamento e
   uscita avviata da app.js prima di cambiare pagina. Il fill "backwards"
   toglie la trasformazione a fine animazione senza lasciare residui. */
.bl-no-vt [data-scroll-root] { animation: bl-content-in .5s cubic-bezier(.16, 1, .3, 1) backwards; }

.bl-no-vt.is-leaving [data-scroll-root] {
    animation: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .18s cubic-bezier(.4, 0, 1, 1), transform .18s cubic-bezier(.4, 0, 1, 1);
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }

    .bl-no-vt [data-scroll-root] { animation: none; }
    .bl-no-vt.is-leaving [data-scroll-root] { opacity: 1; transform: none; transition: none; }
}
