/* --- GLOBAL RESET & BASICS --- */
html {
    scroll-behavior: smooth;
}

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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #000;
    background-color: #fff;
    line-height: 1.6;
    padding-top: 80px; 
    cursor: auto; /* Default System Mouse */
}

/* --- CUSTOM CURSOR (Hidden by default) --- */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 0; 
    height: 0;
    background-color: #000; /* Black Pill */
    border-radius: 20px; 
    
    /* CRITICAL: Allows clicks to pass through to the link below */
    pointer-events: none !important; 
    
    z-index: 2147483647; 
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0; 
    transition: opacity 0.15s ease, width 0.2s ease, height 0.2s ease;
}

.cursor-text {
    opacity: 0;
    font-size: 12px;
    font-weight: 500;
    color: #fff; /* White Text */
    padding: 0 12px;
    line-height: 1;
}

/* --- ACTIVE STATE (The Pill Appears) --- */
.custom-cursor.active {
    opacity: 1;
    width: auto;
    min-width: 50px; 
    height: 30px;
}

.custom-cursor.active .cursor-text {
    opacity: 1;
}

/* --- HIDE SYSTEM MOUSE ON SPECIFIC TARGETS --- */
.project-link, 
.project-link *,
.project-link img { 
    cursor: none !important; 
    user-select: none; 
    pointer-events: auto; 
}

.project-link img {
    pointer-events: none; 
}

/* --- HEADER --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header .logo img {
    height: 60px; 
    width: auto;
    display: block;
    transition: opacity 0.2s ease;
}

header .logo a:hover img {
    opacity: 0.5;
}

header nav ul {
    display: flex;
    list-style: none;
}

header nav ul li {
    margin-left: 25px;
}

header nav ul li a {
    font-size: 1rem;
    font-weight: 300;
    position: relative;
    text-decoration: none;
    color: #000;
}

header nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #000;
    display: none;
}

header nav ul li a:hover::after {
    display: block;
}

/* --- TYPOGRAPHY & SECTIONS --- */
h1 {
    font-size: 4rem;
    margin-bottom: 30px;
    font-weight: 700;
    line-height: 1.1;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #000;
}

section {
    padding: 80px 20px;
    border-bottom: 1px solid #000;
    scroll-margin-top: 80px;
}

.full-width-divider {
    width: 100%;
    height: 1px;
    background-color: #000;
    margin-top: 40px;
}

.gallery-context-text {
    padding: 0 20px;
    margin-top: 40px;
    margin-bottom: 40px;
    font-weight: 500;
}

/* Centered Blurb Style */
.centered-blurb {
    text-align: left; 
    padding: 80px 20px; 
    max-width: 700px;
    margin: 0 auto; 
    font-size: 1.1rem;
    line-height: 1.6;
}

.centered-blurb p {
    margin-bottom: 20px;
}

.centered-blurb p:last-child {
    margin-bottom: 0;
}

/* --- HERO & INTRO --- */
.hero {
    background-color: #000;
    color: #fff;
    text-align: center;
    padding: 0 20px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.hero-video-container {
    width: 100%;
    max-width: 1400px;
    aspect-ratio: 16 / 9; 
    background-color: #111; 
    overflow: hidden;
    position: relative;
}

.hero-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
}

/* SCROLL DOWN ARROW */
.scroll-down-arrow {
    position: absolute;
    bottom: 30px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    color: #fff;
    opacity: 0.8;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)); 
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scroll-down-arrow:hover {
    opacity: 1;
    transform: translateX(-50%) translateY(5px); 
}

.scroll-down-arrow svg {
    width: 40px;
    height: 40px;
    stroke: #fff;
    stroke-width: 2px;
}

.intro-text {
    padding: 60px 20px;
    text-align: center;
    border-bottom: 1px solid #000;
}

.intro-text p {
    max-width: 600px;
    margin: 0 auto 15px auto;
    font-size: 1rem;
}

.intro-text a {
    color: #000;
    text-decoration: underline;
}

/* --- PROJECT PAGE LAYOUTS --- */
.project-intro {
    padding: 40px 20px 0 20px;
    margin-bottom: 30px;
    border-bottom: none;
}

.project-details-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 80px;
    align-items: start;
}

.project-description p {
    margin-bottom: 20px;
    max-width: 60ch;
}

.project-description a {
    display: block;
    margin-bottom: 8px;
    text-decoration: underline;
    color: #000;
}

.project-metadata table {
    width: 100%;
    border-collapse: collapse;
}

.project-metadata td {
    padding: 10px 0;
    border-bottom: 1px solid #000;
    font-size: 0.9rem;
}

