/* ============================================================
   VARIABLES & THEMES
   ============================================================ */

:root {
    --bg:          #ffffff;
    --text:        #000000;
    --acc:         #ff0000;
    --content-max: 1800px;
    --pad-x:       clamp(24px, 5vw, 120px);
    --f-head:      'Unbounded', sans-serif;
    --f-body:      'Albert Sans', sans-serif;
    --f-acc:       'Syncopate', sans-serif;
}

[data-theme="dark"] {
    --bg:   #0d0d0d;
    --text: #f2f2f2;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 8vh;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--f-body);
    overflow-x: hidden;
    transition: background 0.2s ease, color 0.2s ease;
}

a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--acc);
    outline-offset: 4px;
}

/* ============================================================
   SKIP LINK
   ============================================================ */

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--pad-x);
    background: var(--acc);
    color: #fff;
    padding: 15px;
    z-index: 9999;
}
.skip-link:focus { top: 20px; }

/* ============================================================
   HEADER
   Fixed a piena viewport.
   mix-blend-mode: difference inverte i colori dell'header
   rispetto allo sfondo — funziona sia su pagina chiara che scura.
   Il nav-overlay (z-index 2050) è sotto l'header (z-index 2000)?
   No: il nav-overlay ha z-index superiore MA l'header ha
   pointer-events:none quindi non blocca i click sul menu.
   ============================================================ */

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    mix-blend-mode: difference;
    pointer-events: none;
}

.header-inner {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 22px var(--pad-x);
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: all;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ============================================================
   THEME SWITCHER
   ============================================================ */

#theme-switcher {
    display: flex;
    align-items: center;
    cursor: pointer;
    min-height: unset;
    min-width: unset;
}

.toggle-pill {
    width: 44px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 20px;
    position: relative;
}

.pill-circle {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    pointer-events: none;
    transition: left 0.2s ease;
}

[data-theme="dark"] .pill-circle { left: 24px; }

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */

#lang-switcher {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: 2px solid #fff;
    color: #fff;
    font-family: var(--f-acc);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 6px 14px;
    min-height: unset;
    min-width: unset;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
    pointer-events: all;
}
#lang-switcher:hover {
    background: #fff;
    color: #000;
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */

#menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    min-height: unset;
    min-width: unset;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.bar {
    display: block;
    width: 30px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ============================================================
   NAV OVERLAY
   ============================================================ */

#nav-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2050;
}

#nav-overlay.active {
    transform: translateX(0);
}

#nav-overlay ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0;
    text-align: center;
}

#nav-overlay a {
    font-family: var(--f-head);
    color: #fff;
    font-size: clamp(1.8rem, 3vw, 3rem);
    font-weight: 900;
    display: block;
    padding: 0.25em 0.5em;
    min-height: unset;
    min-width: unset;
    line-height: 1.2;
    transition: opacity 0.2s ease;
}
#nav-overlay a:hover { opacity: 0.5; }

/* ============================================================
   #home
   ============================================================ */

#home {
    min-height: 100svh;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--pad-x);
}

#h-target {
    font-family: var(--f-head);
    font-size: clamp(2.5rem, 10vw, 8rem);
    line-height: 1.15;
    text-align: center;
    word-break: break-word;
}

/* ============================================================
   #visual
   ============================================================ */

#visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 80px var(--pad-x);
    max-width: var(--content-max);
    margin: 0 auto;
}

#visual img {
    width: 100%;
    max-width: 1200px;
    height: auto;
    display: block;
}

/* ============================================================
   #bio
   ============================================================ */

#bio {
    padding: 100px var(--pad-x) 60px;
    max-width: var(--content-max);
    margin: 0 auto;
}

#portfolio {
    padding: 100px var(--pad-x) 100px;
    max-width: var(--content-max);
    margin: 0 auto;
}

.bio-box {
    margin-bottom: 0px;
}

.bio-box h2 {
    font-family: var(--f-head);
    font-size: clamp(2rem, 5vw, 4.5rem);
    margin-bottom: 40px;
    line-height: 1.2;
}

.bio-box p {
    font-size: clamp(1rem, 1.2vw, 1.3rem);
    line-height: 1.75;
    margin-bottom: 24px;
    max-width: 850px;
}

/* ============================================================
   LINKS LIST
   ============================================================ */

.links-box {
    border-bottom: 1px solid var(--text);
}


.l-item {
    border-top: 1px solid var(--text);
    padding: 28px 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.l-item h3 {
    font-family: var(--f-acc);
    font-size: clamp(0.6rem, 1vw, 0.85rem);
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1;
    flex-shrink: 0;
}

.l-item a {
    font-family: var(--f-head);
    color: var(--text);
    font-weight: 900;
    font-size: clamp(0.9rem, 2vw, 1.8rem);
    line-height: 1;
    text-align: right;
    min-height: unset;
    min-width: unset;
    display: inline;
}

/* ============================================================
   #gallery
   ============================================================ */

#gallery {
    max-width: var(--content-max);
    margin: 0 auto;
}

.urban-grid-chaos {
    column-count: 1;
    column-gap: 30px;
    padding: 100px var(--pad-x) 160px;
}

.urban-grid-chaos img {
    width: 100%;
    height: auto;
    margin-bottom: 30px;
    break-inside: avoid;
    display: block;
    filter: grayscale(1);
    transition: filter 0.4s ease, transform 0.4s ease;
}
.urban-grid-chaos img:hover {
    filter: grayscale(0);
    transform: scale(1.01);
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
    padding: 80px var(--pad-x);
    border-top: 1px solid var(--text);
    text-align: center;
    max-width: var(--content-max);
    margin: 0 auto;
}

