/* ECCOCI! — Age Theme System v1.2
   Shared across all public pages.
   Applied via class on <html>: age-senior | age-mid | age-young
   ─────────────────────────────────────────────────────────────── */

/* ── OVER 50: sfondo chiaro, accessibilità massima ── */
html.age-senior {
    --bg:           #f2ece0;
    --surface:      #e9e2d4;
    --surface2:     #dfd7c8;
    --surface3:     #d3cbb9;
    --border:       #bdb49f;
    --border-strong:#a09580;
    --accent:       #991212;
    --accent-dim:   rgba(153,18,18,.1);
    --accent-bd:    rgba(153,18,18,.32);
    --accent-hover: #6b0d0d;
    --accent-dark:  #6b0d0d;
    --orange:       #b53a06;
    --green:        #14582b;
    --blue:         #173ea8;
    --text:         #0e0e18;
    --text-muted:   #4a4460;
    --text-dim:     #5e5875;
}
html.age-senior body {
    font-size: 20px !important;
    line-height: 1.9 !important;
    letter-spacing: 0.012em;
}
/* Touch targets minimi 44px — escludi i chip switcher */
html.age-senior a:not(.eccoci-chip),
html.age-senior button:not(.eccoci-chip),
html.age-senior [role="button"]:not(.eccoci-chip) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
/* Link sempre sottolineati */
html.age-senior a:not([class]):not([style]) {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}
/* Focus ring visibile */
html.age-senior *:focus-visible {
    outline: 3px solid var(--accent) !important;
    outline-offset: 4px !important;
    border-radius: 3px;
}
/* Più spazio intorno ai blocchi di testo */
html.age-senior p { margin-bottom: 1.1em; }

/* Headings: ridimensiona per evitare overflow con rem scalati a 20px */
html.age-senior h1 {
    font-size: clamp(1.55rem, 4vw, 2.2rem) !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
    word-break: break-word;
    overflow-wrap: break-word;
}
html.age-senior h2 {
    font-size: clamp(1.2rem, 3vw, 1.7rem) !important;
    line-height: 1.3 !important;
    letter-spacing: -0.005em !important;
    word-break: break-word;
}
html.age-senior h3 {
    font-size: clamp(1.05rem, 2.5vw, 1.35rem) !important;
    line-height: 1.45 !important;
    letter-spacing: 0 !important;
    word-break: break-word;
}

/* Card e topic-header: più respiro verticale */
html.age-senior .card,
html.age-senior [class*="card"] {
    padding-top: 1.8rem !important;
    padding-bottom: 1.6rem !important;
}
html.age-senior .topic-header,
html.age-senior .tile {
    padding: 1.6rem 1.8rem !important;
}
/* topic-btn e filtri: non collassare */
html.age-senior .topic-btn,
html.age-senior .topic-nav a,
html.age-senior .filter-btn {
    font-size: .85rem !important;
    padding: .7rem 1.2rem !important;
    min-height: 44px;
    white-space: nowrap;
}

/* Scrollbar più larga e visibile */
html.age-senior ::-webkit-scrollbar { width: 10px; height: 10px; }
html.age-senior ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }

/* ── 35-50: dark navy bilanciato ── */
html.age-mid {
    --bg:           #0f1623;
    --surface:      #161f30;
    --surface2:     #1e2a40;
    --surface3:     #253350;
    --border:       #2a3650;
    --border-strong:#3a4f70;
    --accent:       #ef4444;
    --accent-dim:   rgba(239,68,68,.12);
    --accent-bd:    rgba(239,68,68,.35);
    --accent-hover: #fca5a5;
    --accent-dark:  #b91c1c;
    --orange:       #fb923c;
    --green:        #4ade80;
    --blue:         #60a5fa;
    --text:         #dde4f0;
    --text-muted:   #7a88a8;
    --text-dim:     #9aaac8;
}
html.age-mid body { font-size: 16px !important; line-height: 1.7 !important; }

/* ── UNDER 35: dark puro originale ── */
html.age-young {
    --bg:           #0e0f13;
    --surface:      #14161d;
    --surface2:     #1a1d27;
    --surface3:     #20242f;
    --border:       #24212a;
    --border-strong:#342a33;
    --accent:       #ef4444;
    --accent-dim:   rgba(239,68,68,.12);
    --accent-bd:    rgba(239,68,68,.35);
    --accent-hover: #fca5a5;
    --accent-dark:  #b91c1c;
    --orange:       #fb923c;
    --green:        #4ade80;
    --blue:         #38bdf8;
    --text:         #ececf0;
    --text-muted:   #6b6470;
    --text-dim:     #a49fae;
}
html.age-young body { font-size: 14px !important; line-height: 1.6 !important; }

