:root {
    --bg-color: #000000;
    --text-primary: #F5F5F5;
    --primary-color: #362075;
    --accent-color: #E65525;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background: radial-gradient(circle at center, #110825 0%, #000000 80%) fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    /* Prevent horizontal scrolling only */
    font-family: 'Space Grotesk', sans-serif;
}

/* --- Header --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through if needed, but we'll enable on links */
}

.header-right {
    display: flex;
    gap: 3rem;
    pointer-events: auto;
}

.header-right a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    transition: all 0.3s ease;
}

.header-right a:hover {
    color: var(--accent-color);
    text-shadow: 0 0 12px rgba(230, 85, 37, 0.6);
}

.header-right a.highlight-link {
    color: var(--bg-color);
    background-color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-shadow: none;
    box-shadow: 0 4px 15px rgba(230, 85, 37, 0.4);
    border: 1px solid var(--accent-color);
}

.header-right a.highlight-link:hover {
    background-color: transparent;
    color: var(--accent-color);
    box-shadow: 0 0 20px rgba(230, 85, 37, 0.8);
    text-shadow: 0 0 12px rgba(230, 85, 37, 0.6);
}

/* --- Hero Section & Canvas --- */
.hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Gigantic Background Text */
.background-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Montserrat', sans-serif;
    font-size: 14vw;
    font-weight: 900;
    text-align: center;
    line-height: 1.0;
    letter-spacing: -2px;
    color: rgba(54, 32, 117, 0.05);
    /* Slight fill instead of transparent */
    -webkit-text-stroke: 2px rgba(88, 56, 185, 0.4);
    /* Brighter stroke outline for contrast */
    text-shadow: 0 0 40px rgba(54, 32, 117, 0.3);
    /* Soft atmospheric glow */
    user-select: none;
    pointer-events: none;
    z-index: 1;
}

/* Three.js Container */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    /* Sits above background text, below header/footer */
}

/* --- Footer --- */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 2rem;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease;
    /* For fading out on scroll */
}

.tagline {
    font-family: 'Fira Code', monospace;
    font-size: 18px;
    font-weight: 500;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.cursor {
    display: inline-block;
    width: 10px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --- Scroll Section --- */
.scroll-section {
    position: relative;
    width: 100vw;
    height: 400vh;
    /* Creates enough scroll space */
    display: flex;
    justify-content: center;
    background: radial-gradient(circle at center, #2e164d 0%, #0a0514 100%);
    /* Removed overflow: hidden because it breaks position: sticky on children */
}

#fluid-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Needs to be sticky essentially, we'll use sticky positioning */
    z-index: 0;
    pointer-events: auto;
    /* Allow mouse interaction for the fluid effect */
}

.scroll-sticky-wrapper {
    position: sticky;
    top: 0;
    width: 100vw;
    height: 100vh;
    /* overflow hidden here is fine since it's the sticky box restricting canvas edges */
    overflow: hidden;
}

.scroll-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    z-index: 10;
    pointer-events: none;
    /* Let mouse through to canvas */
}

.scroll-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 8vw;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(54, 32, 117, 0.8), 0 0 10px rgba(230, 85, 37, 0.5);
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-text.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Specific text coloring for emphasis */
.text-2 {
    color: var(--accent-color);
    font-style: italic;
}

/* --- Services Section (Yuga Labs Style) --- */
.services-section {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    background-color: #030303;
    padding: 10rem 4rem;
    z-index: 5;
    /* Basic CSS noise overlay */
    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="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.05"/%3E%3C/svg%3E');
    overflow: hidden;
}

/* Cinematic Spotlights */
.services-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 40%, rgba(42, 36, 86, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(242, 110, 35, 0.15) 0%, transparent 40%);
    z-index: 1;
}

.services-container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.services-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #FFFFFF 40%, #2A2456 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.4s ease;
    cursor: default;
}

