/* --- Variables & Reset --- */
:root {
    --bg-dark: #0a0a0a;
    /* Darker black */
    --bg-light: #f4f4f4;
    --text-light: #f0f0f0;
    --text-dark: #111111;
    --accent: #ccff00;
    /* NEON LIME */
    --accent-2: #ff5500;
    /* NEON ORANGE */

    --font-main: 'Inter', sans-serif;
    --font-display: 'Oswald', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-main);
    font-size: 16px;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.5s ease, color 0.5s ease;
    /* Smooth global transition */
}

/* --- Canvas 3D --- */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    /* Behind everything */
    pointer-events: none;
    /* Let clicks pass through */
}

/* --- Micro-Graphics --- */
.micro-graphics-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Above canvas, below content? Or -1 to sit with canvas */
    pointer-events: none;
}

.mg-element {
    position: absolute;
    opacity: 0.6;
    transition: color 0.5s, border-color 0.5s;
}

/* Crosshair */
.mg-crosshair {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mg-crosshair::before,
.mg-crosshair::after {
    content: '';
    position: absolute;
    background: var(--neon-green);
}

.mg-crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
}

.mg-crosshair::after {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
}

.mg-crosshair.top-right {
    top: 15%;
    right: 10%;
}

/* Network Cluster */
.mg-network-cluster {
    width: 100px;
    height: 100px;
}

.mg-network-cluster.bottom-left {
    bottom: 15%;
    left: 5%;
}

.net-node {
    width: 6px;
    height: 6px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 5px var(--neon-green);
}

.n1 {
    top: 0;
    left: 50%;
}

.n2 {
    bottom: 0;
    left: 0;
}

.n3 {
    bottom: 0;
    right: 0;
}

.net-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    height: 1px;
    transform-origin: 0 0;
}

/* Just decorative lines */
.l1 {
    top: 3px;
    left: 50%;
    width: 56px;
    transform: rotate(116deg);
}

.l2 {
    top: 3px;
    left: 50%;
    width: 56px;
    transform: rotate(63deg);
}

/* Data Stream */
.mg-data-stream {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--neon-green);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mg-data-stream.right-middle {
    top: 40%;
    right: 5%;
}

/* Radar */
.mg-radar {
    width: 60px;
    height: 60px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-radar::after {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--neon-green);
    border-radius: 50%;
}

.radar-scan {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(74, 222, 128, 0.2) 60deg, transparent 61deg);
    animation: radarSpin 2s linear infinite;
}

.mg-radar.top-left {
    top: 20%;
    left: 10%;
}

@keyframes radarSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Micro-Graphics Expanded --- */
.mg-corner-tl {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
}

.mg-corner-br {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
}

.mg-scale-bar {
    position: absolute;
    right: 3rem;
    bottom: 50%;
    height: 100px;
    width: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.scale-tick {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.4);
}

.scale-tick:nth-child(5n) {
    width: 200%;
    margin-left: -100%;
    background: var(--accent);
}

.mg-hex-grid {
    position: absolute;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    opacity: 0.5;
}

.hex {
    width: 10px;
    height: 10px;
    border: 1px solid var(--accent-2);
    /* Orange */
    transform: rotate(45deg);
}

/* Invert colors class for light sections */
.micro-graphics-container.inverted .net-node {
    background: #111;
    box-shadow: none;
}

.micro-graphics-container.inverted .net-line {
    background: rgba(0, 0, 0, 0.2);
}

.micro-graphics-container.inverted .mg-crosshair {
    border-color: rgba(0, 0, 0, 0.2);
}

.micro-graphics-container.inverted .mg-crosshair::before,
.micro-graphics-container.inverted .mg-crosshair::after {
    background: #111;
}

.micro-graphics-container.inverted .mg-data-stream {
    color: #111;
}

.micro-graphics-container.inverted .mg-radar {
    border-color: rgba(0, 0, 0, 0.2);
}

.micro-graphics-container.inverted .mg-radar::after {
    background: #111;
}

