/* =====================================================================
   LA SCHEDA VIVA, IN ANTEPRIMA (08/10/2026)
   ---------------------------------------------------------------------
   L'utente: «Rendi il sito che dica "cazzo questo si che è fatto
   veramente bene ed incentiva all'uso"», poi «Vai». Si comincia dalla
   scheda treno: ci arrivano 7 visitatori su 10, quasi tutti da Google,
   con una domanda sola — il mio treno, adesso.
   Collegato solo col cookie bl_scheda (/anteprima-scheda): vedi
   scheda_viva() in app/seo.php. Tutti i colori dai gettoni, cosi' vale
   nel tema scuro e nel chiaro.
   ===================================================================== */

/* ---- 1. DOVE SI TROVA ADESSO ----------------------------------------
   Ritardo (sopra), posizione (qui), prossima fermata (sotto): l'ordine in
   cui le chiede chi aspetta in stazione. */
.bl-viaggio-ora {
    margin: 18px 0 22px;
    padding: 14px 16px 12px;
    background: var(--rm-surface);
    border: 1px solid var(--rm-line);
    border-radius: 12px;
}
.bvo-capi {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--rm-muted);
}
.bvo-capi span:last-child { text-align: right; }
.bvo-binario {
    position: relative;
    height: 6px;
    margin: 14px 9px;
    border-radius: 999px;
    background: rgba(var(--rm-ink-rgb), .09);
}
.bvo-fatto {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(var(--rm-rail-rgb), .45), var(--rm-rail));
    transition: width 600ms cubic-bezier(.77, 0, .175, 1);
}
.bvo-f {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rm-surface);
    box-shadow: 0 0 0 1.5px rgba(var(--rm-ink-rgb), .28);
    transform: translate(-50%, -50%);
}
.bvo-f.is-past { background: var(--rm-rail); box-shadow: none; }
.bvo-f.is-next {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 2px var(--rm-rail);
}
/* IL TRENO: l'unica cosa che si muove. Scorre fino al nuovo punto quando
   la sezione si aggiorna (ogni 90 secondi), e pulsa piano finche' e' in
   viaggio: movimento costante, quindi lineare e lento. */
.bvo-treno {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--rm-rail);
    border: 3px solid var(--rm-surface);
    box-shadow: 0 0 0 0 rgba(var(--rm-rail-rgb), .45);
    transform: translate(-50%, -50%);
    transition: left 600ms cubic-bezier(.77, 0, .175, 1);
    animation: bvo-segnale 2.4s linear infinite;
}
@keyframes bvo-segnale {
    0%   { box-shadow: 0 0 0 0 rgba(var(--rm-rail-rgb), .45); }
    70%  { box-shadow: 0 0 0 10px rgba(var(--rm-rail-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--rm-rail-rgb), 0); }
}
.bvo-dove {
    margin: 0;
    font-size: .95rem;
    line-height: 1.45;
    color: var(--rm-ink);
}
.bvo-dove strong { font-weight: 700; }
.bvo-conta {
    margin-left: 6px;
    font-size: .74rem;
    color: var(--rm-muted);
    white-space: nowrap;
}

/* ---- 2. «AVVISAMI SE RITARDA» E' L'INVITO PRINCIPALE -----------------
   E' la cosa che fa tornare un pendolare la mattina dopo, e stava fra
   «Salva» e «Condividi» con lo stesso peso. Ora e' il bottone pieno, blu
   del marchio (#0B63D6: col bianco sopra fa 5,4:1 in tutti e due i
   temi), con la campanella. Una volta attivo torna discreto. */
