/* ============================================
   🏛️ ARCHIVIO - Design System
   Bootstrap 5.3 + Custom Styles
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    /* Archival Colors - New */
    --color-parchment: #f5f0e8;
    --color-sepia: #d4c8b5;
    --color-ink: #2c2a26;

    /* Original Colors */
    --navy: #1a2a3a;
    --navy-dark: #0f1a26;
    --gold: #c9a45c;
    --gold-light: #dfc07d;
    --gold-dark: #a8853d;
    --cream: var(--color-parchment);
    --cream-dark: var(--color-sepia);
    --burgundy: #6b2d3b;
    --forest: #2d4a3e;
    --cognac: #8b5a2b;

    /* Wood Colors */
    --wood-light: #8b6b4a;
    --wood-medium: #6b4f3a;
    --wood-dark: #4a3528;
    --wood-shadow: #2a1a10;

    /* Spacing */
    --section-padding: 100px;

    /* Transitions */
    --ease-elegant: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Shadows */
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-book: 5px 5px 20px rgba(0, 0, 0, 0.4);
    --shadow-niche: inset 0 5px 20px rgba(0, 0, 0, 0.6);
}

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-ink);
    background: var(--color-parchment);
    overflow-x: hidden;
}

/* ===== GSAP ANIMATIONS ===== */
/* Initial states are now set by GSAP via JavaScript */
/* This ensures elements are visible even if JS fails */

h1,
h2,
h3,
h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    line-height: 1.2;
}

/* ===== CUSTOM BUTTON ===== */
.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--navy-dark);
    border: none;
    padding: 14px 32px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0;
    transition: all 0.4s var(--ease-elegant);
    position: relative;
    overflow: hidden;
}

.btn-gold::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    color: var(--navy-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(201, 164, 92, 0.4);
}

.btn-gold:hover::before {
    left: 100%;
}

/* ===== HEADER ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: all 0.4s var(--ease-elegant);
}

.site-header.scrolled {
    background: rgba(26, 42, 58, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.navbar {
    padding: 20px 0;
    transition: padding 0.4s ease;
}

.site-header.scrolled .navbar {
    padding: 10px 0;
}

.logo-img {
    height: 60px;
    width: auto;
    transition: all 0.3s ease;
}

.site-header.scrolled .logo-img {
    height: 50px;
}

/* Brand Name - Stile calligrafico archivistico */
.brand-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 600;
    font-style: italic;
    color: var(--gold);
    margin-left: 12px;
    letter-spacing: 1px;
    position: relative;
    transition: all 0.4s var(--ease-elegant);
}

/* Effetto macchia inchiostro all'hover */
.brand-name::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 120%;
    height: 200%;
    background: radial-gradient(ellipse at center,
            rgba(26, 42, 58, 0.08) 0%,
            rgba(26, 42, 58, 0.04) 40%,
            transparent 70%);
    border-radius: 50% 40% 60% 45%;
    opacity: 0;
    transition: all 0.5s var(--ease-elegant);
    pointer-events: none;
    z-index: -1;
}

.navbar-brand:hover .brand-name {
    color: white;
    text-shadow: 0 0 20px rgba(201, 164, 92, 0.4);
}

.navbar-brand:hover .brand-name::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Effetto splatter inchiostro aggiuntivo */
.brand-name::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--gold) 20%,
            var(--gold) 80%,
            transparent 100%);
    transform: scaleX(0);
    transition: transform 0.4s var(--ease-elegant);
}

.navbar-brand:hover .brand-name::after {
    transform: scaleX(1);
}

@media (max-width: 768px) {
    .brand-name {
        display: none;
    }
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    padding: 10px 20px;
    position: relative;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease-elegant);
}

.navbar-nav .nav-link:hover {
    color: var(--gold);
}

.navbar-nav .nav-link:hover::after {
    transform: scaleX(1);
}