.micro-graphics-container.inverted .radar-scan {
    background: conic-gradient(from 0deg, transparent 0deg, rgba(0, 0, 0, 0.1) 60deg, transparent 61deg);
}

/* Inversion Logic for graphics */
.micro-graphics-container.inverted .mg-corner-tl,
.micro-graphics-container.inverted .mg-corner-br {
    border-color: #111;
}

.micro-graphics-container.inverted .scale-tick {
    background: rgba(0, 0, 0, 0.4);
}

.micro-graphics-container.inverted .scale-tick:nth-child(5n) {
    background: #111;
}

.micro-graphics-container.inverted .hex {
    border-color: #111;
}

/* --- Fixed Header --- */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    mix-blend-mode: difference;
    /* FORCE READABILITY */
    color: #fff;
    background: transparent;
}

.header-logo {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-nav {
    display: flex;
    gap: 3rem;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background: #fff;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* --- Hero Section (Dark) --- */
.hero-section {
    min-height: 100vh;
    padding: 8rem 4rem 4rem 4rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: transparent;
    /* Transparent to see 3D */
}

.hero-background-text {
    /* Removed large text to clear view for 3D */
    display: none;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.hero-title-wrapper {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Oswald', sans-serif;
    /* Changed font */
    font-size: 10vw;
    line-height: 0.85;
    font-weight: 700;
    /* Oswald bold */
    letter-spacing: 0px;
    /* Reset spacing for Oswald */
    margin: 0;
    text-transform: uppercase;
}

.hero-title.outline {
    color: transparent;
    -webkit-text-stroke: 2px #fff;
    margin-left: 2rem;
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image {
    width: 100vw;
    /* Full viewport width */
    max-width: none;
    /* Remove limit */
    height: auto;
    filter: grayscale(100%) contrast(1.2) brightness(0.8);
    transition: all 0.5s ease;
    margin-left: -50vw;
    /* Center relative to container if container is centered */
    left: 50%;
    /* Position technique for breaking out of container */
    position: relative;
    /* Adjust opacity if it clashes with text too much */
    opacity: 0.8;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    position: relative;
    border: 1px solid var(--accent);
    box-shadow: 0 0 50px rgba(76, 145, 255, 0.2);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-dark);
}

.modal-title {
    font-family: var(--font-main);
    font-weight: 900;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 1rem;
    text-transform: uppercase;
}

.modal-body {
    font-family: var(--font-main);
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 1rem;
}

.hero-image:hover {
    filter: grayscale(0%) contrast(1) brightness(1);
    transform: scale(1.02);
}

.hero-visual-decor {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
}

.decor-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.hero-subtitle {
    grid-column: 1 / -1;
    margin-top: 4rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    transform: rotate(-90deg);
    transform-origin: left;
}

.scroll-line {
    width: 50px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

/* --- Selected Works (Light) --- */
.works-section {
    background-color: transparent;
    /* Was var(--bg-light) - now transparent for 3D BG */
    color: var(--text-dark);
    /* Contrast Switch */
    padding: 8rem 4rem;
    position: relative;
    /* We need to ensure text is engaging but BG comes from body/fixed element */
}

.section-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

.section-label.light-text {
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Tech Borders & Accents --- */
.tech-border {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s ease;
}

.tech-border:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Corner Accents for containers */
.corner-accents {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.corner-accents span {
    position: absolute;
    width: 6px;
    height: 6px;
    border: 2px solid var(--accent);
    transition: all 0.3s ease;
}

.corner-accents span:nth-child(1) {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner-accents span:nth-child(2) {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.corner-accents span:nth-child(3) {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.corner-accents span:nth-child(4) {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.project-card:hover .corner-accents span,
.video-wrapper:hover .corner-accents span {
    width: 20px;
    height: 20px;
    border-color: var(--accent-2);
    /* Orange on hover */
}

/* Selected Works Grid Adjustment */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    /* Flexible but minimum 400px */
    gap: 2rem;
    justify-content: center;
}

.project-card {
    grid-column: span 1;
    /* Reset span */
    margin-bottom: 2rem;
    cursor: pointer;
    /* Remove specific offsets */
    margin-top: 0 !important;
}

/* Force Uniform Size Container */
.project-image-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    width: 100%;
    height: 300px;
    /* FIXED HEIGHT */
    max-width: 400px;
    /* FIXED MAX WIDTH to match smallest */
    margin-left: auto;
    margin-right: auto;
}

.project-image {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    object-fit: cover;
    /* Crop to fill fixed box perfectly */
    filter: grayscale(100%);
}

.project-card:hover .project-image {
    transform: scale(1.05);
    filter: grayscale(0%);
}

.project-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
    background: rgba(27, 27, 27, 0.9);
    padding: 1rem 2rem;
}

.view-project {
    color: #fff;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.project-card:hover .project-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-title {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.project-cat {
    font-size: 0.9rem;
    color: #666;
}

/* --- About / Specs (Dark) --- */
.about-section {
    background-color: transparent;
    /* Was var(--bg-dark) */
    color: var(--text-light);
    padding: 8rem 4rem;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
}

.section-heading {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.about-desc {
    font-size: 1.2rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    max-width: 600px;
}

.specs-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.spec-item {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    position: relative;
    transition: padding-left 0.3s ease;
}

.spec-item:hover {
    padding-left: 20px;
    border-color: var(--accent);
}

.spec-id {
    display: block;
    font-size: 0.7rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.spec-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.spec-detail {
    color: rgba(255, 255, 255, 0.5);
}

/* --- Showcase (Light) --- */
.showcase-section {
    background-color: transparent;
    /* Was var(--bg-light) */
    color: var(--text-dark);
    padding: 8rem 4rem;
}

/* Video Grid Adjustment */
.video-grid-sc {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 videos per row */
    gap: 1.5rem;
}

.video-wrapper {
    background: #000;
    aspect-ratio: 16/9;
    position: relative;
    overflow: hidden;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.video-wrapper:hover video {
    opacity: 1;
}

.video-label {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--accent);
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    text-transform: uppercase;
    transform: translateY(100%);
    /* Hidden initially */
    transition: transform 0.3s ease;
}

.video-wrapper:hover .video-label {
    transform: translateY(0);
}

/* --- Contact (Dark / Footer) --- */
.contact-section {
    background-color: transparent;
    /* Was var(--bg-dark) */
    color: var(--text-light);
    padding: 8rem 4rem 4rem 4rem;
    min-height: 80vh;
    /* Large footer area */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.contact-title {
    font-size: 8vw;
    line-height: 1;
    font-weight: 900;
    margin-bottom: 4rem;
}

.contact-links {
    display: flex;
    gap: 4rem;
    margin-bottom: 4rem;
}

.contact-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.contact-link:hover {
    border-color: var(--accent);
}

.contact-meta {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* --- Mobile --- */
@media (max-width: 900px) {
    .fixed-header {
        padding: 1.5rem 2rem;
    }

    .hero-section {
        padding: 6rem 2rem 2rem 2rem;
        text-align: left;
    }

    .hero-background-text {
        font-size: 50vw;
        right: -20vw;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-title {
        font-size: 18vw;
    }

    .hero-title.outline {
        margin-left: 0;
    }

    .works-section,
    .about-section,
    .showcase-section,
    .contact-section {
        padding: 4rem 2rem;
    }

    .works-grid {
        grid-template-columns: 1fr;
    }

    .project-card,
    .project-card:nth-child(2),
    .project-card:nth-child(3) {
        grid-column: span 1;
        margin-top: 0;
        margin-bottom: 3rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .video-grid-sc {
        grid-template-columns: 1fr;
    }

    .contact-title {
        font-size: 15vw;
    }

    .contact-links {
        flex-direction: column;
        gap: 1.5rem;
    }
}