/* ==========================================================================
   DESIGN SYSTEM & CUSTOM STYLE - Swiss Brutalism / Gorki Theater Inspired
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Oswald:wght@400;500;700&family=Dancing+Script:wght@600;700&display=swap');

html {
    scroll-behavior: smooth;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #000000;
    --accent-color: #000000;
    --separator-color: #e0e0e0;
    --font-headings: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;

    --container-max-width: 1200px;
    --border-width: 2px;
}

/* ==========================================================================
   ACCESSIBILITY OVERRIDES (HTML root class bindings)
   ========================================================================== */

/* Contrasto Chiaro */
.access-contrast-light-active {
    --bg-primary: #ffffff !important;
    --bg-secondary: #f0f0f0 !important;
    --text-primary: #000000 !important;
    --text-secondary: #111111 !important;
    --border-color: #000000 !important;
    --accent-color: #000000 !important;
}

/* Contrasto Scuro */
.access-contrast-dark-active {
    --bg-primary: #000000 !important;
    --bg-secondary: #121212 !important;
    --text-primary: #ffffff !important;
    --text-secondary: #dddddd !important;
    --border-color: #ffffff !important;
    --accent-color: #ffffff !important;
    --separator-color: #444444 !important;
}

/* Contrasto Elevato */
.access-contrast-high-active {
    --bg-primary: #ffffff !important;
    --bg-secondary: #f9f9f9 !important;
    --text-primary: #000000 !important;
    --text-secondary: #000000 !important;
    --border-color: #000000 !important;
    --accent-color: #000000 !important;
    filter: contrast(135%) !important;
}

/* Carattere Leggibile */
.access-readable-font-active body,
.access-readable-font-active p,
.access-readable-font-active span,
.access-readable-font-active h1,
.access-readable-font-active h2,
.access-readable-font-active h3,
.access-readable-font-active h4,
.access-readable-font-active h5,
.access-readable-font-active h6,
.access-readable-font-active a,
.access-readable-font-active li {
    font-family: 'OpenDyslexic', 'Verdana', 'Arial', sans-serif !important;
}

/* Spaziatura Lettere */
.access-spacing-tight body {
    letter-spacing: -0.05em !important;
}

.access-spacing-wide body {
    letter-spacing: 0.08em !important;
}

.access-spacing-wider body {
    letter-spacing: 0.15em !important;
}

.access-spacing-widest body {
    letter-spacing: 0.25em !important;
}

/* Allineamento Testo */
.access-align-left-active body {
    text-align: left !important;
}

.access-align-center-active body {
    text-align: center !important;
}

.access-align-right-active body {
    text-align: right !important;
}

/* Nascondi Immagini */
.access-hide-images-active img,
.access-hide-images-active picture,
.access-hide-images-active iframe,
.access-hide-images-active video {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ferma Animazioni */
.access-stop-animations-active * {
    animation: none !important;
    transition: none !important;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Modern styling for the container */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography elements */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-headings);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: var(--text-primary);
}

a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: opacity 0.2s ease, text-decoration-thickness 0.2s ease;
}

a:hover {
    text-decoration-thickness: 2px;
}

/* ==========================================================================
   HEADER / NAVBAR
   ========================================================================== */
header {
    border-bottom: 1px solid var(--separator-color);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.site-title {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: none;
}

.site-title a {
    text-decoration: none;
}

/* Navigation Menu */
nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
}

nav a {
    text-decoration: none;
    font-family: var(--font-headings);
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    position: relative;
    padding: 0.2rem 0;
}

nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--text-primary);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

nav a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Hamburger mobile menu if needed */
.menu-toggle {
    display: none;
}

/* ==========================================================================
   HERO / INTRO SECTION
   ========================================================================== */
.hero {
    border-bottom: 1px solid var(--separator-color);
    padding: 9rem 0;
    position: relative;
    overflow: hidden;
    background-image: url('../images/untitled-8-2000.jpg');
    background-image: image-set(
        url('../images/untitled-8-2000.webp') type('image/webp'),
        url('../images/untitled-8-2000.jpg') type('image/jpeg')
    );
    background-size: cover;
    background-position: center 35%;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.60);
    z-index: 1;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.quote-box {
    max-width: 800px;
}