.navbar-toggler {
    border: 2px solid var(--gold);
    padding: 8px 12px;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23c9a45c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile/Tablet: header sempre con sfondo scuro (sotto 1400px) */
@media (max-width: 1399px) {
    .site-header {
        background: rgba(26, 42, 58, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* ===== HERO SECTION ===== */
.hero-section {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    position: relative;
    overflow: hidden;
    padding-top: 100px;
}

.hero-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(201, 164, 92, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(201, 164, 92, 0.03) 0%, transparent 40%);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: rgba(201, 164, 92, 0.15);
    color: var(--gold);
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-left: 3px solid var(--gold);
    margin-bottom: 20px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: white;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--gold);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    margin-bottom: 25px;
}

.hero-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 35px;
    max-width: 480px;
}

.hero-cta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Hero Image */
.hero-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-frame {
    position: absolute;
    width: 85%;
    height: 90%;
    border: 3px solid var(--gold);
    opacity: 0.3;
    /* Use 3D transform for GPU acceleration */
    transform: translate3d(20px, 20px, 0);
    will-change: transform;
    backface-visibility: hidden;
}

.hero-image {
    max-height: 550px;
    width: auto;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.5));
    transition: transform 0.6s var(--ease-elegant);
    /* GPU acceleration */
    will-change: transform;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}

.hero-image:hover {
    transform: scale(1.03) translate3d(0, -10px, 0);
}

.hero-ornament {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--gold);
    opacity: 0.5;
    /* Animation handled by GSAP for smooth, jitter-free performance */
}

.hero-ornament-1 {
    top: 10%;
    right: 0;
}

.hero-ornament-2 {
    bottom: 20%;
    left: 0;
}



/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    /* Animation handled by GSAP */
}

.scroll-line {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, var(--gold), transparent);
}



/* ===== SECTION STYLES ===== */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-label {
    display: inline-block;
    color: var(--gold);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--navy);
    margin-bottom: 15px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: rgba(26, 42, 58, 0.7);
}

/* ============================================
   📜 COMPETENZE - DESIGN ARCHIVISTICO MINIMAL
   Ispirato a tomi antichi, pergamene e biblioteche
   ============================================ */

#competenze {
    padding: var(--section-padding) 0;
    background: var(--color-parchment);
    position: relative;
}

/* Decorazione sottile come bordo di pergamena */
#competenze::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-sepia), transparent);
}

/* Grid delle competenze - 3 colonne per 2 righe */
.competenze-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Card "Volume" - Design ispirato a dorsi di libri antichi */
.volume-card {
    background: white;
    border: 1px solid var(--color-sepia);
    border-radius: 2px;
    padding: 32px 24px;
    text-align: center;
    position: relative;
    transition: all 0.4s var(--ease-elegant);
    cursor: default;
}

/* Effetto "pagina" sul bordo sinistro */
.volume-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 3px;
    background: linear-gradient(180deg, var(--gold-light), var(--gold), var(--gold-dark));
    border-radius: 0 2px 2px 0;
}

/* Hover elegante */
.volume-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--gold);
}

/* Numero romano - stile capitolo di libro */
.volume-number {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 16px;
    letter-spacing: 2px;
}

/* Titolo del volume */
.volume-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Descrizione breve */
.volume-desc {
    font-size: 0.875rem;
    color: rgba(44, 42, 38, 0.7);
    line-height: 1.6;
    margin: 0;
}

/* === RESPONSIVE - Competenze Grid === */
@media (max-width: 992px) {
    .competenze-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .competenze-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .volume-card {
        padding: 24px 16px;
    }

    .volume-number {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }

    .volume-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .competenze-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
    }
}

/* ============================================
   🔷 ESPERIENZE - SPLIT SCREEN DIAGONALE
   Layout moderno con divisione obliqua
   ============================================ */

.esperienze-split {
    position: relative;
    background: var(--navy-dark);
}

.split-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

/* Grid 3-colonne dei pannelli */
.split-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 900px;
}