html .bl-avvisa:not(.is-on) {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--rm-brand-solid, #0B63D6);
    border-color: var(--rm-brand-solid, #0B63D6);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 6px 18px -8px rgba(11, 99, 214, .7);
}
html .bl-avvisa[hidden] { display: none; }
html .bl-avvisa:not(.is-on)::before {
    content: "";
    width: 15px;
    height: 15px;
    flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
    transform-origin: 50% 10%;
    animation: bvo-campanella 900ms cubic-bezier(.23, 1, .32, 1) 400ms 1 both;
}
/* la campanella fa un mezzo dondolo quando compare, una volta sola */
@keyframes bvo-campanella {
    0%   { transform: rotate(0); }
    20%  { transform: rotate(14deg); }
    45%  { transform: rotate(-10deg); }
    70%  { transform: rotate(5deg); }
    100% { transform: rotate(0); }
}
@media (hover: hover) and (pointer: fine) {
    html .bl-avvisa:not(.is-on):hover {
        background: #0A56BD;
        border-color: #0A56BD;
        color: #FFFFFF;
    }
}

/* ---- 3. IL RITARDO HA IL COLORE DELLA SUA FASCIA --------------------
   Il filo a sinistra del riquadro «Oggi in tempo reale» era sempre
   ambra: ora e' la luce della scala, la stessa del numero grande. */
html .today-status:has(.tmon-big .rt-ok) { border-left-color: var(--luce-ok, var(--rm-accent)); }
html .today-status:has(.tmon-big .rt-w1) { border-left-color: var(--luce-w1, var(--rm-amber)); }
html .today-status:has(.tmon-big .rt-w2) { border-left-color: var(--luce-w2, var(--rm-orange)); }
html .today-status:has(.tmon-big .rt-ko) { border-left-color: var(--luce-ko, var(--rm-red)); }

@media (prefers-reduced-motion: reduce) {
    .bvo-treno { animation: none; transition: none; }
    .bvo-fatto { transition: none; }
    html .bl-avvisa:not(.is-on)::before { animation: none; }
}

/* ---- 4. IL PRONOSTICO SENZA ACCOUNT ----------------------------------
   Un tocco su una scelta, senza modulo: la domanda e' una sola. Le scelte
   sono le stesse misure del sito (in orario fino a 5 minuti, poi le
   fasce), e «Soppresso» sta da parte, rosso. */
.bl-anon-dom {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--rm-ink);
}
.bl-anon-scelte {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.bl-anon-scelte button {
    min-height: 44px;
    padding: 8px 6px;
    border: 1px solid var(--rm-line);
    border-radius: 10px;
    background: var(--rm-surface);
    color: var(--rm-ink);
    font: 700 .95rem/1 "JetBrains Mono", ui-monospace, monospace;
    cursor: pointer;
    transition: transform 120ms cubic-bezier(.23, 1, .32, 1), background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.bl-anon-scelte button:first-child { grid-column: span 3; font-family: inherit; }
.bl-anon-scelte button.is-sopp { grid-column: span 3; font-family: inherit; color: var(--rm-red); }
@media (hover: hover) and (pointer: fine) {
    .bl-anon-scelte button:hover:not(:disabled) { border-color: var(--rm-rail); background: rgba(var(--rm-rail-rgb), .07); }
}
.bl-anon-scelte button:active:not(:disabled) { transform: scale(.96); }
.bl-anon-scelte button.is-scelto { background: var(--rm-rail); border-color: var(--rm-rail); color: #FFFFFF; }
.bl-anon-scelte button:disabled:not(.is-scelto) { opacity: .45; cursor: default; }
.bl-anon-msg { margin: 10px 0 0; font-size: .92rem; color: var(--rm-red); }
.bl-anon-msg.is-ok {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(var(--rm-rail-rgb), .08);
    border: 1px solid rgba(var(--rm-rail-rgb), .3);
    color: var(--rm-ink);
    transition: opacity 200ms cubic-bezier(.23, 1, .32, 1), transform 200ms cubic-bezier(.23, 1, .32, 1);
}
@starting-style { .bl-anon-msg.is-ok { opacity: 0; transform: translateY(4px); } }
.bl-anon-nota { margin: 10px 0 0; font-size: .8rem; line-height: 1.5; color: var(--rm-muted); }
.bl-anon-fatto {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(var(--rm-rail-rgb), .08);
    border: 1px solid rgba(var(--rm-rail-rgb), .3);
    color: var(--rm-ink);
}
/* L'ESITO: il numero dei punti e' il premio, ed e' grande. */
.bl-anon-esito { display: grid; gap: 8px; }
.bl-anon-esito p { margin: 0; }
.bl-anon-esito-t { color: var(--rm-ink); }
.bl-anon-punti { display: flex; align-items: baseline; gap: 8px; color: var(--rm-muted); }
.bl-anon-punti .mono {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--rm-rail);
    animation: bvo-punti 500ms cubic-bezier(.23, 1, .32, 1) both;
}
@keyframes bvo-punti {
    from { opacity: .4; transform: translateY(6px) scale(.96); }
    to   { opacity: 1; transform: none; }
}
.bl-anon-punti small { font-size: .78rem; }
.bl-anon-accedi { display: block; text-align: center; font-size: .85rem; }
@media (prefers-reduced-motion: reduce) {
    .bl-anon-punti .mono { animation: none; }
    .bl-anon-scelte button { transition: none; }
}

/* ---- 5. IL PROFILO DEL PENDOLARE --------------------------------------
   I tre numeri in testa sono la risposta («com'e' andato il mio mese»),
   la lista sotto il dettaglio, treno per treno, ordinata per puntualita'. */
.pf-pendolare { margin-bottom: 0; }
.pf-pend-tot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 24px;
    margin: 4px 0 18px;
}
.pf-pend-tot > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-big {
    font-size: clamp(1.7rem, 4.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    color: var(--rm-ink);
    font-variant-numeric: tabular-nums;
}
.pf-pend-tot span:last-child { font-size: .8rem; color: var(--rm-muted); line-height: 1.35; }
.pf-pend-lista { list-style: none; margin: 0; padding: 0; }
.pf-pend-lista li {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 120px 44px 82px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--rm-line);
}
.pf-pend-lista a { font-weight: 700; }
.pf-pend-tratta { font-size: .85rem; color: var(--rm-muted); min-width: 0; overflow-wrap: anywhere; }
.pf-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font: 600 .68rem/1.6 "JetBrains Mono", ui-monospace, monospace;
    font-style: normal;
    letter-spacing: .02em;
    white-space: nowrap;
}
.pf-tag.is-ok { background: rgba(var(--rm-accent-rgb), .14); color: var(--rm-accent); }
.pf-tag.is-ko { background: rgba(var(--rm-red-rgb), .14); color: var(--rm-red); }
.pf-pend-bar { display: block; height: 6px; border-radius: 999px; background: rgba(var(--rm-ink-rgb), .09); overflow: hidden; }
.pf-pend-bar i { display: block; height: 100%; border-radius: inherit; background: var(--rm-muted); }
.pf-pend-bar i.ok { background: var(--luce-ok, var(--rm-accent)); }
.pf-pend-bar i.w  { background: var(--luce-w1, var(--rm-amber)); }
.pf-pend-bar i.ko { background: var(--luce-ko, var(--rm-red)); }
.pf-pend-n { text-align: right; font-weight: 700; }
.pf-pend-m { text-align: right; font-size: .78rem; color: var(--rm-muted); }
.pf-nota { margin: 12px 0 0; font-size: .8rem; line-height: 1.5; color: var(--rm-muted); }
@media (max-width: 640px) {
    .pf-pend-tot { grid-template-columns: 1fr 1fr; }
    .pf-pend-tot > div:last-child { grid-column: span 2; }
    .pf-pend-lista li { grid-template-columns: 1fr auto; gap: 4px 12px; }
    .pf-pend-tratta { grid-column: 1 / -1; order: 3; }
    .pf-pend-bar { grid-column: 1 / -1; order: 4; }
    .pf-pend-m { display: none; }
}

