/* ── SPACE · ACCESSIBILITÀ (WCAG 2.1 AA / EN 301 549) ────────────────────────────
   Va linkato in TUTTE le pagine come ULTIMO foglio di stile del <head>,
   così le correzioni qui sotto hanno la precedenza sui CSS di pagina:
       <link rel="stylesheet" href="a11y.css">
   Contiene: link "salta al contenuto", testo solo-per-screen-reader, focus
   visibile da tastiera, menu mobile, loader per connessioni lente e i contrasti
   del testo alzati al minimo di legge (4.5:1 testo normale, 3:1 testo grande). */

/* ═══ 1. TESTO SOLO PER SCREEN READER ═════════════════════════════════════════ */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* link nascosto che diventa visibile quando ci arriva il tasto Tab */
.sr-only-focusable:focus,
.sr-only-focusable:focus-visible {
    position: fixed !important;
    left: 50% !important;
    bottom: 32px !important;
    transform: translateX(-50%);
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    clip: auto !important;
    overflow: visible !important;
    white-space: nowrap !important;
    z-index: 3000;
    padding: 14px 30px !important;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffe9b8, #ffb35c);
    color: #1a0c00;
    font-family: 'Orbitron', sans-serif;
    font-size: .72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-decoration: none;
}

/* ═══ 2. SALTA AL CONTENUTO ═══════════════════════════════════════════════════ */
.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 6000;
    padding: 12px 20px;
    border-radius: 10px;
    background: #fff;
    color: #000008;
    font-family: 'Exo 2', sans-serif;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform .2s ease;
}
.skip-link:focus,
.skip-link:focus-visible { transform: translateY(0); outline: 3px solid #b4a0ff; outline-offset: 2px; }

main:focus { outline: none; }

/* home: ora c'è il footer dopo il Sole; deve stare sopra i veli luminosi fissi */
.space-footer { position: relative; z-index: 20; }   /* il <main> riceve il focus dal "salta al contenuto": niente cornice */

/* ═══ 3. FOCUS VISIBILE DA TASTIERA (WCAG 2.4.7) ══════════════════════════════
   Solo con la tastiera (:focus-visible): col mouse non cambia nulla. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid #b4a0ff;
    outline-offset: 3px;
    border-radius: 6px;
    box-shadow: 0 0 0 5px rgba(120, 100, 255, .25);
}
/* lo slider del calcolatore aveva outline:none */
input[type=range].calc-range:focus-visible {
    outline: 2px solid #b4a0ff;
    outline-offset: 8px;
    border-radius: 8px;
}
input[type=range].calc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(180,160,255,.8), 0 0 20px rgba(255,255,255,.5); }
input[type=range].calc-range:focus-visible::-moz-range-thumb     { box-shadow: 0 0 0 4px rgba(180,160,255,.8), 0 0 20px rgba(255,255,255,.5); }
/* sottolineatura animata dei link della nav anche al focus, non solo al passaggio del mouse */
.space-nav-link:focus-visible::after,
.space-nav-cta:focus-visible::after,
.footer-col-links a:focus-visible::after { width: 100%; }
.space-nav-link:focus-visible,
.space-nav-cta:focus-visible,
.space-login-btn:focus-visible,
.footer-col-links a:focus-visible,
.footer-legal-links a:focus-visible { color: #fff; }
/* le card si alzano anche col focus da tastiera */
.upgrade-card:focus-within { border-color: rgba(255,255,255,.22); }
.plan-card:focus-within    { border-color: rgba(255,255,255,.22); }

/* ═══ 4. HEADER: etichetta "Scarica app" nascosta solo alla vista ═════════════
   (con display:none il pulsante restava senza nome per gli screen reader) */
@media (max-width: 1100px) {
    .space-download-label {
        display: inline !important;
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
    }
}

/* ═══ 5. MENU MOBILE (sotto i 700px i link della nav sparivano) ═══════════════ */
.space-menu-btn {
    display: none;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,8,.55);
    color: #fff;
    cursor: pointer;
    pointer-events: all;
}
.space-menu-btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.space-menu-btn .icon-close { display: none; }
.space-menu-btn[aria-expanded="true"] .icon-open  { display: none; }
.space-menu-btn[aria-expanded="true"] .icon-close { display: block; }