.services-title:hover {
    transform: scale(1.02);
    letter-spacing: 2px;
    background: linear-gradient(135deg, #FFFFFF 20%, #F26E23 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(242, 110, 35, 0.4));
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* Card Styling */
.service-card {
    position: relative;
    background: linear-gradient(180deg, #1A1636 0%, #0A0815 100%);
    border-radius: 24px;
    overflow: hidden;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: pointer;
}

.card-image-wrapper {
    width: 100%;
    height: 250px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.card-content h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: #FFFFFF;
    line-height: 1.2;
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

.card-content p {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    transition: color 0.4s ease;
}

/* Yuga Labs Style Hover Effects */
.service-card:hover {
    transform: translateY(-10px) scale(1.02);
    background: linear-gradient(180deg, #2A2456 0%, #150F33 100%);
    border: 1px solid rgba(242, 110, 35, 0.5);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(242, 110, 35, 0.2),
        inset 0 0 10px rgba(42, 36, 86, 0.5);
}

.service-card:hover .card-image-wrapper img {
    transform: scale(1.15);
    filter: blur(4px) brightness(1.2) contrast(1.2);
}

.service-card:hover .card-content h3 {
    color: #F26E23;
    text-shadow: 0 0 15px rgba(242, 110, 35, 0.6);
}

.service-card:hover .card-content p {
    color: rgba(255, 255, 255, 0.9);
}



/* =========================================
   BRUTALIST COLLAGE PORTFOLIO
   ========================================= */
.portfolio-brutalist {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    /* Changed from #0a0a0a to match the cinematic dark purple of Anorak */
    background: radial-gradient(circle at center, #231d45 0%, #0a0a0a 70%);
    padding: 8rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    z-index: 5;
}

/* Background "Film Grain" Texture */
.portfolio-brutalist::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* A quick CSS radial gradient noise trick or just a subtle pattern */
    background-image: repeating-radial-gradient(circle at 0 0,
            transparent 0,
            #000000 10px), repeating-linear-gradient(#2a2a2a55,
            #2a2a2a55);
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

/* Floating Decorations */
.deco-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.deco-film-strip {
    position: absolute;
    top: 20%;
    left: -10%;
    width: 60%;
    transform: rotate(-15deg);
}

.deco-text {
    position: absolute;
    bottom: 10%;
    right: 5%;
    font-family: 'Black Ops One', sans-serif;
    /* A brutalist fallback font */
    font-size: 8rem;
    color: red;
    /* Will be styled brutalist */
    opacity: 0.03;
    transform: rotate(90deg);
    transform-origin: bottom right;
    white-space: nowrap;
}

.brutalist-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 4rem;
    color: #F5F5F5;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 5rem;
    text-align: center;
    position: relative;
    z-index: 10;
    text-shadow: 4px 4px 0px #392b68;
    /* Brutalist solid shadow */
}

/* Masonry/Grilla Orgánica */
.brutalist-grid {
    position: relative;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
    z-index: 5;
}

/* Contenedor de "Recorte" (Sticker/Polaroid effect) */
.brutalist-item {
    position: relative;
    width: 380px;
    aspect-ratio: 16 / 9;
    background-color: #fff;
    /* Border color simulation */
    padding: 5px;
    /* The "White Border" */
    cursor: pointer;

    /* Random inline rotation --rot applied in HTML */
    transform: rotate(var(--rot, 0deg));

    /* HARD SHADOW (Brutalist style) */
    box-shadow: 12px 12px 0px #111111;

    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.brutalist-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.2);
    /* Desaturated initially */
    transition: filter 0.3s ease;
    display: block;
}

/* HOVER STATE: El efecto interactivo principal */
.brutalist-item:hover {
    /* Straighten, scale up slightly, and move up */
    transform: rotate(0deg) scale(1.15) translateY(-10px);
    z-index: 999 !important;
    /* Bring to very front */

    /* Change border color and shadow color to Brand Colors */
    background-color: #392b68;
    /* Anorak Purple border */
    box-shadow: 20px 20px 0px #e85d26;
    /* Studio Orange hard shadow */
}

.brutalist-item:hover .brutalist-thumb {
    filter: grayscale(0%) contrast(1);
    /* Full color */
}

/* YouTube injected hover iframe */
.b-hover-iframe {
    position: absolute;
    top: 5px;
    left: 5px;
    /* Account for the 5px padding/border */
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    border: none;
    pointer-events: none;
    z-index: 5;
}

/* =========================================
   BRUTALIST FULLSCREEN LIGHTBOX 
   ========================================= */
.b-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.b-modal.active {
    display: flex;
}

.b-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: grayscale(100%) blur(5px);
}

.b-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    background-color: #111;
    z-index: 10001;
    /* Brutalist border and shadow for the modal too */
    padding: 10px;
    background-color: #fff;
    box-shadow: 15px 15px 0px #e85d26;
}

.b-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.b-close-btn {
    position: absolute;
    top: 2rem;
    right: 3rem;
    background: #e85e25;
    color: #fff;
    border: 3px solid #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    padding: 10px 20px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 6px 6px 0px #000;
    transition: all 0.2s;
    z-index: 10002;
}

.b-close-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 4px 4px 0px #000;
}

.b-close-btn:active {
    transform: translate(6px, 6px);
    box-shadow: 0px 0px 0px #000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        text-align: center;
    }

    .header-right {
        gap: 1rem;
        flex-direction: column;
        justify-content: center;
        width: 100%;
    }

    .header-right a {
        width: 100%;
        max-width: 300px;
        display: block;
        margin: 0 auto;
        padding: 0.8rem;
    }

    .background-text {
        font-size: 18vw;
    }

    .services-section {
        padding: 5rem 1.5rem;
    }

    .services-title {
        font-size: 2.5rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    /* Brutalist Mobile Adjustments */
    .portfolio-brutalist {
        padding: 4rem 1rem;
    }

    .brutalist-title {
        font-size: 2.5rem;
        margin-bottom: 2rem;
    }

    .brutalist-grid {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
        padding: 0;
    }

    .brutalist-item {
        width: 100%;
        max-width: 400px;
        /* Reset manual offset margins on mobile for a single column */
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .b-close-btn {
        top: 1rem;
        right: 1rem;
        font-size: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}