/* Singolo pannello con sfondo e overlay */
.split-panel {
    position: relative;
    min-height: 300px;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Overlay scuro per leggibilità */
.split-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(26, 42, 58, 0.85), rgba(15, 26, 38, 0.75));
    transition: opacity 0.5s ease;
}

/* 
   LOGICA DIVISIONE DIAGONALE PER 3 COLONNE 
   Usiamo 3n+1, 3n+2, 3n+3 per targettizzare le colonne 1, 2, 3
*/

/* Colonna 1 (Sinistra) */
.split-panel:nth-child(3n+1) {
    clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
    z-index: 3;
}

/* Colonna 2 (Centro) */
.split-panel:nth-child(3n+2) {
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
    margin-left: -8%;
    /* Sovrapposizione a sinistra */
    width: calc(100% + 8%);
    /* Compensa il margine */
    z-index: 2;
}

/* Colonna 3 (Destra) */
.split-panel:nth-child(3n+3) {
    clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%);
    margin-left: -8%;
    /* Sovrapposizione a sinistra */
    z-index: 1;
}


/* Contenuto testuale */
.panel-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 30px;
    max-width: 90%;
}

.panel-content h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.panel-content p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* Hover: schiarisce overlay */
.split-panel:hover::before {
    background: linear-gradient(135deg, rgba(26, 42, 58, 0.65), rgba(15, 26, 38, 0.55));
}

.split-panel:hover .panel-content h3 {
    color: white;
}

/* === RESPONSIVE - Split Grid === */
@media (max-width: 992px) {
    .split-grid {
        grid-template-columns: 1fr;
    }

    /* Reset clip-path e margini su mobile */
    .split-panel,
    .split-panel:nth-child(3n+1),
    .split-panel:nth-child(3n+2),
    .split-panel:nth-child(3n+3) {
        clip-path: none;
        margin-left: 0;
        width: 100%;
        min-height: 250px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .panel-content {
        padding: 40px 20px;
        max-width: 100%;
    }

    .panel-content h3 {
        font-size: 1.75rem;
    }
}

/* ===== ATTIVITÀ SECTION ===== */
.attivita-section {
    padding: var(--section-padding) 0;
    background: var(--cream);
}

.attivita-item {
    margin-bottom: 80px;
}

.attivita-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.attivita-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    transition: transform 0.8s var(--ease-elegant);
}