.space-mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 12px 24px 28px;
    background: rgba(0,0,8,.97);
    border-bottom: 1px solid rgba(255,255,255,.08);
    pointer-events: all;
    z-index: 1001;
}
.space-mobile-menu[hidden] { display: none; }
.space-mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.space-mobile-menu li + li { border-top: 1px solid rgba(255,255,255,.06); }
.space-mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;                       /* area di tocco ≥ 44px */
    font-family: 'Exo 2', sans-serif;
    font-size: .9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255,255,255,.85);
    text-decoration: none;
}
.space-mobile-menu a[aria-current="page"] { color: #fff; font-weight: 500; }
.space-mobile-menu .menu-sep { height: 1px; margin: 10px 0; background: rgba(255,255,255,.12); border: 0; }

@media (max-width: 700px) {
    .space-menu-btn { display: inline-flex; }
    .space-header-right { display: none; }
    .space-header { grid-template-columns: auto 1fr 60px; }
}

/* ═══ 6. LOADER PER CONNESSIONI LENTE ═════════════════════════════════════════
   Compare solo se la pagina non è pronta entro 0,6 s: con una connessione
   veloce non si vede mai. Il logo "SP CE" sta al centro e la navicella del
   logo gli gira attorno come la rotellina di caricamento. */
.space-loader {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: radial-gradient(ellipse at 50% 45%, #0b0b1e 0%, #000008 70%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    opacity: 0;
    visibility: hidden;
    animation: spaceLoaderIn .45s ease .6s forwards;
}
html.has-loader .space-loader { display: flex; }
.space-loader.is-leaving { animation: spaceLoaderOut .5s ease forwards; }
@keyframes spaceLoaderIn  { from { opacity: 0; visibility: visible; } to { opacity: 1; visibility: visible; } }
@keyframes spaceLoaderOut { from { opacity: 1; visibility: visible; } to { opacity: 0; visibility: hidden; } }

.space-loader-orbit { position: relative; width: 156px; height: 156px; }
.space-loader-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.08);
}
/* braccio rotante: porta la navicella e la sua scia */
.space-loader-arm {
    position: absolute; inset: 0;
    animation: spaceLoaderSpin 1.6s linear infinite;
}
.space-loader-trail {
    position: absolute; inset: -1px; border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 200deg, rgba(120,100,255,.15) 260deg, rgba(255,190,130,.75) 358deg, transparent 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
}
/* logo-ship.png è largo come tutto il logo: la navicella è al 49% della larghezza,
   con il muso a 56° → la si centra sul cerchio e la si ruota di 56° così punta
   nel verso della rotazione */
.space-loader-ship {
    position: absolute;
    left: 50%;
    top: 0;
    height: 30px;
    width: auto;
    max-width: none;
    transform-origin: 49.01% 50%;
    transform: translate(-49.01%, -50%) rotate(56deg);
    filter: drop-shadow(0 0 6px rgba(255,190,130,.75));
}
.space-loader-text {
    position: absolute;
    left: 50%;
    top: 50%;
    height: 20px;
    width: auto;
    transform: translate(-50%, -50%);
    opacity: .9;
}
.space-loader-label {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: .62rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
}
@keyframes spaceLoaderSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .space-loader-arm { animation-duration: 4s; }
}

/* ═══ 7. NASTRI SCORREVOLI (tier): pulsante pausa — WCAG 2.2.2 ═══════════════ */
.marquee-pause {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.8);
    font-family: 'Exo 2', sans-serif;
    font-size: .62rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
}
.marquee-pause:hover { color: #fff; border-color: rgba(255,255,255,.35); }
.marquee-pause svg { width: 10px; height: 10px; fill: currentColor; }
.features-section.is-paused .marquee-track,
.features-section:focus-within .marquee-track { animation-play-state: paused !important; }

/* tier: le statistiche del pianeta ora hanno l'etichetta prima del valore nel
   codice (lo screen reader legge "Da 0 GB"), ma restano visivamente sotto */
.planet-widget .stat { display: flex; flex-direction: column-reverse; align-items: center; }

/* tier / contatti: le card ora sono liste (<ul>/<li>) e "Il nostro servizio" è un <h2> */
.cards, .contact-grid, .social-links { list-style: none; }
.side-description h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255,255,255,.62);
    margin-bottom: 14px;
}

