/* ==========================================================================
   whoisfra.it — Foglio di Stile v2 (Anteprima Architetturale)
   Struttura a contrasto calibrato (WCAG), switch tema live Crimson / Blue Team,
   e griglia a 4 pilastri per progetti B2B, Forensics, Territorio e R&D.
   ========================================================================== */

/* --- Font Locali (Montserrat & Fira Code) --- */
@font-face {
    font-family: 'Montserrat';
    src: url('fonts/Montserrat-VariableFont_wght.woff2') format('woff2'),
         url('fonts/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Code';
    src: url('fonts/FiraCode-VariableFont_wght.woff2') format('woff2'),
         url('fonts/FiraCode-VariableFont_wght.ttf') format('truetype');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   VARIABILI TEMA & PALETTE
   ========================================================================== */

:root {
    /* Superfici scure calibrate ad alta leggibilità e contrasto */
    --bg-base: #080a0f;
    --bg-elevated: #111624;
    --bg-card: rgba(11, 14, 24, 0.90);
    --bg-card-hover: rgba(16, 21, 35, 0.97);
    --bg-terminal: #0a0d15;

    /* Gerarchia testi ad alto contrasto (WCAG AA / AAA su rosso e blu scuro) */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #9fb0c7;

    /* Tema Predefinito: Cyber Crimson (Rosso Rubino calibrato + Indigo/Cyan) */
    --accent: #e63946;
    --accent-bright: #ff6b78;
    --accent-soft: rgba(230, 57, 70, 0.16);
    --accent-border: rgba(255, 92, 108, 0.42);
    --accent-glow: rgba(230, 57, 70, 0.28);

    --secondary: #6366f1;
    --secondary-soft: rgba(99, 102, 241, 0.16);
    --secondary-glow: rgba(56, 189, 248, 0.22);

    --hero-grad: linear-gradient(125deg, #ffffff 10%, #ff5c6a 50%, #6366f1 95%);

    --success: #4ade80;
    --error: #fda4af;
    --warning: #fbbf24;

    --border-subtle: rgba(148, 163, 184, 0.19);
    --border-strong: rgba(148, 163, 184, 0.32);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --font-sans: 'Montserrat', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, monospace;
    --transition: 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tema Alternativo: Blue Team / Trust (Attivabile dal selettore in alto) */
[data-theme="blueteam"] {
    --accent: #38bdf8;
    --accent-bright: #7dd3fc;
    --accent-soft: rgba(56, 189, 248, 0.14);
    --accent-border: rgba(56, 189, 248, 0.38);
    --accent-glow: rgba(56, 189, 248, 0.28);

    --secondary: #818cf8;
    --secondary-soft: rgba(129, 140, 248, 0.15);
    --secondary-glow: rgba(16, 185, 129, 0.20);

    --hero-grad: linear-gradient(125deg, #ffffff 10%, #38bdf8 52%, #818cf8 95%);
}

/* ==========================================================================
   RESET E BASE LAYOUT
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background-color: #16050b;
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: clip;
}

body {
    min-height: 100vh;
    background-color: #0a0914;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        radial-gradient(ellipse 95% 44% at 78% 0%, rgba(230, 57, 70, 0.34), transparent 74%),
        radial-gradient(ellipse 85% 40% at 16% 12%, rgba(190, 18, 60, 0.24), transparent 72%),
        radial-gradient(ellipse 90% 42% at 18% 100%, rgba(37, 99, 235, 0.30), transparent 72%),
        radial-gradient(ellipse 80% 36% at 86% 84%, rgba(56, 189, 248, 0.18), transparent 68%),
        linear-gradient(
            180deg,
            #2b0610 0%,
            #1d0813 18%,
            #120b1b 38%,
            #0b1024 60%,
            #07132c 80%,
            #040a1a 100%
        );
    background-size: 48px 48px, 48px 48px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: clip;
    transition: background 0.4s ease;
}

.container {
    width: 92%;
    max-width: 1180px;
    margin: 0 auto;
}

/* ==========================================================================
   BARRA ANTEPRIMA v2 (Switch Palette & Ritorno a v1)
   ========================================================================== */

.v2-preview-bar {
    background: rgba(15, 19, 29, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.v2-preview-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.v2-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.v2-pill-badge {
    background: var(--accent-soft);
    color: var(--accent-bright);
    border: 1px solid var(--accent-border);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.v2-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-switcher {
    display: inline-flex;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
}

.theme-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.73rem;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.theme-btn.active {
    background: var(--accent-soft);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--accent-border);
}

.swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.swatch-crimson { background: #e63946; }
.swatch-blue { background: #38bdf8; }

.v1-back-link {
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: 6px;
    transition: var(--transition);
}

.v1-back-link:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* ==========================================================================
   HEADER E NAVIGAZIONE STICKY
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 10, 15, 0.84);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 16px;
}

.brand-link {
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand-dot {
    color: var(--accent-bright);
    transition: color 0.3s ease;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color var(--transition);
    white-space: nowrap;
}

.nav-menu a:hover {
    color: var(--text-primary);
}

.nav-ctf-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-bright) !important;
    font-family: var(--font-mono);
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    transition: all var(--transition) !important;
}

.nav-ctf-pill:hover {
    background: var(--accent);
    color: #ffffff !important;
    box-shadow: 0 0 18px var(--accent-glow);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1.4rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ==========================================================================
   SEZIONE HERO (Posizionamento Tecnico + Ritratto Studio Rim-Lit)
   ========================================================================== */

.hero-section {
    padding: 108px 0 96px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.28fr 0.82fr;
    gap: 56px;
    align-items: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(16, 20, 30, 0.9);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulseRing 2.2s infinite;
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-bright);
    margin-bottom: 10px;
}

.hero-title {
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.03;
    letter-spacing: -0.03em;
    background-image: var(--hero-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.1rem;
    line-height: 1.68;
    color: var(--text-secondary);
    max-width: 610px;
    margin-bottom: 28px;
}

.hero-subtitle strong {
    color: var(--text-primary);
    font-weight: 600;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

/* Pulsanti Riutilizzabili */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.94rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

.btn-primary {
    background: #d62839;
    color: #ffffff;
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:hover {
    background: #b91c2c;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    border-color: var(--accent-border);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.btn-ghost {
    background: rgba(11, 14, 24, 0.48);
    color: var(--text-primary);
    border-color: var(--border-strong);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.btn-ghost:hover {
    color: #ffffff;
    background: rgba(16, 21, 35, 0.8);
    border-color: var(--accent-border);
}

/* Attestazioni Verificabili sotto le CTA */
.hero-credentials {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding-top: 22px;
    border-top: 1px solid var(--border-subtle);
    max-width: 640px;
}

.cred-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cred-title {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cred-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Colonna Ritratto Studio Rim-Lit (confrontabile con la foto v1 originale) */
.hero-portrait-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.portrait-card {
    position: relative;
    width: 100%;
    max-width: 390px;
    aspect-ratio: 1 / 1.06;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 75% 25%, var(--accent-glow), transparent 55%),
        radial-gradient(circle at 20% 70%, var(--secondary-glow), transparent 55%),
        linear-gradient(180deg, #131826 0%, #090b10 100%);
    border: 1px solid var(--border-strong);
    overflow: hidden;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.55),
        0 0 40px var(--accent-soft);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: all 0.4s ease;
}

.portrait-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 1;
}

.portrait-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 36%;
    background: linear-gradient(to top, rgba(8, 10, 15, 0.96) 15%, transparent);
    z-index: 3;
    pointer-events: none;
}

.portrait-card picture {
    display: contents;
}

.portrait-img {
    position: relative;
    z-index: 2;
    width: 92%;
    height: 92%;
    object-fit: cover;
    object-position: center top;
    filter: drop-shadow(-8px 0 18px var(--secondary-glow)) drop-shadow(8px 0 18px var(--accent-glow));
    transition: opacity 0.3s ease, transform 0.4s ease, filter 0.3s ease;
}

/* Stato Ritratto Originale v1 integrato nella card v2 */
.portrait-card.mode-v1 {
    align-items: center;
    aspect-ratio: 1 / 1;
}

.portrait-card.mode-v1 .portrait-img {
    width: 82%;
    height: 82%;
    margin-bottom: 24px;
    object-fit: contain;
    filter: drop-shadow(0 0 28px var(--accent-glow));
}

.portrait-caption {
    position: absolute;
    bottom: 14px;
    left: 16px;
    right: 16px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.79rem;
    color: var(--text-secondary);
}

.portrait-caption-accent {
    color: var(--accent-bright);
    font-weight: 600;
}

.portrait-compare-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 5px 12px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.portrait-compare-toggle:hover {
    border-color: var(--accent-border);
    color: var(--text-primary);
}

/* ==========================================================================
   STRUTTURA COMUNE SEZIONI
   ========================================================================== */

.section {
    padding: 96px 0;
}

.section-header {
    margin-bottom: 42px;
}

.section-kicker {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--accent-bright);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
}

.section-title {
    font-size: clamp(1.8rem, 3.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    cursor: pointer;
}

.section-desc {
    color: var(--text-secondary);
    max-width: 680px;
    margin-top: 8px;
    font-size: 1.04rem;
    line-height: 1.68;
}

/* ==========================================================================
   SEZIONE 01: TERMINALE LINUX INTERATTIVO (Chi Sono)
   ========================================================================== */

.terminal-window {
    background: var(--bg-terminal);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.terminal-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.window-dots {
    display: flex;
    gap: 7px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #22c55e; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Finestra Terminale Linux / GNOME Terminal + tmux */
.linux-terminal-window {
    position: relative;
    background: #0b0d11;
    border: 1px solid #2b303b;
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.linux-titlebar {
    background: #232730;
    border-bottom: 1px solid #16181f;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
}

.linux-title-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: #9ca3af;
}

.linux-term-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 18px;
    border-radius: 3px;
    background: #14171d;
    border: 1px solid #353b48;
    color: #4ade80;
    font-size: 0.68rem;
    font-weight: 700;
}

.linux-title-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.linux-win-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.linux-win-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: #2d323e;
    border: 1px solid #39404f;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.linux-win-btn.close {
    background: rgba(230, 57, 70, 0.16);
    border-color: rgba(230, 57, 70, 0.35);
    color: #fca5a5;
}

.linux-menubar {
    background: #1a1d24;
    border-bottom: 1px solid #12141a;
    padding: 6px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: #cbd5e1;
    user-select: none;
}

.linux-menubar span:hover {
    color: #f3f4f6;
}

.terminal-body {
    --term-zoom: 1;
    padding: 20px 22px;
    height: 390px;
    min-height: 390px;
    max-height: 390px;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-anchor: none;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    background: #0b0d11;
    font-family: var(--font-mono);
    font-size: calc(0.93rem * var(--term-zoom));
    line-height: 1.65;
    color: #f1f5f9;
    scrollbar-width: thin;
    scrollbar-color: #30363d #0b0d11;
}

.terminal-body::-webkit-scrollbar,
.apt-log::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.terminal-body::-webkit-scrollbar-track,
.apt-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb,
.apt-log::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover,
.apt-log::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

#terminal-output {
    min-width: 100%;
}

.t-user { color: #4ade80; font-weight: 700; }
.t-sep { color: #e5e7eb; }
.t-dir { color: #60a5fa; font-weight: 600; }
.t-sig { color: #e5e7eb; margin-right: 6px; }
.t-info { color: #67e8f9; }
.t-warn { color: #fcd34d; }
.t-dim { color: #9fb0c7; }

.terminal-prompt {
    font-weight: 600;
    flex-shrink: 0;
}

.terminal-ok { color: #4ade80; }
.terminal-err { color: #fca5a5; }
.terminal-muted { color: #cbd5e1; }

.input-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    white-space: nowrap;
    min-width: max-content;
    width: 100%;
}

.terminal-input {
    flex: 1 0 18ch;
    min-width: 18ch;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    caret-color: #4ade80;
    font-family: var(--font-mono);
    font-size: inherit;
}

.command-echo {
    margin-top: 8px;
    color: #f8fafc;
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
}

.response {
    margin: 4px 0 10px 0;
    color: #e2e8f0;
}

.linux-tmux-bar {
    background: #143d2b;
    border-top: 1px solid #1f5c41;
    padding: 7px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #ecfdf5;
    width: 100%;
    min-width: 0;
}

.tmux-status-head {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tmux-session {
    font-weight: 700;
    color: #6ee7b7;
    white-space: nowrap;
}

.term-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(11, 13, 17, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    padding: 2px;
    flex-shrink: 0;
}

.term-zoom-btn {
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 26px;
    height: 24px;
    padding: 0 6px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.term-zoom-btn:hover:not(:disabled) {
    background: rgba(110, 231, 183, 0.18);
    color: #ffffff;
}

.term-zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.term-zoom-reset {
    min-width: 46px;
    color: #cbd5e1;
    font-size: 0.76rem;
}

.term-zoom-toast {
    position: absolute;
    top: 78px;
    right: 18px;
    z-index: 6;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(110, 231, 183, 0.45);
    color: #ecfdf5;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.apt-terminal .term-zoom-toast {
    top: 56px;
    border-color: var(--accent-border);
}

.term-zoom-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.tmux-cmds {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.tmux-cmd-btn {
    background: rgba(11, 13, 17, 0.55);
    border: 1px solid rgba(110, 231, 183, 0.35);
    color: #ecfdf5;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 3px 9px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tmux-cmd-btn:hover {
    background: #4ade80;
    color: #062817;
    border-color: #4ade80;
}

/* ==========================================================================
   SEZIONE 02: ARCHITETTURE & PROGETTI (Sticky Scrollytelling 4 Pilastri)
   ========================================================================== */

.projects-scroll-section {
    padding: 88px 0 96px;
}

.areas-scroll-track {
    position: relative;
    min-height: 440vh;
}

.areas-sticky-viewport {
    position: sticky;
    top: 92px;
    height: calc(100vh - 102px);
    min-height: 620px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.projects-header-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex-shrink: 0;
}

.areas-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tab {
    background: rgba(11, 14, 24, 0.92);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.83rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.filter-tab.active {
    background: var(--accent-soft);
    color: var(--accent-bright);
    border-color: var(--accent-border);
    box-shadow: 0 0 14px var(--accent-soft);
}

.areas-progress-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.areas-progress-bar {
    width: 110px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.areas-progress-fill {
    height: 100%;
    width: 25%;
    background: linear-gradient(90deg, var(--secondary), var(--accent-bright));
    transition: width 0.12s linear;
}

.areas-deck-stage {
    position: relative;
    flex: 1;
    min-height: 410px;
    perspective: 1200px;
}

.areas-deck-stage .project-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 100%;
    overflow-y: auto;
    background: rgba(13, 17, 27, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    will-change: transform, opacity;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.areas-deck-stage .project-card.is-front {
    border-color: var(--accent-border);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.55), 0 0 28px var(--accent-soft);
}

.areas-deck-stage .project-card:hover {
    transform: none;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-border);
    background: var(--bg-card-hover);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 24px var(--accent-soft);
}

.project-card.hidden-card {
    display: none;
}

/* Card Ammiraglia (es. Panopticon) a tutta larghezza su desktop */
.project-card.featured-full {
    grid-column: span 2;
    border-color: var(--accent-border);
    background:
        radial-gradient(circle at 95% 10%, var(--accent-soft), transparent 45%),
        var(--bg-card);
}

.project-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.project-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-bright);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.project-pillar-badge {
    font-family: var(--font-mono);
    font-size: 0.79rem;
    color: var(--accent-bright);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 4px 11px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.project-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.project-subtitle {
    font-family: var(--font-mono);
    font-size: 0.87rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.project-card p {
    font-size: 0.96rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

/* Lista specifiche chiave nei progetti */
.spec-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.spec-list li {
    position: relative;
    padding-left: 16px;
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.54;
}

.spec-list li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: var(--accent-bright);
    font-weight: 700;
}

.spec-list li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Blocco espandibile per specifiche architetturali profonde senza appesantire la lettura */
.arch-details {
    background: rgba(8, 10, 15, 0.72);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 12px;
}

.arch-details summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.arch-details summary::-webkit-details-marker {
    display: none;
}

.arch-details summary::after {
    content: "+ Espandi";
    color: var(--accent-bright);
    font-size: 0.8rem;
}

.arch-details[open] summary::after {
    content: "− Chiudi";
}

.arch-details-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.sub-module h4 {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--accent-bright);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.sub-module p {
    font-size: 0.88rem;
    margin-bottom: 0;
    color: var(--text-secondary);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 0.79rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: 5px;
}

.project-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.project-target {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-bright);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    transition: gap var(--transition), color var(--transition);
}

.project-link:hover {
    gap: 10px;
    color: var(--text-primary);
}

/* Strip per i Tool Pubblici già attivi su whoisfra.it */
.utility-strip {
    margin-top: 56px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px 24px;
}

.utility-strip-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.utility-strip-head h3 {
    font-size: 1.06rem;
    color: var(--text-primary);
}

.utility-strip-head span {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.utility-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.utility-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    transition: var(--transition);
}

.utility-item:hover {
    border-color: var(--accent-border);
    transform: translateY(-2px);
}

.utility-item strong {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-primary);
}

.utility-item span {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   SEZIONE 03: CERTIFICAZIONI REALI & STACK TECNICO
   (Transizione cromatica inferiore: accenti Blu/Ciano + CTA/stati Arancioni)
   ========================================================================== */

#competenze,
#curriculum,
#contatti,
.site-footer,
.cookie-banner {
    --accent: #38bdf8;
    --accent-bright: #7dd3fc;
    --accent-soft: rgba(56, 189, 248, 0.16);
    --accent-border: rgba(56, 189, 248, 0.42);
    --accent-glow: rgba(56, 189, 248, 0.28);
    --success: #fb923c;
    --error: #fcd34d;

    --lower-orange: #f97316;
    --lower-orange-bright: #fb923c;
    --lower-orange-soft: rgba(249, 115, 22, 0.15);
    --lower-orange-border: rgba(251, 146, 60, 0.45);
    --lower-orange-glow: rgba(249, 115, 22, 0.30);
    --lower-orange-text: #ffedd5;
}

#competenze .btn-primary,
#curriculum .btn-primary,
#contatti .btn-primary,
.site-footer .btn-primary,
#accept-cookies-btn {
    background: var(--lower-orange);
    border-color: var(--lower-orange);
    color: #080a0f;
    font-weight: 700;
    box-shadow: 0 6px 24px var(--lower-orange-glow);
}

#competenze .btn-primary:hover,
#curriculum .btn-primary:hover,
#contatti .btn-primary:hover,
.site-footer .btn-primary:hover,
#accept-cookies-btn:hover {
    background: var(--lower-orange-bright);
    border-color: var(--lower-orange-bright);
    color: #080a0f;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--lower-orange-glow);
}

#curriculum .terminal-ok,
#contatti .terminal-ok {
    color: var(--lower-orange-bright);
    font-weight: 600;
}

.certs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.cert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cert-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-bright);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.cert-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.cert-card p {
    font-size: 0.93rem;
    line-height: 1.58;
    color: var(--text-secondary);
}

.cert-card a {
    color: var(--accent-bright);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-top: 4px;
    display: inline-block;
}

.cert-card a:hover {
    text-decoration: underline;
}

.skills-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.skill-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px;
}

.skill-panel h3 {
    font-size: 1.08rem;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.skill-panel h3 span.accent-bar {
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--accent);
    display: inline-block;
}

.skill-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-pill {
    font-family: var(--font-mono);
    font-size: 0.83rem;
    padding: 6px 11px;
    border-radius: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.skill-pill.highlight {
    border-color: var(--accent-border);
    color: var(--text-primary);
    background: var(--accent-soft);
}

/* ==========================================================================
   SEZIONE 04: CURRICULUM (`apt upgrade`)
   ========================================================================== */

.apt-terminal {
    position: relative;
    background: var(--bg-terminal);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 25px var(--accent-soft);
    overflow: hidden;
}

.apt-terminal-header {
    flex-wrap: wrap;
    gap: 10px 12px;
}

.apt-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.apt-title-wrap .terminal-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apt-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.apt-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.92rem;
}

.apt-log {
    --term-zoom: 1;
    height: 270px;
    min-height: 270px;
    max-height: 270px;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-anchor: none;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    font-size: calc(0.92rem * var(--term-zoom));
    margin-bottom: 16px;
    padding-bottom: 6px;
    line-height: 1.7;
    color: var(--text-secondary);
    scrollbar-width: thin;
    scrollbar-color: #30363d #0b0d11;
}

.apt-log p {
    margin: 0 0 4px 0;
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
}

.apt-log p.done { color: var(--text-primary); }
.apt-log p.err { color: var(--error); }

.progress-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: 8px;
}

.progress-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--lower-orange, #f97316));
    transition: width 0.35s ease;
}

.speed-readout {
    font-size: 0.86rem;
    color: var(--accent-bright);
    min-width: 90px;
    text-align: right;
}

.apt-cta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   SEZIONE 05: CONTATTI OSINT-SAFE (CMD + Form Rapido)
   ========================================================================== */

.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.cmd-card,
.contact-form-card {
    min-width: 0;
}

.cmd-card {
    background: var(--bg-terminal);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cmd-body {
    padding: 22px;
    font-family: var(--font-mono);
    font-size: 0.94rem;
    display: flex;
    flex-direction: column;
    gap: 13px;
    flex: 1;
    min-width: 0;
}

.cmd-line {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.cmd-key {
    color: var(--accent-bright);
    white-space: nowrap;
}

.cmd-val {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.cmd-val a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--border-strong);
    transition: color var(--transition), border-color var(--transition);
}

.cmd-val a:hover {
    color: var(--accent-bright);
    border-bottom-color: var(--accent-bright);
}

.copy-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.79rem;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    color: #ffffff;
    border-color: var(--accent-border);
}

.osint-note {
    margin-top: auto;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--lower-orange-soft, rgba(249, 115, 22, 0.15));
    border: 1px solid var(--lower-orange-border, rgba(251, 146, 60, 0.45));
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--lower-orange-text, #ffedd5);
}

.osint-note strong {
    color: var(--lower-orange-bright, #fb923c);
}

.contact-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
}

.contact-form-card h3 {
    font-size: 1.16rem;
    margin-bottom: 6px;
}

.contact-form-card p {
    font-size: 0.94rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-terminal);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-feedback {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--success);
    display: none;
}

/* ==========================================================================
   FOOTER & BANNER COOKIE
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 32px 0 40px;
    margin-top: 48px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin-top: 10px;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.site-footer a:hover {
    color: var(--accent-bright);
}

.footer-legal {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.footer-legal a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent-border);
}

.cookie-banner {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92%, 780px);
    background: rgba(11, 14, 24, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 999;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.cookie-banner a {
    color: var(--accent-bright);
}

.cookie-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-buttons button {
    padding: 9px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
}

#accept-cookies-btn {
    background: var(--lower-orange, #f97316);
    border-color: var(--lower-orange, #f97316);
    color: #080a0f;
    font-weight: 700;
}

#accept-cookies-btn:hover {
    background: var(--lower-orange-bright, #fb923c);
    border-color: var(--lower-orange-bright, #fb923c);
}

/* ==========================================================================
   MEDIA QUERIES (Tablet & Mobile Responsive)
   ========================================================================== */

@media (max-width: 980px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .hero-portrait-col {
        order: -1;
    }

    .portrait-card {
        max-width: 320px;
    }

    .projects-grid,
    .certs-grid,
    .skills-layout,
    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .project-card.featured-full {
        grid-column: span 1;
    }

    .utility-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Su tablet/mobile lo scrollytelling torna una pila chiara e scorrevole senza tagli verticali */
    .areas-scroll-track {
        min-height: auto;
    }

    .areas-sticky-viewport {
        position: static;
        height: auto;
        min-height: auto;
    }

    .projects-header-row {
        position: sticky;
        top: 70px;
        z-index: 20;
        background: rgba(16, 12, 22, 0.9);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 12px 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .areas-progress-meta {
        display: none;
    }

    .areas-deck-stage {
        min-height: auto;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .areas-deck-stage .project-card {
        position: sticky;
        top: 170px;
        max-height: none;
        overflow-y: visible;
        transition: transform 0.35s ease, opacity 0.35s ease, border-color 0.25s ease;
    }
}

@media (min-width: 961px) and (max-height: 820px) {
    .areas-sticky-viewport {
        top: 76px;
        height: calc(100vh - 84px);
        min-height: 0;
        gap: 10px;
    }

    .projects-header-row {
        gap: 8px;
    }

    #progetti .section-head,
    #progetti .section-head-compact {
        margin-bottom: 0;
    }

    #progetti .section-desc {
        display: none;
    }

    .areas-deck-stage .project-card {
        padding: 18px 24px;
        gap: 12px;
    }

    .areas-deck-stage .project-top {
        margin-bottom: 6px;
    }
}

@media (max-width: 640px) {
    .section {
        padding: 68px 0;
    }

    .cmd-body {
        padding: 16px;
        font-size: 0.86rem;
    }

    .cmd-line {
        grid-template-columns: 76px minmax(0, 1fr) auto;
    }

    .areas-deck-stage .project-card {
        position: static;
        top: auto;
        left: auto;
        right: auto;
    }

    .projects-header-row {
        position: static;
        background: transparent;
        backdrop-filter: none;
        padding: 0;
        border-bottom: none;
    }
}

@media (max-width: 1080px) {
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 8px 10px;
    }

    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(8, 10, 15, 0.985);
        backdrop-filter: blur(16px);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 0 18px;
        max-height: 0;
        overflow: hidden;
        border-bottom: 1px solid transparent;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .nav-menu.show {
        max-height: calc(100dvh - 70px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 14px 18px calc(22px + env(safe-area-inset-bottom));
        border-bottom-color: var(--border-subtle);
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
        padding: 10px 16px;
        border-radius: 10px;
    }

    .nav-menu .nav-ctf-pill {
        width: 100%;
        min-height: 46px;
        justify-content: center;
        margin-top: 6px;
    }
}

@media (max-width: 640px) {
    .v2-preview-bar {
        padding: 8px 12px;
        font-size: 0.72rem;
    }

    .v2-tag span:last-child {
        display: none;
    }

    .hero-section {
        padding: 48px 0 64px;
    }

    .hero-grid {
        gap: 30px;
    }

    .portrait-card {
        max-width: 256px;
    }

    .portrait-caption {
        font-size: 0.72rem;
        white-space: normal;
        text-align: center;
        left: 10px;
        right: 10px;
        justify-content: center;
    }

    .portrait-caption-accent {
        display: none;
    }

    .hero-credentials,
    .utility-links {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cookie-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================================================
   PAGINE INTERNE / SUBPAGES v2 (Policy, Blog, Galleria, Script, CTF Lv.1)
   ========================================================================== */

.nav-menu a.active {
    color: var(--text-primary);
    box-shadow: inset 0 -2px 0 var(--accent);
    padding-bottom: 4px;
}

.subpage-main {
    padding: 40px 0 72px;
    min-height: calc(100vh - 210px);
}

.subpage-hero {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.breadcrumb-trail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.breadcrumb-trail a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb-trail a:hover {
    color: var(--accent-bright);
}

.subpage-hero h1 {
    font-size: clamp(1.85rem, 3.8vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    background: var(--hero-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subpage-hero .lead {
    color: var(--text-secondary);
    max-width: 740px;
    font-size: 1.04rem;
    line-height: 1.65;
}

.subpage-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.subpage-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    padding: 5px 13px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.subpage-badge.accent {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent-bright);
}

.subpage-badge.ok {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(74, 222, 128, 0.4);
    color: var(--success);
}

/* --- Privacy Policy & Cookie Policy --- */
.policy-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 36px;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.32);
}

.policy-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--accent-bright);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 6px 13px;
    border-radius: 999px;
    margin-bottom: 20px;
}

.policy-card h2 {
    font-size: 1.32rem;
    color: var(--text-primary);
    margin: 28px 0 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.policy-card h2:first-of-type {
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
}

.policy-card h3 {
    font-family: var(--font-mono);
    font-size: 0.98rem;
    color: var(--accent-bright);
    margin: 18px 0 8px;
}

.policy-card p,
.policy-card li {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.74;
}

.policy-card p + p {
    margin-top: 10px;
}

.policy-card ul {
    margin: 10px 0 14px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.policy-card strong {
    color: var(--text-primary);
}

.policy-card a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.policy-contact-wrap {
    margin-top: 32px;
}

/* --- Blog v2 (Compatibile con blog_script.js) --- */
.blog-feed-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.blog-post-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 28px;
    transition: border-color var(--transition), transform var(--transition);
}

.blog-post-item:hover {
    border-color: var(--accent-border);
    transform: translateY(-2px);
}

.blog-post-item h3,
.blog-post-item > a {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
    display: inline-block;
    text-decoration: none;
    transition: color var(--transition);
}

.blog-post-item > a:hover {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.blog-post-metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.blog-post-metadata:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.blog-post-metadata .file-icon {
    color: var(--accent-bright);
    font-weight: 600;
}

.blog-post-item p {
    color: var(--text-secondary);
    font-size: 1.02rem;
    line-height: 1.74;
}

.blog-post-item img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    margin-top: 14px;
}

.blog-post-item img.file-icon {
    width: 18px;
    height: 18px;
    margin-top: 0;
    border: none;
    border-radius: 0;
    object-fit: contain;
    flex-shrink: 0;
}

/* --- Galleria File Explorer v2 (Compatibile con script_pag.js & gallery_data.js) --- */
body.avvio {
    opacity: 1;
}

body.gallery-page {
    background-image: none;
    background-color: var(--bg-base);
}

.gallery-backdrop-main {
    position: relative;
    min-height: calc(100dvh - 71px);
    overflow: hidden;
    padding: 0;
    background-image:
        linear-gradient(rgba(8, 10, 15, 0.34), rgba(8, 10, 15, 0.56)),
        url("img/Galleria/Fotografia/Monte%20Cucco/Boschi-Paesaggi/Sant%27Agnese%20(1).jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gallery-stage {
    position: relative;
    width: 100%;
    height: calc(100dvh - 71px);
    min-height: 540px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.explorer-window {
    position: relative;
    width: min(880px, calc(100% - 48px));
    height: min(560px, calc(100% - 48px));
    background: rgba(10, 13, 20, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

.explorer-window.dragging {
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent-border);
}

.explorer-window.maximized-window {
    position: fixed !important;
    left: 0 !important;
    z-index: 250 !important;
    border-radius: 0;
}

.explorer-window.minimized-window {
    height: auto !important;
    min-height: 0 !important;
}

.explorer-window.minimized-window .address-bar,
.explorer-window.minimized-window .main-area,
.explorer-window.minimized-window .status-bar {
    display: none;
}

.explorer-reopen-btn {
    padding: 12px 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-border);
    background: rgba(10, 13, 20, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
    transition: all var(--transition);
}

.explorer-reopen-btn:hover {
    border-color: var(--accent-bright);
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.title-bar {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: grab;
}

.title-bar:active {
    cursor: grabbing;
}

.title-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.title-text {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-btn {
    width: 28px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.control-btn.close:hover {
    background: var(--accent);
    border-color: var(--accent-bright);
    color: #ffffff;
}

.address-bar {
    background: rgba(15, 19, 29, 0.92);
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.86rem;
    cursor: pointer;
    transition: all var(--transition);
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--accent-border);
    color: var(--accent-bright);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.path-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.86rem;
    outline: none;
}

.main-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 16px;
    background:
        radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 45%),
        var(--bg-terminal);
}

.icon {
    width: 116px;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.icon:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    transform: translateY(-2px);
}

.icon img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    pointer-events: none;
}

.icon span {
    font-size: 0.86rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.35;
}

.status-bar {
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid var(--border-subtle);
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text-secondary);
}

/* Visualizzatore Foto Modale (Galleria) */
.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(5, 7, 11, 0.86);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content.photo-viewer-window {
    position: relative;
    width: min(920px, 95vw);
    height: min(640px, 88vh);
    background: var(--bg-terminal);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.photo-area {
    flex: 1;
    overflow: hidden;
    background: #040508;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    user-select: none;
}

.photo-controls {
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-subtle);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.photo-controls button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
}

.photo-controls button:hover:not(:disabled) {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.photo-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* --- Strumenti Locali / Privacy-First (unfollowers.html & rag_pers.html) --- */
.tool-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.32);
}

.tool-panel + .tool-panel {
    margin-top: 24px;
}

.privacy-notice-banner {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.privacy-notice-banner .pn-icon {
    color: var(--success);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.3;
}

.privacy-notice-banner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.privacy-notice-banner strong {
    color: var(--text-primary);
}

.steps-panel {
    background: var(--bg-terminal);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin-bottom: 24px;
}

.steps-panel h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.steps-panel ol {
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.steps-panel code {
    font-family: var(--font-mono);
    font-size: 0.84em;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-bright);
}

.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 46px 24px;
    text-align: center;
    background: var(--bg-terminal);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-bright);
    background: var(--accent-soft);
}

.drop-icon {
    color: var(--accent-bright);
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.spinner {
    display: none;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    border-top-color: var(--accent-bright);
    animation: spin-v2 0.85s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin-v2 {
    to { transform: rotate(360deg); }
}

.status-log-line {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 14px;
    min-height: 22px;
}

.stats-grid {
    display: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: var(--bg-terminal);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
}

.stat-val,
.stat-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-val.diff,
.stat-number.diff {
    color: var(--accent-bright);
}

.stat-label {
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.results-area,
#results-area {
    display: none;
    margin-top: 24px;
    background: var(--bg-terminal);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.results-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-list {
    list-style: none;
    max-height: 480px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition);
}

.user-item:last-child {
    border-bottom: none;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.user-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.user-action {
    color: var(--accent-bright);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    transition: all var(--transition);
    white-space: nowrap;
}

.user-action:hover {
    background: var(--accent);
    color: #ffffff;
}

/* --- CTF Livello 1 (ctf-facile.html) --- */
.ctf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.ctf-step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ctf-step-card.full-span {
    grid-column: span 2;
}

.ctf-step-title {
    font-family: var(--font-mono);
    font-size: 1.06rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctf-step-num {
    font-size: 0.82rem;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-bright);
}

.ctf-step-card p {
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.68;
}

.ctf-code-box {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-bright);
    background: var(--bg-terminal);
    border: 1px dashed var(--accent-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    word-break: break-all;
}

.decoder-input-group,
.flag-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.decoder-input-group input,
.flag-form input {
    flex: 1;
    min-width: 0;
}

.ctf-decoded-output {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-terminal);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    word-break: break-all;
}

.feedback-msg {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 600;
    min-height: 22px;
}

.feedback-msg.error { color: var(--error); }
.feedback-msg.success { color: var(--success); }

.hard-mode-banner {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--secondary);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ctf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(5, 7, 11, 0.86);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ctf-modal-card {
    background: var(--bg-elevated);
    border: 1px solid var(--success);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

.ctf-modal-card h2 {
    font-size: 1.55rem;
    color: var(--success);
    margin-bottom: 10px;
}

.ctf-modal-card p {
    color: var(--text-secondary);
    font-size: 0.94rem;
    margin-bottom: 22px;
}

.modal-btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* --- Responsive Subpages --- */
@media (max-width: 820px) {
    .ctf-grid {
        grid-template-columns: 1fr;
    }

    .ctf-step-card.full-span {
        grid-column: span 1;
    }

    .gallery-backdrop-main {
        padding: 16px 12px;
        align-items: stretch;
    }

    .gallery-stage {
        height: calc(100dvh - 102px);
        min-height: 460px;
        max-height: 760px;
        padding: 0;
    }

    .explorer-window:not(.maximized-window) {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: 100% !important;
    }

    .explorer-window .title-bar {
        cursor: default;
        padding: 10px 12px;
    }

    .explorer-window .window-controls .minimize,
    .explorer-window .window-controls .close {
        display: none;
    }

    .control-btn {
        min-width: 38px;
        min-height: 36px;
        font-size: 0.9rem;
    }

    .address-bar {
        padding: 10px 12px;
        gap: 8px;
    }

    .address-bar .back-btn,
    .address-bar .forward-btn {
        display: none;
    }

    .address-bar .up-btn {
        min-width: 44px;
        min-height: 42px;
        font-size: 1.05rem;
        border-color: var(--accent-border);
        background: var(--accent-soft);
        color: var(--accent-bright);
    }

    .address-bar .up-btn:disabled {
        border-color: var(--border-subtle);
        background: var(--bg-card);
        color: var(--text-muted);
    }

    .path-input {
        min-height: 42px;
        font-size: 0.84rem;
        padding: 8px 12px;
        color: var(--text-primary);
    }

    .main-area {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-content: start;
        gap: 12px;
        padding: 14px;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .icon {
        width: 100%;
        min-height: 98px;
        padding: 12px 6px;
        justify-content: flex-start;
    }

    .icon:active {
        transform: scale(0.96);
        background: var(--accent-soft);
        border-color: var(--accent-border);
    }

    /* Visualizzatore Foto full-screen comodo su smartphone/tablet */
    .modal {
        padding: 0;
    }

    .modal-content.photo-viewer-window {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }

    .photo-title-bar {
        min-height: 52px;
        padding: 8px 12px;
    }

    #close-modal-btn {
        min-width: 44px;
        min-height: 40px;
        font-size: 1rem;
    }

    .photo-area {
        touch-action: none;
    }

    .photo-controls {
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
        gap: 10px;
    }

    .photo-controls button {
        flex: 1;
        min-height: 46px;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .subpage-main {
        padding: 24px 0 48px;
    }

    .policy-card,
    .tool-panel,
    .blog-post-item,
    .ctf-step-card {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .decoder-input-group,
    .flag-form {
        flex-direction: column;
    }

    .gallery-backdrop-main {
        padding: 10px;
    }

    .gallery-stage {
        height: calc(100dvh - 90px);
        min-height: 440px;
    }

    .main-area {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        padding: 12px;
    }

    .icon {
        width: 100%;
        min-height: 92px;
        padding: 10px 6px;
    }

    .icon img {
        width: 46px;
        height: 46px;
    }

    .icon span {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width: 350px) {
    .main-area {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   OTTIMIZZAZIONE MOBILE & TABLET COMPLETA (DESKTOP > 1080px INVARIATO)
   ========================================================================== */
@media (max-width: 820px) {
    /* Previene auto-zoom iOS/Android su input, terminale e barra percorso Galleria */
    .form-control,
    .terminal-input,
    .path-input,
    #file-input,
    input[type="text"],
    input[type="email"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }

    .explorer-window .title-bar .control-btn.maximize {
        min-width: 42px;
        min-height: 40px;
    }

    .explorer-window .up-btn {
        min-width: 44px;
        min-height: 42px;
    }

    .photo-controls {
        gap: 10px;
    }

    .photo-controls button,
    #prev-photo-btn,
    #next-photo-btn,
    #close-modal-btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 0.92rem;
    }
}

@media (max-width: 640px) {
    /* Hero più equilibrata sul primo schermo mobile */
    .hero-section {
        padding: 26px 0 56px;
    }

    .hero-grid {
        gap: 22px;
    }

    .portrait-card {
        max-width: 212px;
    }

    .portrait-caption {
        font-size: 12px;
        padding: 10px 12px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
        min-height: 46px;
        padding: 12px 18px;
        justify-content: center;
    }

    /* Terminale Linux (#chisono): nasconde menu desktop e migliora input/tmux per touch */
    .linux-menubar {
        display: none;
    }

    .terminal-body {
        height: 330px;
        min-height: 330px;
        max-height: 330px;
        padding: 14px 12px;
        font-size: calc(0.88rem * var(--term-zoom, 1));
        line-height: 1.55;
    }

    #terminal-output {
        min-width: 58ch;
    }

    .terminal-input {
        font-size: calc(16px * var(--term-zoom, 1));
        flex: 1 0 18ch;
        min-width: 18ch;
        min-height: 30px;
    }

    .linux-tmux-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
        width: 100%;
        min-width: 0;
    }

    .tmux-status-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    .tmux-cmds {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(110, 231, 183, 0.45) rgba(0, 0, 0, 0.25);
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding-bottom: 6px;
    }

    .tmux-cmds::-webkit-scrollbar {
        display: block;
        height: 4px;
    }

    .tmux-cmds::-webkit-scrollbar-thumb {
        background: rgba(110, 231, 183, 0.45);
        border-radius: 999px;
    }

    .term-zoom-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0 8px;
        font-size: 0.85rem;
    }

    .term-zoom-reset {
        min-width: 52px;
    }

    .term-zoom-toast {
        top: 58px;
        right: 12px;
    }

    .apt-terminal .term-zoom-toast {
        top: 106px;
    }

    .apt-terminal-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .apt-title-wrap {
        flex: 1 1 100%;
        gap: 10px;
    }

    .apt-title-wrap .terminal-title {
        font-size: 0.8rem;
    }

    .apt-header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .apt-body {
        padding: 14px 12px;
    }

    .apt-log {
        height: 240px;
        min-height: 240px;
        max-height: 240px;
        font-size: calc(0.88rem * var(--term-zoom, 1));
        line-height: 1.62;
        margin-bottom: 12px;
    }

    .progress-row {
        gap: 10px;
        padding: 8px 10px;
    }

    .speed-readout {
        font-size: 0.82rem;
        min-width: 78px;
    }

    .tmux-cmd-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 40px;
        min-width: 52px;
        padding: 8px 13px;
        font-size: 0.85rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Sezione 02 Aree: tab scorrevoli orizzontalmente per risparmiare spazio verticale */
    .filter-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        padding: 2px 0 6px;
        margin-bottom: 8px;
    }

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 42px;
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    .project-card {
        padding: 20px 16px;
    }

    .project-footer {
        flex-wrap: wrap;
        gap: 12px;
    }

    .project-footer .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    /* Certificazioni, barra CTA CV & Contatti */
    .cert-meta {
        flex-wrap: wrap;
        gap: 4px 10px;
    }

    .apt-cta-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .apt-cta-bar .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .cmd-card {
        padding: 18px 14px;
    }

    .cmd-line {
        flex-wrap: wrap;
        gap: 6px 10px;
        align-items: center;
    }

    .copy-btn {
        min-height: 40px;
        min-width: 58px;
        padding: 8px 10px;
        font-size: 0.84rem;
        white-space: nowrap;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    #contact-form button[type="submit"],
    #contact-form .btn,
    #decode-btn,
    #verify-flag-btn,
    #flag-form button {
        width: 100%;
        min-height: 46px;
        justify-content: center;
    }

    /* Sottopagine: previene overflow da URL lunghi / codice e migliora padding touch */
    .policy-card {
        padding: 18px 14px;
    }

    .subpage-main a,
    .subpage-main code,
    .cmd-body {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .user-item {
        gap: 10px;
    }

    .user-action {
        min-height: 38px;
        padding: 6px 12px;
        display: inline-flex;
        align-items: center;
    }

    /* Banner Cookie compatto con pulsanti touch a 2 colonne */
    #cookie-consent-banner.cookie-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-width: none;
        transform: none;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
        gap: 10px;
        border-radius: 14px;
    }

    #cookie-consent-banner.cookie-banner p {
        margin: 0;
        font-size: 0.82rem;
        line-height: 1.42;
    }

    #cookie-consent-banner.cookie-banner .cookie-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    #cookie-consent-banner.cookie-banner .cookie-buttons button {
        width: 100%;
        min-height: 42px;
        padding: 8px 12px;
        font-size: 0.88rem;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-footer .footer-links {
        gap: 8px 14px;
    }

    .site-footer .footer-links a {
        min-height: 38px;
        padding: 6px 4px;
        display: inline-flex;
        align-items: center;
    }

    .site-footer .footer-legal {
        font-size: 0.82rem;
        line-height: 1.75;
        padding: 0 6px;
        word-break: break-word;
    }

    .site-footer .footer-legal a {
        display: inline-block;
        padding: 6px 2px;
    }
}

/* Testo semantico per screen reader e motori di ricerca */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