/* la precisione: una barra per pronostico, i centri nel blu */
.pf-prec { display: block; width: 100%; height: 72px; overflow: visible; }
.pf-prec rect { fill: rgba(var(--rm-ink-rgb), .22); }
.pf-prec rect.is-centro { fill: var(--rm-rail); }

/* il calendario: 28 quadrati, sette per riga */
.pf-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 28px)); gap: 6px; }
.pf-cal i {
    aspect-ratio: 1;
    border-radius: 6px;
    background: rgba(var(--rm-ink-rgb), .07);
}
.pf-cal i.is-giocato { background: rgba(var(--rm-rail-rgb), .32); }
.pf-cal i.is-centro { background: var(--rm-rail); }
.pf-cal i.is-oggi { box-shadow: 0 0 0 2px var(--rm-surface), 0 0 0 3.5px rgba(var(--rm-ink-rgb), .45); }

/* ---- 6. CRONOLOGIA E IMPOSTAZIONI ------------------------------------ */
.pf-cron-tot { margin: 0 0 18px; }
.pf-scarto {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    font: 600 .7rem/1.6 "JetBrains Mono", ui-monospace, monospace;
    background: rgba(var(--rm-ink-rgb), .08);
    color: var(--rm-muted);
    white-space: nowrap;
}
.pf-scarto.is-centro { background: rgba(var(--rm-rail-rgb), .14); color: var(--rm-rail); }
/* L'email nel riquadro «Account» veniva tagliata: un indirizzo lungo non
   ha spazi dove andare a capo. */