.attivita-image-wrapper:hover .attivita-image {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg,
            transparent 0%,
            rgba(201, 164, 92, 0.1) 50%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.attivita-image-wrapper:hover .image-overlay {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.attivita-content {
    padding: 30px;
}

.attivita-title {
    font-size: 2rem;
    color: var(--navy);
    margin-bottom: 15px;
}

.attivita-desc {
    color: rgba(26, 42, 58, 0.8);
    margin-bottom: 25px;
}

/* Full Width Activity */
.attivita-full {
    position: relative;
    height: 450px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attivita-full-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(26, 42, 58, 0.85) 0%,
            rgba(26, 42, 58, 0.7) 100%);
}

.attivita-full-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

/* ===== CONTATTI SECTION ===== */
.contatti-section {
    padding: var(--section-padding) 0;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.contatti-form-card {
    background: var(--cream);
    padding: 50px;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.contatti-form-card .section-title {
    margin-bottom: 10px;
}

.form-control {
    border: none;
    border-bottom: 2px solid var(--cream-dark);
    border-radius: 0;
    padding: 12px 0;
    background: transparent;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    box-shadow: none;
    border-color: var(--gold);
}

.form-label {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.9rem;
}

.contatti-info {
    padding: 40px;
}

/* ===== ENVELOPE ANIMATION ===== */
.envelope-container {
    position: relative;
    width: 180px;
    height: 140px;
    margin: 0 auto 30px;
    perspective: 800px;
}

.envelope {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -50px;
    margin-left: -75px;
    background-color: var(--cream);
    background-image: linear-gradient(transparent 0%, var(--gold-light) 49%, transparent 50%);
    width: 150px;
    height: 100px;
    box-shadow: 0 3px 20px rgba(0, 0, 0, 0.3);
    z-index: 1;
    outline: none;
    display: block;
    text-decoration: none;
    cursor: pointer;
    /* GPU acceleration for smooth GSAP animations */
    will-change: transform, opacity;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.envelope .flap {
    position: absolute;
    width: 0;
    height: 0;
    top: -50px;
    border-top: 0px solid transparent;
    border-right: 75px solid transparent;
    border-left: 75px solid transparent;
    border-bottom: 50px solid var(--cream);
    transform-origin: 50% 100%;
    /* GPU acceleration */
    will-change: transform;
    transform: translate3d(0, 0, 0) rotateX(0deg);
    backface-visibility: hidden;
}

.envelope .infoil {
    position: absolute;
    bottom: 100px;
    left: 12px;
    border-top: 0px solid transparent;
    border-right: 63px solid transparent;
    border-left: 63px solid transparent;
    border-bottom: 40px solid var(--gold);
    transition: border-bottom 150ms ease-in;
}

/* Pseudo-elements for envelope body */
.envelope::after {
    position: absolute;
    content: "";
    left: 10px;
    bottom: 50px;
    width: 130px;
    height: 80px;
    background-color: var(--cream-dark);
    background-image: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    box-shadow: 0 -0px 20px rgba(0, 0, 0, 0.2);
    z-index: 0;
    transition: height 300ms, bottom 300ms;
}

.envelope::before {
    position: absolute;
    content: "";
    left: 0px;
    bottom: 0px;
    height: 50px;
    width: 150px;
    background-color: var(--cream);
    z-index: 2;
}

.envelope .folds::before {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    left: 0;
    border-right: 0px solid transparent;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
    border-left: 75px solid var(--cream);
    z-index: 2;
}

.envelope .folds::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    right: 0;
    border-left: 0px solid transparent;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
    border-right: 75px solid var(--cream);
    z-index: 2;
}

/* Hover: apre la busta */
.envelope:hover {
    transform: scale(1.05);
}

.envelope:hover::after {
    height: 40px;
    bottom: 50px;
}

.envelope:hover .flap {
    transform: rotateX(180deg);
    border-bottom-color: var(--cream-dark);
}

.envelope:hover .infoil {
    border-bottom-width: 20px;
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--navy-dark);
    padding: 30px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Footer Social Icons */
.footer-social {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(201, 164, 92, 0.3);
    color: var(--gold);
    transition: all 0.3s var(--ease-elegant);
}

.social-icon:hover {
    background: var(--gold);
    color: var(--navy-dark);
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(201, 164, 92, 0.3);
}

.social-icon svg {
    width: 18px;
    height: 18px;
}

/* Developer Credits */
.footer-credits {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.35);
}

.developer-link {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.developer-link:hover {
    color: var(--gold-light);
    text-decoration: underline;
}

/* ===== COMPETENZE CARDS ===== */
.competenza-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    height: 100%;
    transition: all 0.4s var(--ease-elegant);
    border-bottom: 3px solid transparent;
}

.competenza-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    border-bottom-color: var(--gold);
}

.competenza-card h4 {
    color: var(--navy);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.competenza-card p {
    color: rgba(26, 42, 58, 0.75);
    margin: 0;
    font-size: 0.95rem;
}

/* ===== FORMAZIONE SECTION - TIMELINE ===== */
.formazione-section {
    padding: var(--section-padding) 0;
    background: var(--cream);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    padding-bottom: 40px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -33px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--gold);
    border: 3px solid var(--cream);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--gold);
}

.timeline-content {
    background: white;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s var(--ease-elegant);
}