.project-metadata td:first-child { text-align: left; padding-right: 20px; }
.project-metadata td:last-child { text-align: right; }
.project-metadata tbody { border-top: 1px solid #000; }

/* --- PROJECT GALLERIES --- */
.project-gallery-wrapper {
    padding: 0 20px 40px 20px;
    border-bottom: none;
}

.project-gallery {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.project-gallery:last-child { margin-bottom: 0; }

.project-gallery-1col { grid-template-columns: 1fr; }
.project-gallery-2col { grid-template-columns: repeat(2, 1fr); }
.project-gallery-3col { grid-template-columns: repeat(3, 1fr); }
.project-gallery-4col { grid-template-columns: repeat(4, 1fr); }

.project-gallery-2col .gallery-image-item img {
    max-height: 85vh;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.gallery-image-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* --- SELECTED PROJECTS (HOMEPAGE) --- */
.selected-projects { background-color: #f8f8f8; }
.selected-projects h2 { margin-bottom: 20px; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.project-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: none; 
}

.project-item .image-container {
    position: relative;
    width: 100%;
    padding-bottom: 74.16%;
    background-color: #ddd;
    margin-bottom: 15px;
    overflow: hidden;
}

.project-item .image-container img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-item:hover .image-container img { transform: scale(1.05); }

.project-item p {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #000;
}

/* --- BRANDS --- */
.clients { background-color: #f8f8f8; }

.clients p {
    margin-bottom: 30px; 
    font-size: 0.9rem;
}

.clients button {
    background-color: #000;
    color: #fff;
    border: none;
    padding: 14px 28px; 
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px; 
    display: inline-block;
}

.clients-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    grid-template-rows: repeat(3, auto);   
    row-gap: 70px;    
    column-gap: 40px; 
    margin-bottom: 50px;
    margin-top: 40px;
    align-items: center; 
    justify-items: center; 
    width: 100%;
}

.clients-grid img {
    width: auto;
    max-width: 130px; 
    max-height: 60px;
    display: block;
    filter: grayscale(0%); 
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
    object-fit: contain;
}

.clients-grid img.logo-round { max-height: 85px; max-width: 85px; }
.clients-grid img.logo-wide { max-width: 180px; max-height: 55px; }
.clients-grid img.logo-tall { max-height: 100px; max-width: 110px; }
.clients-grid img:hover { transform: scale(1.1); }

/* --- ABOUT & CAPABILITIES --- */
.section-layout-container {
    display: grid;
    grid-template-columns: 200px 4fr 5fr;
    align-items: start;
}

.section-layout-container h2 { margin-bottom: 0; }

.about-content, .capabilities-content {
    grid-column: 3 / 4;
    padding: 0 150px 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 40px;
}

.about-team, .about-roles { font-size: 0.9rem; }
.about-team { color: #000; font-weight: bold; grid-column: 1 / 2; }
.about-roles { grid-column: 2 / 3; }

.about-description, .capabilities-content > p {
    grid-column: 1 / -1;
    margin-top: 30px;
    font-size: 0.9rem;
    max-width: 80%; /* Keeps it from running too wide */
}

.capabilities-content ul { list-style: none; font-size: 0.9rem; }
.capabilities-content ul:nth-of-type(1) { grid-column: 1 / 2; }
.capabilities-content ul:nth-of-type(2) { grid-column: 2 / 3; }

/* --- CONTACT & FOOTER --- */
.contact { background-color: #f8f8f8; }
.contact-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
    font-size: 0.9rem;
}

footer {
    background-color: #000;
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}
.footer-logo { font-size: 5rem; font-weight: bold; line-height: 1; }

/* --- MAGAZINE REEL --- */
.magazine-section {
    position: relative; 
    padding: 0 0 80px 0;
    overflow: hidden;
    background-color: #f4f4f4; 
}

.magazine-section h2, 
.magazine-section .gallery-context-text {
    padding: 0 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.magazine-reel {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 40px 50px; 
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    align-items: center; 
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

.magazine-reel::-webkit-scrollbar { display: none; }

.spread-item {
    flex: 0 0 auto;
    margin: 0 20px; 
    scroll-snap-align: center;
    position: relative;
    transition: transform 0.3s ease;
}

.spread-item.is-spread::after {
    content: '';
    position: absolute;
    top: 0; left: 50%; bottom: 0;
    width: 60px;
    transform: translateX(-50%);
    background: linear-gradient(to right, 
        rgba(0,0,0,0.0), 
        rgba(0,0,0,0.05) 45%, 
        rgba(0,0,0,0.15) 50%, 
        rgba(0,0,0,0.05) 55%, 
        rgba(0,0,0,0.0) 
    );
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 5;
}

.spread-item img {
    height: 80vh; 
    max-height: 800px; 
    width: auto; 
    display: block;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
}

.spread-item.is-cover img { z-index: 2; }
.spread-item:hover { transform: translateY(-5px); }

.page-number {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    font-family: monospace;
}

.reel-nav-btn {
    position: absolute;
    top: 55%; 
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    border: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    opacity: 0.8;
    transition: all 0.2s ease;
    cursor: pointer;
}

.reel-nav-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.reel-prev { left: 20px; }
.reel-next { right: 20px; }

.mobile-hint {
    display: none;
    text-align: center;
    font-size: 0.75rem;
    color: #aaa;
    margin-top: -20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reel-instruction {
    text-align: center;
    font-family: monospace;
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 10px;
    margin-top: 10px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- LABS 3D STYLES --- */
.labs-page {
    overflow: hidden;
    position: relative;
    z-index: 0;
}
.labs-page::before {
    content: '';
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('images/Seamless Grid.svg');
    background-repeat: repeat;
    background-size: 70px 70px;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}
.labs-controls {
    position: fixed; bottom: 20px; left: 20px;
    background: rgba(255,255,255,0.8);
    padding: 8px 15px;
    border-radius: 5px;
    z-index: 1001;
    display: flex; align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.labs-controls input[type="range"] {
    width: 100px;
    margin-right: 8px;
    accent-color: #555;
    cursor: pointer;
}

/* --- ANIMATION UTILS --- */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Club Ricambi Layouts --- */
.project-gallery-2col-custom {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    align-items: start; 
}
.project-gallery-2col-custom .gallery-column-stacked {
    display: flex; flex-direction: column; gap: 20px; 
}
.project-gallery-2col-custom .gallery-image-item img,
.project-gallery-2col-custom .gallery-column-stacked .gallery-image-item img {
    width: 100%; height: auto; display: block;
}
.project-gallery-4col {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; 
}
.project-gallery-4col .gallery-image-item img {
    width: 100%; height: auto; display: block;
}

/* --- BEFORE / AFTER SLIDER STYLES --- */
.comparison-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: ew-resize; 
    user-select: none; 
    -webkit-user-select: none;
    line-height: 0; 
}

.img-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden;
}

.bottom-layer { position: relative; width: 100%; z-index: 1; }
.top-layer { z-index: 2; width: 100%; clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); }

.comparison-container img {
    display: block; 
    width: 100%; 
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.slider-label {
    position: absolute;
    top: 15px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(2px);
}
.label-before { left: 15px; }
.label-after { right: 15px; }

.compare-handle {
    position: absolute; 
    top: 0; bottom: 0; left: 50%;
    width: 2px; background: #fff; z-index: 10;
    pointer-events: none; 
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.3));
}

.handle-circle {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    background: #fff; border-radius: 50%;
    color: #000; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.handle-circle svg { width: 14px; height: 14px; display: block; margin: 0 -2px; }

/* --- MOBILE & TABLET MEDIA QUERIES --- */
@media (max-width: 768px) {
    header { flex-direction: column; height: auto; padding: 20px 10px; gap: 15px; }
    header nav ul { gap: 20px; justify-content: center; flex-wrap: wrap; padding: 0; }
    header nav ul li { margin-left: 0; }
    h1 { font-size: 2.5rem !important; }
    h2 { font-size: 2rem !important; }
    p { font-size: 1rem !important; }
    
    /* Increase top padding so header doesn't cover video */
    body { padding-top: 160px; }

    /* LAYOUT: Stack Title above Content */
    .section-layout-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px;
    }
    
    .section-layout-container h2 {
        margin-bottom: 20px !important;
    }

    /* ABOUT: Stack Internal Details */
    .about-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding-right: 0 !important;
    }
    .about-team, .about-roles, .about-description {
        width: 100% !important;
    }
    
    .about-description, .capabilities-content > p {
        max-width: 100%; /* Reset max-width on mobile */
    }

    /* CAPABILITIES: Side-by-Side Lists (2 Cols) */
    .capabilities-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
        padding-right: 0 !important;
    }
    
    .capabilities-content ul {
        margin-bottom: 0 !important;
    }
    
    /* Ensure paragraph spans full width below lists */
    .capabilities-content > p {
        grid-column: 1 / -1 !important;
        margin-top: 20px !important;
    }

    /* Project Grids */
    .project-grid { grid-template-columns: 1fr !important; }
    .project-gallery, .project-gallery-2col, .project-gallery-3col, .project-gallery-4col, .project-gallery-2col-custom { grid-template-columns: 1fr !important; gap: 20px !important; }
    .gallery-image-item, .project-gallery-2col .gallery-image-item img { width: 100% !important; max-height: none !important; margin: 0 !important; }
    .project-details-grid { grid-template-columns: 1fr; gap: 40px; }
    .clients-grid { grid-template-columns: repeat(2, 1fr) !important; row-gap: 50px !important; column-gap: 30px !important; }
    .magazine-reel { padding: 20px; align-items: flex-start; }
    .spread-item { margin: 0 10px; }
    .spread-item img { height: auto; width: 100%; max-height: none; }
    .spread-item.is-cover { width: 85vw; }
    .spread-item.is-spread { width: 95vw; }
    .reel-nav-btn { display: none; }
    .mobile-hint { display: block; }
    .labs-controls { width: 90%; bottom: 30px; }
    input[type=range]::-webkit-slider-thumb { height: 24px; width: 24px; margin-top: -10px; }
    .custom-cursor { display: none !important; }
    .project-link, .project-link *, #canvas-container { cursor: auto !important; }
    .compare-handle { width: 1px; }
    .handle-circle { width: 30px; height: 30px; }
    
    /* Centered Blurb Mobile */
    .centered-blurb { padding: 40px 10px; }
}