/* ============================================================
   Nobody Asked For It — stylesheet principale
   Estetica: laboratorio digitale, terminale, circuiti, d20.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    --bg:        #0a0e14;
    --bg-alt:    #0d1219;
    --surface:   #131b28;
    --surface-2: #1a2436;
    --border:    #223047;

    --text:      #d7e1ef;
    --text-dim:  #93a5bc;

    --accent:    #00e5a0; /* verde digitale */
    --accent-2:  #7c5cff; /* viola */
    --accent-3:  #22d3ee; /* ciano */
    --warn:      #ffb454;
    --danger:    #ff5c7a;

    --glow:      rgba(0, 229, 160, 0.35);

    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;

    --radius: 10px;
    --container: 72rem;
    --transition: 180ms ease;
}

/* ---------- Reset essenziale ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* L'attributo hidden deve sempre vincere, anche su elementi con display esplicito
   (es. .d20-overlay che usa display: flex) */
[hidden] { display: none !important; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.65;
    /* Trama a circuito: griglia sottile + bagliori radiali */
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124, 92, 255, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(0, 229, 160, 0.05), transparent),
        linear-gradient(rgba(34, 48, 71, 0.22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 48, 71, 0.22) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
    background-attachment: fixed;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.75rem; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-3); }

ul { padding-left: 1.25rem; }

.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.dim { color: var(--text-dim); }
.center { text-align: center; }

.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 1.25rem;
}
.container.narrow { max-width: 46rem; }