.timeline-content:hover {
    transform: translateX(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.timeline-date {
    display: inline-block;
    background: rgba(201, 164, 92, 0.15);
    color: var(--gold-dark);
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 10px;
}

.timeline-content h4 {
    color: var(--navy);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.timeline-content p {
    color: rgba(26, 42, 58, 0.75);
    margin: 0;
    font-size: 0.95rem;
}

.timeline-content small {
    display: block;
    margin-top: 10px;
    font-style: italic;
}

/* ===== ABILITAZIONI SECTION ===== */
.abilitazioni-section {
    padding: var(--section-padding) 0;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.abilitazioni-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.abilitazione-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(201, 164, 92, 0.2);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.4s var(--ease-elegant);
}

.abilitazione-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--gold);
    transform: translateY(-5px);
}

.abilitazione-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.abilitazione-item h4 {
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.abilitazione-item p {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== PUBBLICAZIONI SECTION ===== */
.pubblicazioni-section {
    padding: var(--section-padding) 0;
    background: var(--cream);
}

.pubblicazione-card {
    background: white;
    padding: 35px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    height: 100%;
    transition: all 0.4s var(--ease-elegant);
    border-top: 4px solid var(--gold);
}

.pubblicazione-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.pubblicazione-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.pubblicazione-card h4 {
    color: var(--navy);
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.pubblicazione-card p {
    color: rgba(26, 42, 58, 0.75);
    margin: 0;
    font-size: 0.95rem;
}

/* Pubblicazioni cliccabili con link */
.pubblicazione-link {
    text-decoration: none;
    display: block;
    height: 100%;
}

/* Logo immagine rotondo */
.pubblicazione-icon-img {
    margin-bottom: 20px;
}

.icon-logo-round {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.4s var(--ease-elegant);
}

/* Card cliccabile */
.pubblicazione-card-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Indicatore click - in alto a destra */
.click-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.click-arrow {
    font-size: 1.8rem;
    color: var(--gold);
    opacity: 0.6;
    transition: all 0.4s var(--ease-elegant);
    line-height: 1;
}

.click-text {
    font-size: 0.7rem;
    color: var(--gold-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.4s var(--ease-elegant);
    white-space: nowrap;
}

/* Hover elegante con glow dorato */
.pubblicazione-card-clickable:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 30px rgba(201, 164, 92, 0.15),
        0 0 60px rgba(201, 164, 92, 0.08);
    border-top-color: var(--gold);
}

/* Glow interno sottile */
.pubblicazione-card-clickable::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: radial-gradient(ellipse at center,
            rgba(201, 164, 92, 0.03) 0%,
            transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.pubblicazione-card-clickable:hover::before {
    opacity: 1;
}

/* Hover su indicatore */
.pubblicazione-card-clickable:hover .click-arrow {
    opacity: 1;
    transform: translate(3px, -3px);
    text-shadow: 0 0 15px rgba(201, 164, 92, 0.5);
}

.pubblicazione-card-clickable:hover .click-text {
    opacity: 1;
    transform: translateY(0);
}

/* Hover sul logo rotondo */
.pubblicazione-card-clickable:hover .icon-logo-round {
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(201, 164, 92, 0.25);
}

.tesi-section {
    background: rgba(201, 164, 92, 0.1);
    padding: 30px;
    border-radius: 8px;
    border: 1px dashed var(--gold);
}

.tesi-section h4 {
    color: var(--navy);
    margin-bottom: 10px;
}

/* ===== DIVULGAZIONE SECTION ===== */
.divulgazione-section {
    padding: var(--section-padding) 0;
    background: linear-gradient(135deg, var(--burgundy) 0%, #4a1c28 100%);
}

.divulgazione-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 35px;
    text-align: center;
    height: 100%;
    transition: all 0.4s var(--ease-elegant);
}

.divulgazione-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.divulgazione-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.divulgazione-card h4 {
    color: var(--gold);
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.divulgazione-card p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 0.95rem;
}

/* Divulgazione link e card cliccabili */
.divulgazione-link {
    text-decoration: none;
    display: block;
    height: 100%;
}

.divulgazione-card-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.divulgazione-card-clickable .click-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.divulgazione-card-clickable .click-arrow {
    font-size: 1.8rem;
    color: var(--gold);
    opacity: 0.6;
    transition: all 0.4s var(--ease-elegant);
    line-height: 1;
}

.divulgazione-card-clickable .click-text {
    font-size: 0.7rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.4s var(--ease-elegant);
    white-space: nowrap;
}

.divulgazione-card-clickable:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(201, 164, 92, 0.12),
        0 0 60px rgba(201, 164, 92, 0.06);
    border-color: var(--gold);
}

.divulgazione-card-clickable:hover .click-arrow,
.abilitazione-item:hover .click-arrow {
    opacity: 1;
    transform: translate(3px, -3px);
    text-shadow: 0 0 15px rgba(201, 164, 92, 0.5);
}

.divulgazione-card-clickable:hover .click-text,
.abilitazione-item:hover .click-text {
    opacity: 1;
    transform: translateY(0);
}

/* ===== CONTATTI DETAILS ===== */
.contatti-details {
    margin-top: 20px;
}

.contatti-details p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.contatti-details a {
    transition: color 0.3s ease;
}

.contatti-details a:hover {
    color: var(--gold) !important;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    :root {
        --section-padding: 60px;
    }



    .hero-image {
        max-height: 350px;
    }

    .scroll-indicator {
        display: none;
    }

    .attivita-image {
        height: 250px;
    }

    .attivita-full {
        height: 350px;
    }

    .contatti-form-card {
        padding: 30px;
    }

    /* Abilitazioni responsive */
    .abilitazioni-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* Timeline responsive */
    .timeline {
        padding-left: 30px;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-marker {
        left: -27px;
        width: 14px;
        height: 14px;
    }

    .timeline-content {
        padding: 20px;
    }

    /* Navbar responsive - smaller font */
    .navbar-nav .nav-link {
        font-size: 0.75rem;
        padding: 8px 10px;
        letter-spacing: 1px;
    }
}

@media (max-width: 576px) {

    /* Single column for grids on mobile */
    .abilitazioni-grid {
        grid-template-columns: 1fr;
    }



    /* Navbar stacked */
    .navbar-nav .nav-link {
        font-size: 0.85rem;
        padding: 12px 20px;
    }
}

/* Animations now handled uniformly by GSAP on all devices */

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

/* Selection */
::selection {
    background: var(--gold);
    color: var(--navy-dark);
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

/* ===== GSAP ANIMATION COMPLETE STATES ===== */
/* After GSAP animates elements, ensure they stay visible */
.gsap-animated {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* === Elegant Flip Cards (CodePen Style) === */
.flip-cards-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    max-width: 1000px;
    margin: 0 auto;
}

.flip-card {
    position: relative;
    width: 450px;
    height: 350px;
    perspective: 1000px;
    /* Essential for 3D flip */
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    /* GSAP controlled */
    transform-style: preserve-3d;
}

/* Flip state managed by GSAP */

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Front Side */
.flip-card-front {
    background-color: var(--navy-dark);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align text to top */
    padding-top: 40px;
    /* Space from top */
    background-size: cover !important;
    background-position: center bottom !important;
    /* Focus on objects at bottom */
    color: white;
}

.flip-card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    /* Dark gradient only on top */
    background: linear-gradient(to bottom, rgba(15, 26, 38, 0.95), transparent);
    z-index: 1;
}

.flip-card-front h3 {
    position: relative;
    z-index: 2;
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
    letter-spacing: 1px;
}

.flip-card-front .card-hint {
    position: relative;
    z-index: 2;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Back Side */
.flip-card-back {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.9);
    transform: rotateY(180deg);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--gold);
}

.flip-card-back h4 {
    color: var(--gold);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.flip-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    width: 100%;
}

.flip-list li {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    line-height: 1.3;
}

.flip-list li:last-child {
    border-bottom: none;
}

.flip-list strong {
    color: var(--white);
    display: block;
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 992px) {
    .flip-cards-container {
        flex-direction: column;
        align-items: center;
    }

    .flip-card {
        width: 100%;
        max-width: 450px;
        height: 400px;
        /* Taller on mobile for content */
    }
}