/* ─── BASE RESET & VARIABLES ─── */
/* AUDIT FIX: Global * reset gescooped naar componenten — Divi gebruikt eigen resets */
.portfolio-section *,
.portfolio-section *::before,
.portfolio-section *::after,
.featured-project *,
.marquee-wrapper *,
#detail-view * {
    box-sizing: border-box;
}

:root {
    /* HSL darkened from 3B605F */
    --bg: #050505;
    --fg: #ffffff;
    --muted: #8aa9a8;
    --accent: #8FE0DD;
    --radius-card: 28px;
    --ease-flip: cubic-bezier(0.85, 0, 0.15, 1);
}

/* AUDIT FIX: body background op html+body niveau — hogere specificiteit dan Divi theme overrides */
html,
body {
    overflow-x: hidden;
    background-color: var(--bg) !important;
}

/* ─── DIVI SECTION ACHTERGROND (portfolio-fx-section) ─── */
/* Voeg CSS class 'portfolio-fx-section' toe aan de Divi Section in de Visual Builder.
   Dit is de meest betrouwbare aanpak — werkt ook zonder #portfolio-bg-fx div in DOM. */
.et_pb_section.portfolio-fx-section {
    position: relative !important;
    background-color: #050505 !important;
    overflow: hidden !important;
    z-index: 1 !important;
}

/* Radiale teal glow — vanuit midden, 0.06 opacity */
.et_pb_section.portfolio-fx-section::before {
    content: "";
    position: absolute;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: radial-gradient(circle at 50% 50%,
            hsla(178, 62%, 72%, 0.06) 0%,
            hsla(180, 25%, 9%, 0) 75%);
    pointer-events: none;
    z-index: 0;
}

/* Vederlichte SVG noise grain — 0.025, 0 HTTP requests */
.et_pb_section.portfolio-fx-section::after {
    content: "";
    position: absolute;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Content boven pseudo-elementen */
.portfolio-fx-section .et_pb_row,
.portfolio-fx-section .et_pb_column {
    position: relative;
    z-index: 1;
}

#page-container,
.et_builder_inner_content,
#et-main-area {
    background-color: transparent !important;
    position: relative;
    z-index: 2;
    /* Sit above the fixed background FX */
}

/* Maak alle secties doorzichtig voor de ambient glow, BEHALVE sectie 1 */
.et_pb_section {
    background-color: transparent !important;
    position: relative;
    z-index: 2;
    /* Sit above the fixed background FX */
}

.et_pb_section:first-of-type {
    background-color: var(--bg) !important;
    position: relative;
    z-index: 2;
    /* Bovenop de fixed glow */
}

/* ─── SECTION BACKGROUND RESTORE ─── */
/* Werkwijze (X-Axis) & Featured Projects (Cuberto) krijgen een eigen
   solide achtergrond — de landing ambient glow mag daar niet doorheen. */
.et_pb_section.fase3-section,
.et_pb_section.portfolio-fx-section {
    background-color: #050505 !important;
}

/* Disable native smooth scroll — prevents interference with GSAP animations */
html {
    scroll-behavior: auto;
}

body {
    font-family: 'Inter', sans-serif;
}

/* ─── TACTILE ACHTERGROND FX (#portfolio-bg-fx fallback) ─── */
/* Dit is de legacy fixed-div aanpak — werkt alleen als <div id="portfolio-bg-fx"> in DOM staat.
   Gebruik portfolio-fx-section hierboven als betrouwbaardere oplossing. */
#portfolio-bg-fx {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    transform: translateZ(0);
}

#portfolio-bg-fx::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 50% 50%,
            hsla(178, 62%, 72%, 0.06) 0%,
            hsla(180, 25%, 9%, 0) 75%);
}

#portfolio-bg-fx::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

body.no-cursor {
    cursor: none;
}

/* ─── G-FORCE CURSOR (Spring Physics) ─── */
#cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    mix-blend-mode: difference;
    /* Adaptive contrast */
}

.cursor-bg {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    transform-origin: center center;
}

#cursor .cursor-label {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 13px;
    font-weight: 700;
    color: #000;
    letter-spacing: 1px;
    opacity: 0;
    z-index: 2;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

/* ─── LAYOUT & HEADER ─── */
.portfolio-section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 160px 60px 80px;
}

.portfolio-section.bottom {
    padding-top: 80px;
    padding-bottom: 200px;
}

.section-header {
    margin-bottom: 120px;
}

.section-header h2 {
    font-size: clamp(3rem, 7vw, 7rem);
    font-weight: 300;
    letter-spacing: -0.04em;
    line-height: 1;
}

.section-header h2 strong {
    font-weight: 700;
    display: block;
    padding-left: 12vw;
}

/* ─── GRID (Asymmetrical) ─── */
/* Note: Divi handles the grid logic for et_pb_row with 2 columns, 
           so we just need to add the asymmetrical margin to the second column. */
.featured-project:nth-child(even),
.project:nth-child(even) {
    margin-top: 180px !important;
}

/* ─── PROJECT CARD (ET_PB_COLUMN) ─── */
.featured-project,
.project {
    cursor: pointer;
    visibility: hidden;
    /* JS will fade them up */
    position: relative;
}