/* ---------- Accessibilità ---------- */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #04140d;
    border-radius: 0 0 var(--radius) var(--radius);
    font-weight: 600;
    text-decoration: none;
    transition: top var(--transition);
}
.skip-link:focus { top: 0; color: #04140d; }

:focus-visible {
    outline: 2px solid var(--accent-3);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ---------- Header e navigazione ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 14, 20, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--accent);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.logo:hover { color: var(--accent); }
.logo:hover .logo-mark { filter: drop-shadow(0 0 6px var(--glow)); }
.logo-mark { display: inline-flex; transition: filter var(--transition), transform var(--transition); }
.logo-text { color: var(--text); }
.logo-accent { color: var(--accent); }
.logo-dot { color: var(--text-dim); }

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
}
.site-nav a {
    display: block;
    padding: 0.5rem 0.85rem;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 7px;
    font-size: 0.95rem;
    transition: color var(--transition), background var(--transition);
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a.active {
    color: var(--accent);
    background: rgba(0, 229, 160, 0.08);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px; height: 44px;
    padding: 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
}
.nav-toggle-bar {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 800px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        display: none;
        padding: 0.75rem 1.25rem 1rem;
    }
    .site-nav.open { display: block; }
    .site-nav ul { flex-direction: column; gap: 0.15rem; }
    .site-nav a { padding: 0.75rem 0.85rem; font-size: 1.05rem; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 4rem); }

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 3rem;
    align-items: center;
}
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.hero-kicker {
    color: var(--accent);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.hero-title {
    margin-bottom: 0.5rem;
    background: linear-gradient(120deg, var(--text) 30%, var(--accent-3) 70%, var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    color: var(--text-dim);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}
.hero-tagline::after {
    content: "▊";
    color: var(--accent);
    animation: blink 1.1s steps(1) infinite;
    margin-left: 2px;
}

.hero-desc { color: var(--text-dim); max-width: 34rem; margin-bottom: 1.75rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-actions.center { justify-content: center; }

@keyframes blink { 50% { opacity: 0; } }

/* ---------- Terminale ---------- */
.terminal {
    background: #0b1017;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(0, 229, 160, 0.07), 0 18px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.terminal-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.t-dot { width: 11px; height: 11px; border-radius: 50%; }
.t-red { background: #ff5f57; }
.t-yellow { background: #febc2e; }
.t-green { background: #28c840; }
.t-title { margin-left: 0.5rem; font-size: 0.8rem; color: var(--text-dim); }

.terminal-body {
    padding: 1.1rem 1.2rem 1.3rem;
    min-height: 11rem;
    font-size: 0.9rem;
    color: var(--accent);
    line-height: 1.8;
}
.terminal-body p { margin: 0; }
.terminal-body .t-cursor {
    display: inline-block;
    width: 0.55em; height: 1.1em;
    background: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1s steps(1) infinite;
}

/* ---------- Sezioni ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-alt {
    background: linear-gradient(180deg, transparent, rgba(19, 27, 40, 0.65) 12%, rgba(19, 27, 40, 0.65) 88%, transparent);
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.section-title { margin-bottom: 1.5rem; }
.section-head .section-title { margin-bottom: 0; }
.section-link { font-size: 0.95rem; white-space: nowrap; }
.section-cta { margin-top: 2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.page-head {
    padding: clamp(2.5rem, 6vw, 4rem) 0 0.5rem;
}
.page-intro { color: var(--text-dim); max-width: 40rem; font-size: 1.05rem; }

.breadcrumb { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.35rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: 600 0.95rem var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition),
                background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(120deg, var(--accent), #00c48a);
    color: #04140d;
}
.btn-primary:hover { box-shadow: 0 4px 22px var(--glow); color: #04140d; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(255, 92, 122, 0.4);
}
.btn-danger:hover { background: rgba(255, 92, 122, 0.12); border-color: var(--danger); color: var(--danger); }

.btn-small { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Card progetti ---------- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 1.4rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 229, 160, 0.45);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 229, 160, 0.15);
}

.card-cover { display: block; aspect-ratio: 16 / 9; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.2rem 1.3rem 1.3rem;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.card-icon { font-size: 1.5rem; line-height: 1; }

.card-title { font-size: 1.15rem; margin-bottom: 0.25rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }

.card-category { font-size: 0.78rem; color: var(--accent-3); margin-bottom: 0.6rem; }

.card-desc { color: var(--text-dim); font-size: 0.95rem; flex: 1; }

.card-techs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0;
    margin: 0 0 1rem;
}
.tech-tag {
    --tech-color: var(--accent-3);
    font-size: 0.72rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid color-mix(in srgb, var(--tech-color) 45%, transparent);
    border-radius: 999px;
    color: color-mix(in srgb, var(--tech-color) 80%, white 20%);
    background: color-mix(in srgb, var(--tech-color) 10%, transparent);
    white-space: nowrap;
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .tech-tag { border-color: var(--border); color: var(--accent-3); background: rgba(34, 211, 238, 0.08); }
}

.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Badge di stato ---------- */
.badge {
    display: inline-block;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    font: 600 0.72rem var(--mono);
    letter-spacing: 0.02em;
    border: 1px solid;
    white-space: nowrap;
}
.status-idea  { color: #b8c4d6; border-color: rgba(184, 196, 214, 0.4); background: rgba(184, 196, 214, 0.08); }
.status-dev   { color: var(--accent-3); border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.08); }
.status-exp   { color: var(--accent-2); border-color: rgba(124, 92, 255, 0.5); background: rgba(124, 92, 255, 0.1); }
.status-works { color: var(--accent); border-color: rgba(0, 229, 160, 0.5); background: rgba(0, 229, 160, 0.08); }
.status-done  { color: #9ee493; border-color: rgba(158, 228, 147, 0.45); background: rgba(158, 228, 147, 0.08); }
.status-rip   { color: var(--warn); border-color: rgba(255, 180, 84, 0.45); background: rgba(255, 180, 84, 0.08); }

/* ---------- Statistiche ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 1.1rem;
}
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.4rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: border-color var(--transition);
}
.stat-card:hover { border-color: rgba(0, 229, 160, 0.4); }
.stat-value { font-size: 2.1rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 0.85rem; color: var(--text-dim); }

/* ---------- Passioni / about ---------- */
.passion-grid, .about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1.25rem;
}
.passion-card, .about-card {
    padding: 1.4rem 1.4rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), transform var(--transition);
}
.passion-card:hover, .about-card:hover { border-color: rgba(124, 92, 255, 0.5); transform: translateY(-2px); }
.passion-icon { font-size: 1.8rem; display: block; margin-bottom: 0.6rem; }
.passion-card h3 { margin-bottom: 0.4rem; }
.passion-card p, .about-card p { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 0.25rem; }
.about-card h3 { color: var(--accent-3); font-size: 0.95rem; margin-bottom: 0.6rem; }
.about-card-tebi { border-color: rgba(0, 229, 160, 0.35); }

.prose { font-size: 1.08rem; }
.prose p { margin-bottom: 1.25rem; }

/* ---------- Filtri progetti ---------- */
.filter-bar {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 0.9rem;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
@media (max-width: 950px) { .filter-bar { grid-template-columns: 1fr 1fr; } .filter-search { grid-column: 1 / -1; } }
@media (max-width: 520px) { .filter-bar { grid-template-columns: 1fr; } }

.filter-field { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-field label { font-size: 0.72rem; color: var(--accent); letter-spacing: 0.05em; }

.filter-count { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.5rem; }

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
}
.empty-state .mono { color: var(--warn); margin-bottom: 1rem; }

/* ---------- Form ---------- */
input[type="text"], input[type="search"], input[type="email"], input[type="url"],
input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 7px;
    font: 400 0.95rem var(--sans);
    transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.15);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2393a5bc'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

.form-field { margin-bottom: 1.15rem; }
.form-field label, .label-like { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.92rem; }
.field-error { color: var(--danger); font-size: 0.85rem; margin: 0.35rem 0 0; }

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.alert-success { color: var(--accent); border-color: rgba(0, 229, 160, 0.45); background: rgba(0, 229, 160, 0.08); }
.alert-error { color: var(--danger); border-color: rgba(255, 92, 122, 0.45); background: rgba(255, 92, 122, 0.08); }

/* Honeypot: fuori dallo schermo, non display:none (alcuni bot lo rilevano) */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* ---------- Contatti ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2.5rem;
    align-items: start;
}
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-links { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.contact-links li {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}
.contact-label { font-size: 0.72rem; color: var(--accent); letter-spacing: 0.06em; }
.contact-note { color: var(--text-dim); font-size: 0.9rem; }

.contact-form-wrap {
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ---------- Dettaglio progetto ---------- */
.detail-title-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.detail-icon { font-size: 2.2rem; line-height: 1; }
.detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 0.75rem;
}
.detail-meta-item { color: var(--text-dim); font-size: 0.85rem; }

.detail-grid {
    display: grid;
    grid-template-columns: 1.9fr 1fr;
    gap: 2.5rem;
    align-items: start;
}
@media (max-width: 850px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-cover {
    margin: 0 0 1.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.detail-description { font-size: 1.05rem; }
.detail-description p { margin-bottom: 1.2rem; }

.sidebar-panel {
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.sidebar-title { font-size: 0.85rem; color: var(--accent); margin-bottom: 1rem; }
.sidebar-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.sidebar-note { color: var(--text-dim); font-size: 0.9rem; margin: 0; }

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.1rem;
}
.related-card {
    display: flex;
    gap: 0.9rem;
    padding: 1.1rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color var(--transition), transform var(--transition);
}
.related-card:hover { border-color: rgba(0, 229, 160, 0.45); transform: translateY(-2px); }
.related-icon { font-size: 1.5rem; line-height: 1.2; }
.related-body { display: flex; flex-direction: column; gap: 0.2rem; }
.related-title { color: var(--text); font-weight: 600; }
.related-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Stack ---------- */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 1.25rem;
}
.stack-card {
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition);
}
.stack-card:hover { border-color: rgba(34, 211, 238, 0.45); }
.stack-title { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; }
.stack-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0; margin: 0; }
.stack-badges .tech-tag { font-size: 0.8rem; padding: 0.28rem 0.75rem; }
.stack-note { margin-top: 2rem; color: var(--text-dim); font-size: 0.85rem; }

/* ---------- 404 ---------- */
.error-404 { padding-top: clamp(3.5rem, 10vw, 7rem); }
.error-code { color: var(--danger); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.9; }

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 3rem 0 1.5rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-logo { color: var(--accent); font-weight: 700; margin-bottom: 0.4rem; }
.footer-quip { color: var(--text-dim); font-size: 0.9rem; font-style: italic; cursor: pointer; }
.footer-quip:hover { color: var(--accent-3); }

.footer-heading { font-size: 0.78rem; color: var(--accent); letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.footer-nav ul, .footer-social ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.footer-nav a, .footer-social a { color: var(--text-dim); text-decoration: none; font-size: 0.92rem; }
.footer-nav a:hover, .footer-social a:hover { color: var(--accent); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}
.footer-bottom p { margin: 0; }

/* ---------- Torna in alto ---------- */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 40;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--accent);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.back-to-top:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 4px 18px var(--glow);
}

/* ---------- Easter egg: d20 ---------- */
.d20-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 9, 14, 0.85);
    backdrop-filter: blur(4px);
    padding: 1.5rem;
}
.d20-box {
    max-width: 26rem;
    width: 100%;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid rgba(0, 229, 160, 0.4);
    border-radius: var(--radius);
    box-shadow: 0 0 60px rgba(0, 229, 160, 0.15);
    text-align: center;
}
.d20-box h2 { color: var(--accent); font-size: 1rem; margin-bottom: 1.25rem; }

.d20-die {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 1rem;
}
.d20-die.rolling { animation: d20spin 700ms ease-in-out; }
@keyframes d20spin {
    0%   { transform: rotate(0) scale(1); }
    50%  { transform: rotate(200deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}
.d20-number {
    position: absolute;
    font: 700 1.6rem var(--mono);
    color: var(--text);
}
.d20-result { min-height: 3.2em; color: var(--text-dim); font-size: 0.98rem; }
.d20-result strong { color: var(--accent); }
.d20-actions { display: flex; justify-content: center; gap: 0.75rem; }

/* ---------- Riduzione del movimento ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .project-card:hover, .btn:hover, .related-card:hover, .passion-card:hover, .about-card:hover {
        transform: none;
    }
}
