/* =========================================
   VARIABLES & SETUP
   ========================================= */
:root {
    /* Colors - Cinematic Elegant Theme */
    --bg-dark: #08080a;
    --bg-surface: #121215;
    --accent-primary: #d4af37; /* Cinematic Gold */
    --accent-secondary: #f9e596; /* Light Gold */
    --text-main: #fdfbf7;
    --text-muted: #9a9a9e;
    
    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Effects */
    --glass-bg: rgba(18, 18, 21, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother transition */
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    line-height: 1.2;
    font-weight: 400; /* Playfair looks better slightly lighter */
}

h1 span, h2 span {
    font-style: italic; /* Cinematic touch */
}

span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

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

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.section-padding {
    padding: 120px 0;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-primary), #a67c00);
    color: #08080a; /* Dark text on gold button for contrast */
    padding: 14px 32px;
    border-radius: 2px; /* Cinematic square corners */
    font-weight: 600;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
    transition: var(--transition);
    -webkit-text-fill-color: initial;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--text-main);
    padding: 14px 32px;
    border-radius: 2px;
    font-weight: 400;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
}

/* =========================================
   NAVBAR
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 25px 0;
    transition: var(--transition);
}

.navbar.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

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

.nav-links a {
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
}

.nav-links a:not(.nav-btn)::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-primary);
    transition: var(--transition);
}

.nav-links a:not(.nav-btn):hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.hamburger span {
    width: 30px;
    height: 1px;
    background: var(--text-main);
    transition: var(--transition);
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
}

.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.hero-video-bg video {
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    opacity: 0.6; /* Slightly darker for mood */
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(8,8,10,0.5) 0%, rgba(8,8,10,0.95) 100%);
}

.badge {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 30px;
}

.hero-content h1 {
    font-size: 5rem;
    margin-bottom: 25px;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 40px;
    font-weight: 300;
}

.hero-cta {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* =========================================
   ABOUT SECTION
   ========================================= */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.about-text p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 25px;
    font-weight: 300;
}

.software-stack {
    margin-top: 50px;
}

.software-stack h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.software-badge {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: var(--glass-bg);
    padding: 12px 25px;
    border: 1px solid var(--glass-border);
}

.software-badge img {
    width: 25px;
    height: 25px;
    opacity: 0.8;
}

.software-badge span {
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 1px;
    -webkit-text-fill-color: initial;
    color: var(--text-main);
    background: none;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

/* =========================================
   ABOUT — PHOTO FRAME
   ========================================= */
.about-photo-frame {
    position: relative;
    height: 450px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface); /* fallback se foto non c'è ancora */
}

.about-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: grayscale(15%);
    transition: filter 0.7s ease, transform 0.7s ease;
    display: block;
}

.about-photo-frame:hover img {
    filter: grayscale(0%);
    transform: scale(1.03);
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 25px;
    background: linear-gradient(transparent, rgba(8, 8, 10, 0.85));
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* =========================================
   PORTFOLIO SECTION
   ========================================= */
.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
    margin-top: 15px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9; /* Cinematic format */
    cursor: pointer;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    filter: grayscale(20%); /* Cinematic moody start */
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 40px;
    background: rgba(8,8,10,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transition: var(--transition);
}

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

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.portfolio-overlay p {
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 25px;
    font-weight: 300;
}

.view-btn {
    display: inline-block;
    color: var(--text-main);
    font-weight: 400;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--accent-primary);
    padding-bottom: 5px;
}

/* =========================================
   CONTACT SECTION
   ========================================= */
.contact-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    padding: 80px;
}

.contact-info p {
    color: var(--text-muted);
    margin-top: 25px;
    font-size: 1.1rem;
    font-weight: 300;
}

.input-group {
    margin-bottom: 25px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 18px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-bottom-color: var(--accent-primary);
}

.submit-btn {
    width: 100%;
    margin-top: 10px;
}

.form-status {
    margin-top: 15px;
    font-size: 0.95rem;
    font-weight: 400;
    text-align: center;
    min-height: 24px;
    transition: var(--transition);
}

.form-status.success {
    color: var(--accent-primary);
    -webkit-text-fill-color: var(--accent-primary);
}

.form-status.error {
    color: #ff6b6b;
    -webkit-text-fill-color: #ff6b6b;
}

/* Custom Select Dropdown */
.hidden-select {
    display: none;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.custom-select-trigger span {
    -webkit-text-fill-color: initial;
    color: inherit;
    background: none;
}

.custom-select-trigger.selected span {
    color: var(--text-main); 
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
    border-bottom-color: var(--accent-primary);
}

.custom-select-trigger .arrow {
    width: 8px;
    height: 8px;
    border-right: 1px solid var(--text-muted);
    border-bottom: 1px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.4s ease;
    margin-bottom: 5px;
}

.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: rotate(-135deg);
    margin-bottom: -5px;
    border-color: var(--accent-primary);
}

.custom-options {
    position: absolute;
    display: block;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: var(--transition);
    z-index: 10;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    display: block;
    padding: 15px 20px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
    background: transparent;
    -webkit-text-fill-color: currentColor;
}

.custom-option:hover {
    background: rgba(212, 175, 55, 0.05);
    color: var(--accent-primary);
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    border-top: 1px solid var(--glass-border);
    padding: 60px 0;
    text-align: center;
}

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

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 4px;
}

footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 300;
}

.social-links {
    display: flex;
    gap: 30px;
}

.social-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.social-links a:hover {
    color: var(--accent-primary);
}

/* =========================================
   PROJECT TAG
   ========================================= */
.project-tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-primary);
    -webkit-text-fill-color: var(--accent-primary);
    background: none;
    -webkit-background-clip: initial;
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 5px 14px;
    margin-bottom: 14px;
}

/* =========================================
   PORTFOLIO — FEATURED ITEM
   ========================================= */
.portfolio-item.featured {
    grid-column: 1 / -1;
    aspect-ratio: 21/9;
    cursor: pointer;
}

.featured-preview {
    position: absolute;
    inset: 0;
}

.featured-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(30%);
    transition: filter 0.9s ease;
}

.portfolio-item.featured:hover .featured-preview video {
    filter: grayscale(0%);
}

.featured-dim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(8, 8, 10, 0.97) 0%,
        rgba(8, 8, 10, 0.45) 45%,
        rgba(8, 8, 10, 0.15) 100%
    );
}

/* Override overlay for featured */
.portfolio-item.featured .portfolio-overlay {
    opacity: 1;
    background: transparent;
    justify-content: flex-end;
    align-items: flex-start;
    text-align: left;
    padding: 50px;
    flex-direction: column;
    gap: 0;
    pointer-events: none; /* clic passa al container */
}

.portfolio-item.featured .portfolio-overlay h3 {
    font-size: 2.4rem;
    color: var(--text-main);
    margin-bottom: 12px;
    margin-top: 10px;
}

.portfolio-item.featured .portfolio-overlay p {
    max-width: 560px;
    margin-bottom: 24px;
}

.portfolio-item.featured .view-btn {
    pointer-events: auto;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: var(--text-main);
    color: var(--text-main);
    transition: var(--transition);
}

.portfolio-item.featured:hover .view-btn {
    -webkit-text-fill-color: var(--accent-primary);
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* =========================================
   PORTFOLIO — VISION / NEXT-CHAPTER CARDS
   ========================================= */
.portfolio-item.coming-soon {
    cursor: pointer;
}

.coming-soon-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0d0d11, #17171f);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent, transparent 49px,
            rgba(255,255,255,0.025) 49px, rgba(255,255,255,0.025) 50px
        ),
        repeating-linear-gradient(
            90deg,
            transparent, transparent 49px,
            rgba(255,255,255,0.025) 49px, rgba(255,255,255,0.025) 50px
        );
}

.portfolio-item.coming-soon .portfolio-overlay {
    opacity: 1;
    background: rgba(8, 8, 10, 0.55);
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.portfolio-item.coming-soon:hover .portfolio-overlay {
    background: rgba(8, 8, 10, 0.75);
}

.portfolio-item.coming-soon:hover .view-btn {
    -webkit-text-fill-color: var(--accent-primary);
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.view-btn.muted {
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: var(--text-muted);
    color: var(--text-muted);
    border-bottom-color: rgba(154, 154, 158, 0.3);
    cursor: default;
}

/* =========================================
   VIDEO MODAL
   ========================================= */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 10, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

.modal-container {
    position: relative;
    z-index: 1;
    width: 92%;
    max-width: 1080px;
    transform: translateY(22px) scale(0.97);
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.video-modal.active .modal-container {
    transform: translateY(0) scale(1);
}

#modalVideo {
    width: 100%;
    display: block;
    border: 1px solid var(--glass-border);
}

.modal-close {
    position: absolute;
    top: -48px;
    right: 0;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(212, 175, 55, 0.06);
}

/* =========================================
   ANIMATIONS & RESPONSIVE
   ========================================= */
.reveal, .reveal-left, .reveal-right {
    opacity: 0;
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
}

.reveal {
    transform: translateY(40px);
}

.reveal-left {
    transform: translateX(-40px);
}

.reveal-right {
    transform: translateX(40px);
}

.reveal.active, .reveal-left.active, .reveal-right.active {
    opacity: 1;
    transform: translate(0);
}

@media (max-width: 992px) {
    .layout-grid, .contact-box {
        grid-template-columns: 1fr;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }

    .about-photo-frame {
        height: 350px;
    }

    .portfolio-item.featured {
        aspect-ratio: 16/9;
    }

    .portfolio-item.featured .portfolio-overlay {
        padding: 35px;
    }

    .portfolio-item.featured .portfolio-overlay h3 {
        font-size: 1.9rem;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(8, 8, 10, 0.98);
        flex-direction: column;
        justify-content: center;
        transition: 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .nav-links.active {
        right: 0;
    }

    .hero-content h1 {
        font-size: 2.8rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .contact-box {
        padding: 40px 20px;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }

    /* Portfolio mobile: tutto in colonna singola */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-item.featured {
        grid-column: auto;
        aspect-ratio: 16/9;
    }

    .portfolio-item.featured .portfolio-overlay {
        padding: 25px;
    }

    .portfolio-item.featured .portfolio-overlay h3 {
        font-size: 1.6rem;
    }

    /* Modal su mobile */
    .modal-close {
        top: -42px;
    }
}