/* ═══ 8. CONTRASTI (WCAG 1.4.3) ═══════════════════════════════════════════════
   Su fondo quasi nero il bianco sotto ~47% di opacità scende sotto 4.5:1.
   Qui i testi troppo tenui vengono portati almeno a 0.6 (circa 6:1) e i titoli
   grandi in "em" almeno a 0.5 (circa 4.8:1). La gerarchia visiva resta. */

/* header */
.space-nav-link, .space-nav-cta { color: rgba(255,255,255,.62); }
.space-login-btn { color: rgba(255,255,255,.72); }
.space-download-btn.disabled, .space-download-btn.disabled:hover { color: rgba(255,255,255,.6); }

/* footer */
.footer-tagline, .footer-col-title, .footer-col-links a,
.footer-copy, .footer-legal-links a { color: rgba(255,255,255,.62); }
.footer-col-title { margin: 0 0 20px; }            /* ora è un <h2>: azzera i margini di default */

/* home */
.obj-eyebrow, .stat .lbl, .scroll-hint { color: rgba(255,255,255,.62); }
.obj-desc, .intro-sub { color: rgba(255,255,255,.7); }
.hud-k { color: rgba(255,255,255,.5); }

/* tier */
.stat-label, .side-description h3, .planet-btn,
.section-eyebrow, .section-header-right p, .plan-period, .plan-feature,
.cards-cta-note, .features-eyebrow, .feat-lbl, .calc-eyebrow, .calc-subtitle,
.calc-price-label, .calc-period-btn, .calc-marker, .info-panel p { color: rgba(255,255,255,.62); }
.planet-btn:hover, .calc-period-btn:hover:not(.active) { color: rgba(255,255,255,.9); }
.section-title em, .features-title em { color: rgba(255,255,255,.5); }
.plan-price span, .calc-price span { color: rgba(255,255,255,.62); }
.calc-marker.active, .calc-period-btn.active { color: #fff; }
.calc-gb-display { color: rgba(255,255,255,.65); }
.plan-badge { color: rgba(200,185,255,.95); }

/* upgrades */
.hero-eyebrow, .hero-subtitle, .card-tagline, .card-price-period,
.card-badge-soon, .detail-h, .detail-photo-ph { color: rgba(255,255,255,.62); }
.card-price-amount sup, .detail-price-amount sup { color: rgba(255,255,255,.62); }
.card-cta, .upgrade-modal-back { color: rgba(255,255,255,.78); }
.upgrade-card[data-satellite="luna"]   .card-satellite-label { color: rgba(205,205,225,.8); }
.upgrade-card[data-satellite="io"]     .card-satellite-label { color: rgba(240,190,80,.85); }
.upgrade-card[data-satellite="europa"] .card-satellite-label { color: rgba(120,180,255,.9); }
.upgrade-card[data-satellite="titano"] .card-satellite-label { color: rgba(220,165,100,.85); }
.upgrade-modal[data-satellite] .upgrade-modal-label { filter: brightness(1.35); }

/* contatti */
.hero-label, .card-type, .card-note, .enterprise-eyebrow,
.enterprise-desc, .enterprise-feature, .social-eyebrow, .social-link { color: rgba(255,255,255,.62); }
.enterprise-tagline, .enterprise-mail-label { color: rgba(185,170,255,.85); }
.card-icon svg { stroke: rgba(255,255,255,.7); }

/* ═══ 9. LOGIN E REGISTRAZIONE (login.css) ════════════════════════════════════
   Etichette, sottotitoli e testi del form erano al 22–45% di opacità. */
.login-card-head p, .login-footnote { color: rgba(255,255,255,.68); }
.login-field-label { color: rgba(255,255,255,.7); }
.login-field input::placeholder { color: rgba(255,255,255,.5); }
.login-pwd-toggle { color: rgba(255,255,255,.7); }
.entity-toggle-btn { color: rgba(255,255,255,.72); }
.login-forgot-link { align-self: flex-start; margin-top: 2px; }
.login-ok { background: rgba(46,213,115,.1); border-color: rgba(46,213,115,.3); color: #4be38c; }
/* il link "Password dimenticata" ora sta fuori dall'etichetta: resta sotto il campo */
