@font-face {
    font-family: 'LT Saeada Black';
    /* Using Impact as fallback for the brutalist aesthetic since we don't have the font file locally */
    src: url('LTSaeada-Black.otf') format('opentype'), local('Impact');
}

:root {
    --bg-black: #050505;
    --bg-red: #d2584a; /* Main Bruiser Red */
    --text-white: #fbf9ee; /* Lens white */
    --font-brutal: 'LT Saeada Black', Impact, sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

body {
    background-color: var(--bg-red); /* Body is red to seamlessly transition from preloader */
    font-family: var(--font-mono);
    color: var(--text-white);
    overflow: hidden; /* Prevent scroll while loading */
}

#dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-red);
    z-index: -3; /* Behind everything */
}

/* Dynamic Particle System */
#particle-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden;
    z-index: -2; /* Above bg, behind content */
}

.particle-wrapper {
    position: absolute;
    will-change: transform;
}

.tech-particle-white {
    color: var(--text-white);
    font-family: var(--font-mono);
    font-weight: bold;
    user-select: none;
    text-shadow: 0 0 8px rgba(251, 249, 238, 0.4); /* White glow */
    will-change: transform;
}


/* Main Content Structure */
#main-content {
    opacity: 0; /* Hidden initially, revealed after preloader */
    visibility: hidden;
    z-index: 1; /* Content above background layers */
    position: relative;
}

/* Block background classes for contrast (now transparent to let dynamic-bg show) */
.bg-red, .bg-dark {
    background-color: transparent;
}

.bg-dark {
    color: var(--text-white);
}

.brutal-title {
    font-family: var(--font-brutal);
    text-transform: uppercase;
    line-height: 0.9;
}

.mono-desc {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    opacity: 0.9;
}

/* SECTION_00: BRUTAL HERO */
.brutal-hero {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 10vh; /* Give space for absolute elements */
}

.hero-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2vw; /* Space between logo and text */
    z-index: -1; /* Placed behind main readable content but above bg */
    will-change: transform, opacity;
}

.hero-logo {
    width: 15vw; /* Scale proportionally to text */
    height: auto;
}

.massive-text {
    font-size: 15vw; /* Slightly smaller to fit logo and kerning */
    letter-spacing: -0.05em; /* Adjusted to look good with the new font */
    margin: 0;
    text-align: center;
    white-space: nowrap;
    text-transform: lowercase; /* Enforcement of lowercase */
}

.hero-sub {
    margin-top: 5vh; /* Safe distance below the massive element */
    text-align: center;
    z-index: 1; /* Keep readable above parallaxed massive text */
}

.absolute-status {
    position: absolute;
    top: 40px;
    left: 40px;
}

.system-status {
    color: var(--text-white);
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--text-white);
    display: inline-block;
    margin-right: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

/* SECTION_01: CAPABILITIES_GRID */
.capabilities-section {
    padding: 100px 10%;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.module-card {
    position: relative;
    padding: 40px 30px;
    background-color: rgba(210, 88, 74, 0.05); /* very light red */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: none;
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.3s;
}

.module-card:hover {
    background-color: rgba(210, 88, 74, 0.15);
}

.module-border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Micro-details */
.corner-detail {
    position: absolute;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.6rem;
    color: rgba(251, 249, 238, 0.5); /* subtle white */
    z-index: 2;
    pointer-events: none;
}

.top-left { top: 5px; left: 5px; }
.top-right { top: 5px; right: 5px; }
.bottom-left { bottom: 5px; left: 5px; }
.bottom-right { bottom: 5px; right: 5px; }

.module-content {
    position: relative;
    z-index: 3;
}


.module-title {
    font-family: 'LT Saeada Black', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 25px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.module-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(10px);
}

/* MARQUEE INTERMEDIO */
.marquee-section {
    background-color: var(--bg-black);
    color: var(--text-white);
    padding: 30px 0;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(251, 249, 238, 0.2);
    border-bottom: 1px solid rgba(251, 249, 238, 0.2);
}

.marquee-content {
    display: inline-block;
    font-size: 2rem;
    font-weight: bold;
    animation: marquee-anim 15s linear infinite;
    will-change: transform;
}

.marquee-content span {
    padding-right: 50px;
}

@keyframes marquee-anim {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.3333%); /* Based on 3 identical spans */ }
}


/* SECTION_02: DEPLOYED_SYSTEMS */
.projects-section {
    padding: 100px 0 0;
    /* Adjust padding to remove excessive space for snapping */
}

.project-container {
    padding: 100px 10%;
    margin-bottom: 100px;
    display: flex;
    flex-direction: column;
}

.project-gallery {
    display: flex;
    flex-direction: column;
    gap: 30px; /* Space between stacked images */
    width: 100%;
    margin-top: 40px;
}

.project-img-stacked {
    width: 100%;
    height: auto;
    object-fit: contain;
    border: 1px solid rgba(251, 249, 238, 0.1);
}


.project-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--text-white);
    /* For custom font LT Saeada Black, already applied via .brutal-title if needed, else explicit: */
    font-family: 'LT Saeada Black', sans-serif;
    line-height: 1.1;
    word-break: break-word; /* Ensure it fits on mobile */
}

.project-title span {
    color: var(--bg-red);
}