.pf-settings .detail-metrics strong,
.pf-settings .metric-grid strong { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.pf-settings .metric-grid span { min-width: 0; }

/* ===== 7. Notifiche in Impostazioni, i tuoi treni in cima alla home ===== */
.pf-sposta { margin-bottom: 0; }
#notifiche { scroll-margin-top: 96px; }
.bl-miei-nulla b { font-weight: 700; color: var(--rm-ink); font-size: .85rem; }
.bl-miei .rm-sec-link { margin-left: auto; }

/* ===== 8. La mappa del percorso rifatta (train_route_map_viva) =====
   Solo gettoni: il tema chiaro la ridipinge da se'. Le quattro luci sono
   quelle della scala dei ritardi; nel tema scuro --luce-* non esiste e si
   ripiega sui colori di stato. */
.blm-wrap {
    --f-ok: var(--luce-ok, var(--rm-accent));
    --f-w1: var(--luce-w1, var(--rm-amber));
    --f-w2: var(--luce-w2, var(--rm-orange));
    --f-ko: var(--luce-ko, var(--rm-red));
}
.blm-box { position: relative; margin: 4px auto 10px; }
.blm { display: block; width: 100%; height: auto; margin: 0 auto; overflow: hidden;
       border-radius: 12px; background: rgba(var(--rm-ink-rgb), .025); }
.blm-rete { fill: none; stroke: rgba(var(--rm-ink-rgb), .13); stroke-width: 1.1; stroke-linecap: round; }
.blm-dafare { fill: none; stroke: rgba(var(--rm-ink-rgb), .38); stroke-width: 2.4; stroke-dasharray: 2 6; stroke-linecap: round; stroke-linejoin: round; }
.blm-fatto-alone { fill: none; stroke: rgba(var(--rm-rail-rgb), .22); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.blm-fatto { fill: none; stroke: var(--rm-rail); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

.blm-st { cursor: pointer; outline: none; }
.blm-hit { fill: transparent; }
.blm-pt { stroke: var(--rm-surface); stroke-width: 2; transition: r var(--t-fast) var(--ease-out); }
.blm-f-ok .blm-pt, .blm-f-ok.blm-leg-pt, .blm-f-ok .blm-treno-pt { fill: var(--f-ok); }
.blm-f-w1 .blm-pt, .blm-f-w1.blm-leg-pt, .blm-f-w1 .blm-treno-pt { fill: var(--f-w1); }
.blm-f-w2 .blm-pt, .blm-f-w2.blm-leg-pt, .blm-f-w2 .blm-treno-pt { fill: var(--f-w2); }
.blm-f-ko .blm-pt, .blm-f-ko.blm-leg-pt, .blm-f-ko .blm-treno-pt { fill: var(--f-ko); }
.blm-f-da .blm-pt { fill: var(--rm-surface); stroke: rgba(var(--rm-ink-rgb), .5); stroke-width: 1.6; }
.blm-st:hover .blm-pt, .blm-st:focus-visible .blm-pt, .blm-st.is-aperta .blm-pt { r: 7; }
.blm-st:focus-visible .blm-hit { stroke: var(--rm-rail); stroke-width: 2; }
.blm-nome {
    font: 600 11px/1 system-ui, sans-serif; fill: var(--rm-ink);
    paint-order: stroke; stroke: var(--rm-bg); stroke-width: 3.5px; stroke-linejoin: round;
    pointer-events: none;
}
.blm-nome.is-capo { font-weight: 750; font-size: 12px; }

.blm-treno-pt { stroke: var(--rm-surface); stroke-width: 2.5; }
.blm-treno-ic { fill: none; stroke: var(--rm-ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.blm-f-ok .blm-treno-ic, .blm-f-ko .blm-treno-ic { stroke: #fff; }
.blm-treno-onda { fill: none; stroke: var(--rm-rail); stroke-width: 2; transform-box: fill-box; transform-origin: center;
                  animation: blm-onda 2.4s var(--ease-out) infinite; }
@keyframes blm-onda { from { transform: scale(.9); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }

.blm-pop {
    position: absolute; z-index: 3; min-width: 168px; max-width: 240px;
    padding: 10px 12px; border-radius: 11px;
    background: var(--rm-surface); border: 1px solid var(--rm-line); box-shadow: var(--sh-2);
    font-size: .82rem; color: var(--rm-ink); pointer-events: none;
    transform: translate(-50%, calc(-100% - 14px));
    transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
@starting-style { .blm-pop { opacity: 0; transform: translate(-50%, calc(-100% - 8px)); } }
.blm-pop.is-sotto { transform: translate(-50%, 14px); }
.blm-pop strong { display: block; font-size: .88rem; margin-bottom: 4px; }
.blm-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.blm-pop dt { color: var(--rm-muted); font-weight: 500; }
.blm-pop dd { margin: 0; font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.blm-pop .is-ok { color: var(--f-ok); } .blm-pop .is-w1 { color: var(--rm-amber); }
.blm-pop .is-w2 { color: var(--rm-orange); } .blm-pop .is-ko { color: var(--rm-red); }

.blm-leg { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 6px; padding: 0;
           font-size: .78rem; color: var(--rm-muted); }
.blm-leg li { display: inline-flex; align-items: center; gap: 6px; }
.blm-leg i { display: inline-block; flex: none; }
.blm-leg-pt { width: 10px; height: 10px; border-radius: 50%; }
.blm-f-ok.blm-leg-pt { background: var(--f-ok); } .blm-f-w1.blm-leg-pt { background: var(--f-w1); }
.blm-f-w2.blm-leg-pt { background: var(--f-w2); } .blm-f-ko.blm-leg-pt { background: var(--f-ko); }
.blm-f-da.blm-leg-pt { background: var(--rm-surface); box-shadow: inset 0 0 0 1.6px rgba(var(--rm-ink-rgb), .5); }
.blm-leg-treno { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(var(--rm-rail-rgb), .35); }
.blm-f-ok.blm-leg-treno { background: var(--f-ok); } .blm-f-w1.blm-leg-treno { background: var(--f-w1); }
.blm-f-w2.blm-leg-treno { background: var(--f-w2); } .blm-f-ko.blm-leg-treno { background: var(--f-ko); }
.blm-leg-rete { width: 18px; height: 2px; background: rgba(var(--rm-ink-rgb), .25); }
@media (prefers-reduced-motion: reduce) { .blm-treno-onda { animation: none; } .blm-pt, .blm-pop { transition: none; } }
/* Sul telefono l'SVG scende a meta': i nomi a 11 unita' diventerebbero di
   6 pixel. Restano i capolinea, piu' grandi; gli altri si leggono toccando. */
@media (max-width: 575.98px) {
    .blm-nome:not(.is-capo) { display: none; }
    .blm-nome.is-capo { font-size: 19px; stroke-width: 5px; }
    .blm-pt { r: 6; }
    .blm-st.is-capo .blm-pt { r: 8; }
    .blm-hit { r: 20; }
}