.featured-media,
.project-thumb-wrapper {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    aspect-ratio: var(--ar, 4/5);
    background: #000;
    /* Subtiele shadow drop op hover (Lift off background) */
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0);
    transition: box-shadow 0.15s ease, transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-project:hover .featured-media,
.project:hover .project-thumb-wrapper {
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.92);
    /* Snappier inverse parallax outer shrink */
}

/* Lazy blurred placeholder */
.lazy-placeholder {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    transform: scale(1.1);
    z-index: 1;
    transition: opacity 0.8s ease;
}

.featured-media .et_pb_video_wrap video,
.featured-media video,
.project-thumb-wrapper video,
.project-thumb-wrapper svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
    transform: scale(1.05);
    /* Inverse parallax inner grow */
    transition: opacity 0.8s ease, transform 0.6s ease;
}

/* SVG exception: Inline SVGs usually fully opaque by default */
.project-thumb-wrapper svg {
    opacity: 1; 
}

.featured-project:hover .featured-media video,
.project:hover .project-thumb-wrapper video,
.project:hover .project-thumb-wrapper svg {
    transform: scale(1.0);
    /* Settles back out */
}

/* Meta details under card */
.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding: 0 8px;
}

.featured-title,
.featured-title p,
.featured-title h1,
.featured-title h2,
.featured-title h3,
.project-name {
    font-size: clamp(1.4rem, 2vw, 2rem) !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
    line-height: 1 !important;
}

.featured-category,
.featured-category p,
.project-cat {
    font-size: 1rem !important;
    color: var(--muted) !important;
    margin-bottom: 0 !important;
    text-align: right !important;
}

.project-number {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    z-index: 3;
    mix-blend-mode: difference;
}

/* ─── TESTIMONIAL MARQUEE ─── */
.marquee-wrapper {
    width: 100%;
    padding: 80px 0;
    margin: 40px 0;
    background: var(--bg);
    color: var(--fg);
    overflow: hidden;
    white-space: nowrap;
    display: flex;
}

.marquee-track {
    display: flex;
    gap: 80px;
    width: max-content;
    /* AUDIT FIX D-1: will-change verwijderd — wordt via JS dynamisch gezet tijdens animatie */
}

.quote-item {
    font-size: clamp(2rem, 4vw, 3rem);
    color: rgba(255, 255, 255, 0.6);
}

.quote-item strong {
    color: var(--fg);
    font-weight: 700;
}

.quote-item i {
    font-style: italic;
    font-weight: 300;
}

/* ─── DETAIL VIEW (FLIP Target) ─── */
#detail-view {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: var(--bg);
    color: var(--fg);
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Standard page format, allows scroll */
}

.detail-hero-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: clip;
}

/* Video flips into here */
.flip-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    object-fit: cover;
    border-radius: 0;
}

.detail-content {
    position: absolute;
    bottom: 80px;
    left: 60px;
    z-index: 10;
    max-width: calc(100vw - 120px);
}

.detail-content span,
.detail-content h1 {
    opacity: 0;
    transform: translateY(40px);
}

.detail-content h1 {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-content span {
    font-size: 1.5rem;
    color: var(--muted);
}

/* Back Button (Magnetic pill) */
#back-btn {
    position: fixed;
    top: 40px;
    left: 40px;
    z-index: 100000;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 16px 36px;
    border-radius: 100px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    display: inline-flex;
    pointer-events: none;
    /* activated in JS */
}

/* WP admin bar is 32px tall — push back-btn down when logged in */
.admin-bar #back-btn {
    top: 72px;
}

/* ─── MOBIL / TOUCH FALLBACK & MOCKUP ─── */
.case-study-content {
    padding: 160px 60px 120px;
    max-width: 1160px;
    margin: 0 auto;
}

.cs-header {
    max-width: 860px;
    margin-bottom: 160px;
    padding-left: 8vw;
}

.cs-header h2 {
    font-size: clamp(2.8rem, 5vw, 5rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    margin-bottom: 48px;
}

.cs-header p {
    font-size: 1.5rem;
    color: var(--muted);
    line-height: 1.7;
    font-weight: 300;
}

.cs-grid {
    display: grid;
    grid-template-columns: 5fr 4fr;
    gap: 64px;
    margin-bottom: 160px;
    align-items: end;
}

.cs-image {
    width: 100%;
    aspect-ratio: 4/3;
    background: #1a2a2a;
    border-radius: 20px;
}

.cs-image.left-img {
    aspect-ratio: 3/4;
}

.huge-text {
    font-size: clamp(4rem, 10vw, 12rem);
    font-weight: 700;
    text-align: center;
    opacity: 0.1;
}

.mobile-play-btn {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 50%;
    color: #000;
    font-weight: 700;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

@media (max-width: 800px) {

    /* On mobile, remove the asymmetrical margin */
    .featured-project:nth-child(even),
    .project:nth-child(even) {
        margin-top: 0 !important;
    }

    .portfolio-section {
        padding: 80px 20px;
        color: var(--fg);
    }

    /* Small gutters */
    .section-header h2 {
        padding-left: 0;
    }

    body.no-cursor {
        cursor: auto;
    }

    #cursor {
        display: none !important;
    }

    .mobile-play-btn {
        display: flex;
    }
}