.hero-quote {
    font-family: var(--font-headings);
    font-size: clamp(1.6rem, 3.2vw, 3rem);
    line-height: 1.15;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ffffff;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
    margin-bottom: 0;
}

/* ==========================================================================
   GRID SECTIONS (CORSI & STORIA)
   ========================================================================== */
.section-title {
    font-size: 3rem;
    margin-bottom: 2rem;
    display: block;
}

section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--separator-color);
    scroll-margin-top: 5rem;
}

/* Corsi Grid Layout */
.corsi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4rem;
}

.corso-card {
    padding: 3rem 0;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr auto;
    column-gap: 1.25rem;
    border-bottom: 1px solid var(--separator-color);
}

.corso-num {
    grid-column: 1;
    grid-row: 1;
    font-family: var(--font-headings);
    font-size: 4rem;
    line-height: 1;
    font-weight: 700;
    align-self: center;
}

.corso-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 1.35rem;
    line-height: 1.2;
    align-self: center;
    margin-bottom: 0;
}

.corso-desc {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.corso-meta {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-top: 1.5rem;
    border-top: 1px solid var(--separator-color);
}

.corso-meta p {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.corsi-footer-note {
    text-align: center;
    font-family: var(--font-headings);
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Storia Text Block */
.storia-text h3 {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.storia-intro {
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.storia-body p {
    margin-bottom: 1.5rem;
}

/* Storia asymmetric image mosaic — 4-col grid, alternating wide */
.storia-mosaic {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 3.5rem 0;
}

.sm-item {
    overflow: hidden;
}

/* Row 1: 2 immagini grandi affiancate */
.sm-item:nth-child(1) { grid-column: span 2; aspect-ratio: 3/2; }
.sm-item:nth-child(2) { grid-column: span 2; aspect-ratio: 3/2; }

/* Row 2: 4 immagini piccole */
.sm-item:nth-child(3) { grid-column: span 1; aspect-ratio: 4/3; }
.sm-item:nth-child(4) { grid-column: span 1; aspect-ratio: 4/3; }
.sm-item:nth-child(5) { grid-column: span 1; aspect-ratio: 4/3; }
.sm-item:nth-child(6) { grid-column: span 1; aspect-ratio: 4/3; }

.sm-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    filter: grayscale(100%);
}

.sm-item:hover img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

/* Biography Grid */
.bio-section {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 4rem;
    align-items: center;
}

.bio-img-container picture {
    display: block;
    line-height: 0;
}

.bio-img-container img {
    width: 100%;
    display: block;
}

.bio-text h3 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.bio-text p {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   GALLERIA IMMAGINI (MODERN ART GALLERY GRID)
   ========================================================================== */
.gallery-section {
    padding: 4rem 0 0;
}

.gallery-section .gray-band {
    padding: 2rem 0;
    margin-top: 3rem;
    margin-bottom: 0;
}

/* Immagini show-band: terracotta */
#immagini .gray-band {
    background-color: #8B4040;
    scroll-margin-top: 9.5rem;
}

/* Video show-band: oro scuro */
#video .gray-band {
    background-color: #8F6843;
    padding: 2rem 0;
    margin-top: 3rem;
    margin-bottom: 0;
    scroll-margin-top: 9.5rem;
}

/* Sticky sub-header — breadcrumb spettacoli Video */
.video-sticky-nav {
    position: sticky;
    top: 6rem;
    z-index: 50;
    background-color: #eeeeee;
    border-bottom: 1px solid var(--separator-color);
}

/* Sticky sub-header — breadcrumb spettacoli Immagini */
.immagini-sticky-nav {
    position: sticky;
    top: 6rem;
    z-index: 50;
    background-color: #ffffff;
    border-bottom: 1px solid var(--separator-color);
}

.show-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin: 0;
    padding: 1.1rem 0 0.5rem;
}

.show-breadcrumb a {
    font-family: var(--font-headings);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.show-breadcrumb a:hover {
    color: var(--text-primary);
}

.gray-band h3 {
    color: #ffffff;
    font-family: var(--font-headings);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 1.5rem;
    margin: 0 0 0.4rem;
}

#immagini .gray-band h3 {
    color: #04d7b7;
}

#video .gray-band h3 {
    color: #fade0a;
}

.gray-band .show-subtitle {
    color: rgba(255, 255, 255, 0.65);
    font-family: var(--font-headings);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.show-block {
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.show-block .show-cast {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

.show-block .show-desc {
    margin-top: 1.5rem;
    line-height: 1.7;
}

.show-block .art-grid {
    margin-top: 2.5rem;
}

.art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.art-card {
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.art-card:hover {
    transform: translateY(-5px);
}

.art-img-wrapper {
    aspect-ratio: 4/3;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.art-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.3s ease, transform 0.3s ease;
}

.art-card:hover img {
    filter: grayscale(0%);
    transform: scale(1.03);
}

.art-title {
    font-family: var(--font-headings);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Lightbox styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 85%;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border: 2px solid white;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
}

.lightbox-caption {
    color: white;
    font-family: var(--font-headings);
    text-transform: uppercase;
    margin-top: 1rem;
    text-align: center;
    font-size: 1.2rem;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: white;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.6rem 1.1rem;
    z-index: 2001;
    transition: background 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

/* Current page nav indicator */
nav a[aria-current="page"] {
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
}

/* Video info — sottotitolo fonte/adattamento */
.video-source {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Video info — citazione atmosferica */
.video-quote {
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    border-left: 2px solid var(--separator-color);
    padding-left: 1rem;
    margin: 1rem 0;
}

/* ==========================================================================
   VIDEO SECTION
   ========================================================================== */
.video-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    padding: 3rem 0;
    align-items: center;
    border-bottom: 1px solid var(--separator-color);
}

/* Video rows inside show-blocks: layout only, no standalone separators */
#video .video-row {
    padding: 0;
    border-bottom: none;
    align-items: start;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
    border-top: 1px solid var(--separator-color);
    padding: 1.5rem 0;
    background-color: var(--bg-primary);
}

.footer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.footer-credits {
    font-size: 0.95rem;
}

/* Gray horizontal separator — stile Gorki */
hr.separator,
.separator {
    border: none;
    border-top: 1px solid var(--separator-color);
    margin: 4rem 0;
}

/* =========================================================
   GRAY BAND — Gorki-style full-width dark content section
   ========================================================= */
.gray-band {
    background-color: #1a1a1a;
    padding: 4rem 0;
    margin-top: 4rem;
    margin-bottom: 4rem;
}

.gray-band p {
    color: #ffffff;
    font-family: var(--font-headings);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.gray-band .corsi-footer-note p {
    font-size: 1.6rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.gray-band .storia-body p {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Corsi: gray-band è l'ultimo elemento — nessun gap sotto */
#corsi {
    padding-bottom: 0;
}

#corsi .gray-band {
    margin-bottom: 0;
}

/* Alternating section backgrounds */
#storia,
#video {
    background-color: #eeeeee;
}

.access-contrast-dark-active .gray-band {
    background-color: #2a2a2a;
}

.access-contrast-dark-active .immagini-sticky-nav,
.access-contrast-dark-active .video-sticky-nav {
    background-color: #1a1a1a;
}

.access-contrast-light-active .immagini-sticky-nav,
.access-contrast-light-active .video-sticky-nav {
    background-color: #ffffff;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1024px) {
    .bio-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .bio-img-container {
        max-width: 350px;
        margin: 0 auto;
    }

    .bio-img-container img {
        width: 100%;
        display: block;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    nav ul {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 4rem 0;
    }

    .corsi-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .storia-mosaic {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Row 1: le 2 large restano affiancate (1 col ciascuna su grid a 2 col) */
    .sm-item:nth-child(1),
    .sm-item:nth-child(2) {
        grid-column: span 1;
        aspect-ratio: 4/3;
    }

    /* Row 2: le 4 piccole vanno 2+2 */
    .sm-item:nth-child(3),
    .sm-item:nth-child(4),
    .sm-item:nth-child(5),
    .sm-item:nth-child(6) {
        grid-column: span 1;
        aspect-ratio: 4/3;
    }

    .video-row {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem;
    }

    .immagini-sticky-nav,
    .video-sticky-nav {
        position: static;
    }

    /* footer already column-centered globally */
}

@media (max-width: 480px) {
    .storia-mosaic {
        grid-template-columns: 1fr;
    }

    .sm-item:nth-child(n) {
        grid-column: span 1;
        aspect-ratio: 4/3;
    }

    .corso-card {
        padding: 1.5rem;
    }

    .bio-section {
        padding: 1.5rem;
        gap: 2rem;
    }
}