.project-desc {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* SECTION_03: FOOTER_TERMINAL */
.footer-section {
    padding: 100px 10% 50px;
    border-top: 1px solid rgba(251, 249, 238, 0.1);
    /* For reel effect to allow scroll down to footer properly on mobile */
    scroll-snap-align: end;
}

.cta-container {
    text-align: center;
    margin-bottom: 150px;
}

.cta-link {
    font-size: 4vw; /* Adjusted for standard viewing */
    color: var(--text-white);
    text-decoration: none;
    transition: color 0.3s;
    display: inline-block;
    word-break: break-all; /* Prevent overflow on tight screens */
}

.cta-link .red-text {
    color: var(--bg-red);
    transition: color 0.3s;
}

.cta-link:hover {
    color: var(--bg-red);
}

.cta-link:hover .red-text {
    color: var(--text-white);
}

@media (max-width: 768px) {
    .cta-link {
        font-size: 6vw; /* Larger relatively on mobile but fits on one line compared to 8vw */
    }
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    opacity: 0.5;
}

.social-links a {
    color: var(--text-white);
    text-decoration: none;
    margin-right: 20px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--bg-red);
}

/* SplitType utility classes */
.word {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
}

.char {
    transform: translateY(115%);
    transition: transform .5s;
}

section.preload {
    z-index: 10000;
    height: 100vh;
    width: 100vw;
    display: table;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: all 0.5s;
    background-color: #d2584a;
}

section.preload .loader {
    display: table-cell;
    vertical-align: middle;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

section.preload svg {
    max-width: 300px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* SVG Path Drawing Animation Setup */
section.preload svg .p-anim {
    fill: transparent;
    stroke: #fbf9ee; /* Exact white from lens */
    stroke-width: 5;
    stroke-dasharray: 25000;
    stroke-dashoffset: 25000;
    animation-name: draw;
    animation-duration: 1.5s; /* Synced with fast terminal typing (~1.5s) */
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
    animation-timing-function: ease-in-out;
}

/* Specific fill colors mapped from the SVG classes */
.finished-loading .cls-1 { fill: #d2584a !important; stroke: transparent !important; }
.finished-loading .cls-2 { fill: #4c5159 !important; stroke: transparent !important; }
.finished-loading .cls-3 { fill: #fbf9ee !important; stroke: transparent !important; }
.finished-loading .cls-4 { fill: #4e535b !important; stroke: transparent !important; }
.finished-loading .cls-5 { fill: #d25a4c !important; stroke: transparent !important; }

@keyframes draw {
    0% { stroke-dashoffset: 25000; fill: transparent; stroke: #fbf9ee;}
    80% { stroke-dashoffset: 0; fill: transparent; stroke: #fbf9ee;}
    100% { stroke-dashoffset: 0; fill: transparent; stroke: transparent;}
}

/* Transition for filling color at 100% */
section.preload svg.fill-colors .p-anim {
    transition: fill 0.3s ease, stroke 0.3s ease;
}

/* Terminal UI Setup */
#terminal-container {
    font-family: 'Courier New', Courier, monospace; /* Monospace technical font */
    color: #fbf9ee; /* Exact white from lens */
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    position: absolute;
    bottom: 40px;
    left: 40px;
    max-width: 80%;
    line-height: 1.5;
    z-index: 10;
}

/* Blinking cursor */
.terminal-cursor {
    display: inline-block;
    width: 10px;
    height: 18px;
    background-color: #fbf9ee;
    vertical-align: text-bottom;
    animation: blink 0.7s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Flicker effect for final terminal text */
.flicker {
    animation: flicker-anim 0.2s infinite;
}

@keyframes flicker-anim {
    0% { opacity: 1; }
    25% { opacity: 0.3; }
    50% { opacity: 0.8; }
    75% { opacity: 0.1; }
    100% { opacity: 1; }
}

/* Hidden state for terminal after flicker */
#terminal-container.hide {
    display: none;
}
/* SCROLL INDICATOR */
.scroll-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    cursor: pointer;
    opacity: 0; /* Hidden initially, controlled by GSAP */
    visibility: hidden;
}

/* Major sections snap configuration */
.major-section {
    scroll-snap-align: start;
}


/* Watermark for cards */
.module-card::after {
    content: attr(data-module);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'LT Saeada Black', sans-serif;
    font-size: 15rem;
    color: var(--text-white);
    opacity: 0.02;
    z-index: 0;
    pointer-events: none;
    line-height: 1;
}

/* Mobile-specific fixes for Reels layout */
@media (max-width: 768px) {
    /* Disable snap on the parent section so we can snap inside */
    .capabilities-section {
        scroll-snap-align: none;
    }

    .grid-container {
        display: block; /* Override grid */
    }

    .module-card {
        height: 100vh;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-radius: 0; /* Ensures flush fit */
        scroll-snap-align: start; /* Native CSS Snap Reel */
    }

    .module-card::after {
        font-size: 12rem; /* slightly smaller on mobile */
    }

    .projects-section {
        scroll-snap-align: none;
    }

    .project-snap {
        min-height: 100vh;
        scroll-snap-align: start; /* Snap per project on mobile */
        padding: 60px 5%;
        margin-bottom: 0; /* remove bottom margin for flush snapping */
        justify-content: flex-start;
    }

    .project-title {
        font-size: 2.5rem; /* Resize massive text for mobile */
    }
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}