/* ═══════════════════════════════════════════════════
   OVERLAY — age selection modal
   ═══════════════════════════════════════════════════ */
#eccoci-age-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8,8,15,.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: eccociAgeIn .3s ease;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', 'Consolas', monospace;
}
#eccoci-age-overlay.eccoci-hidden { display: none; }

@keyframes eccociAgeIn {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1);   }
}

.eccoci-age-card {
    background: #14161d;
    border: 1px solid #342a33;
    border-radius: 20px;
    padding: 2.8rem 2.2rem 2.2rem;
    max-width: 540px;
    width: 92%;
    text-align: center;
    box-shadow: 0 12px 50px rgba(0,0,0,.7);
}
.eccoci-age-card h2 {
    margin: 0 0 .5rem;
    font-size: 1.5em;
    font-weight: 800;
    color: #ef4444;
    letter-spacing: -.03em;
}
.eccoci-age-card p {
    margin: 0 0 2rem;
    color: #a49fae;
    font-size: .88em;
    line-height: 1.6;
}
.eccoci-age-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.eccoci-age-btn {
    border: none;
    border-radius: 14px;
    padding: 1.3rem .8rem 1.1rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: .88em;
    line-height: 1.3;
    transition: transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    min-height: 120px;
    justify-content: center;
}
.eccoci-age-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.eccoci-age-btn:focus-visible { outline: 3px solid #ef4444; outline-offset: 3px; }
.eccoci-age-btn .ico { font-size: 2em; line-height: 1; }
.eccoci-age-btn .lbl { font-size: .72em; opacity: .65; font-weight: 400; margin-top: .1rem; }
.eccoci-age-btn-senior { background: #f2ece0; color: #0e0e18; }
.eccoci-age-btn-mid    { background: #253350; color: #dde4f0; }
.eccoci-age-btn-young  { background: #1a1d27; color: #ececf0; border: 1px solid #342a33; }
.eccoci-age-skip {
    margin-top: 1.2rem;
    font-size: .72em;
    color: #6b6470;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.eccoci-age-skip:hover { color: #a49fae; }

/* ═══════════════════════════════════════════════════
   SWITCHER CHIP — fixed bottom-right
   ═══════════════════════════════════════════════════ */
#eccoci-age-switcher {
    position: fixed;
    bottom: 1.2rem;
    right: 1rem;
    z-index: 500;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', 'Consolas', monospace;
}
.eccoci-chip-label {
    font-size: 10px;
    color: var(--text-muted, #6b6470);
    opacity: .4;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding-right: 2px;
}
.eccoci-theme-row {
    display: flex;
    gap: 4px;
}
.eccoci-theme-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-height: unset !important;
    padding: 0 !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-strong, #342a33) !important;
    background: var(--surface2, #1a1d27) !important;
    font-size: 16px !important;
    line-height: 1 !important;
    cursor: pointer;
    opacity: .55;
    transition: opacity .15s, border-color .15s, background .15s;
    white-space: nowrap !important;
    overflow: hidden !important;
}
.eccoci-theme-btn:hover {
    opacity: 1 !important;
    border-color: var(--border-strong, #342a33) !important;
    background: var(--surface3, #20242f) !important;
}
.eccoci-theme-btn.eccoci-theme-active {
    opacity: 1 !important;
    border-color: var(--accent-bd, rgba(239,68,68,.5)) !important;
    background: var(--accent-dim, rgba(239,68,68,.12)) !important;
}
.eccoci-theme-btn:focus-visible {
    outline: 2px solid var(--accent, #ef4444) !important;
    outline-offset: 2px !important;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .eccoci-age-grid { grid-template-columns: 1fr; gap: .75rem; }
    .eccoci-age-card { padding: 2rem 1.2rem 1.6rem; }
    .eccoci-age-btn { min-height: 64px; flex-direction: row; justify-content: flex-start; padding: .9rem 1.2rem; gap: .9rem; }
    .eccoci-age-btn .ico { font-size: 1.6em; }
    .eccoci-age-btn .lbl { display: none; }

    #eccoci-age-switcher { bottom: 4.2rem; right: .7rem; }
    .eccoci-theme-btn { width: 30px !important; height: 30px !important; font-size: 14px !important; }
}