.footer-nav,
.social-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    font-family: var(--f-acc);
    font-size: clamp(0.6rem, 0.8vw, 0.8rem);
    letter-spacing: 1px;
}

.footer-nav a,
.social-footer a {
    color: var(--text);
    font-weight: bold;
    min-height: unset;
    min-width: unset;
}

footer p {
    font-family: var(--f-acc);
    font-size: clamp(0.55rem, 0.7vw, 0.75rem);
    letter-spacing: 1px;
    opacity: 0.6;
}

/* ============================================================
   COOKIE BANNER
   Fisso in basso, animazione slide-up.
   Entrambi i pulsanti hanno stesso peso visivo (Garante 2022).
   ============================================================ */

.cookie-box {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4000;
    background: var(--bg);
    border-top: 3px solid var(--acc);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10);
    display: none;

    /* Animazione: parte fuori schermo, sale su */
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity   0.35s ease;
}

/* Classe aggiunta da JS per triggerare l'animazione */
.cookie-box.cb-visible {
    transform: translateY(0);
    opacity: 1;
}

/* Classe aggiunta da JS per l'uscita */
.cookie-box.cb-hiding {
    transform: translateY(100%);
    opacity: 0;
}

.cb-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 18px var(--pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.cb-text { flex: 1; }

.cb-label {
    font-family: var(--f-acc);
    font-size: 0.6rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.45;
    margin-bottom: 5px;
    line-height: 1;
}

#cookie-text {
    font-family: var(--f-body);
    font-size: clamp(0.82rem, 1vw, 0.92rem);
    line-height: 1.6;
    opacity: 0.9;
    margin: 0;
}

.cookie-box a {
    color: var(--text);
    text-decoration: underline;
    min-height: unset;
    min-width: unset;
    font-size: inherit;
    display: inline;
}

.cookie-btns {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/*
    ACCETTA e CHIUDI: deliberatamente stesso peso visivo.
    Linee Guida Garante 2021/2022 vietano i "dark pattern"
    (es. tasto accetta vistoso, tasto rifiuta nascosto o grigio).
    Unica differenza ammessa: pieno vs outline.
*/
#cookie-accept {
    padding: 12px 24px;
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    font-family: var(--f-acc);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    min-height: unset;
    min-width: unset;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
#cookie-accept:hover {
    background: var(--acc);
    border-color: var(--acc);
    color: #fff;
}

#cookie-reject {
    padding: 12px 24px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--text);
    font-family: var(--f-acc);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    min-height: unset;
    min-width: unset;
    transition: background 0.2s ease, color 0.2s ease;
}
#cookie-reject:hover {
    background: var(--text);
    color: var(--bg);
}

/* ============================================================
   BACK TO TOP
   ============================================================ */

#to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--text);
    border: none;
    display: none;
    cursor: pointer;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    min-height: unset;
    min-width: unset;
}

#to-top svg {
    width: 20px;
    fill: var(--bg);
    pointer-events: none;
}

/* ============================================================
   RESPONSIVE — MOBILE (< 600px)
   ============================================================ */

@media (max-width: 600px) {
    #nav-overlay a {
        font-size: clamp(1.6rem, 8vw, 2.8rem);
    }
    .l-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 20px 0;
    }
    .l-item a { text-align: left; }
    #visual { gap: 24px; padding: 60px var(--pad-x); }
    .urban-grid-chaos { padding: 60px var(--pad-x) 100px; }

    /* Banner cookie su mobile: layout a colonna */
    .cb-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 16px var(--pad-x) 20px;
    }
    .cookie-btns { width: 100%; }
    #cookie-accept,
    #cookie-reject {
        flex: 1;
        justify-content: center;
    }
}

/* ============================================================
   RESPONSIVE — TABLET (768px+)
   ============================================================ */

@media (min-width: 768px) {
    #visual { gap: 60px; padding: 120px var(--pad-x); }
    .urban-grid-chaos { column-count: 2; column-gap: 40px; }
}

/* ============================================================
   RESPONSIVE — DESKTOP (1200px+)
   ============================================================ */

@media (min-width: 1200px) {
    #visual { gap: 80px; padding: 140px var(--pad-x); }
    #bio { padding: 120px var(--pad-x) 80px; }
}

/* ============================================================
   RESPONSIVE — LARGE (1600px+)
   ============================================================ */

@media (min-width: 1600px) {
    .urban-grid-chaos { column-count: 3; }
}

/* ============================================================
   PENNELLATA SFONDO (invariato)
   ============================================================ */

.bg-brush-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: var(--bg-color);
    transition: background-color 0.4s ease;
}
.brush-stroke {
    fill: none;
    stroke: var(--text-color);
    stroke-linecap: round;
    opacity: var(--brush-opacity);
    transition: stroke 0.4s ease;
    vector-effect: non-scaling-stroke;
}
.stroke-thick { stroke-width: 60px; }
.stroke-mid   { stroke-width: 40px; }
.stroke-thin  { stroke-width: 20px; }
.brush-drip, .brush-dot {
    fill: var(--text-color);
    opacity: var(--brush-opacity);
}
@media (max-width: 768px) {
    .brush-layer { filter: none; }
}

/* ============================================================
   ACCESSIBILITÀ — prefers-reduced-motion (WCAG 2.2)
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cookie-box,
    .bar {
        transition: none !important;
    }
}
