:root {
    --bg-dark: #000;
    --bg-light: #f4f4f4;
    --text-dark: #000;
    --text-light: #fff;
    --accent: #921e17; 
}

/* --- BASE STYLES --- */
body, html {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    font-family: 'Doto', sans-serif;
    font-variation-settings: "RNDS" 100;
    text-transform: uppercase;
    color: var(--text-light);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* GLOBAL CURSOR KILL: Disables Windows pointer everywhere */
*, *::before, *::after {
    cursor: none !important;
}

/* Ensure interactive elements don't force it back on hover */
html, body, a, button, [role="button"], .project-card, .project-card * {
    cursor: none !important;
}

#dotCanvas {
    position: fixed;
    top: 0; left: 0;
    z-index: 1;
    pointer-events: none;
}

section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 10%;
    box-sizing: border-box;
    text-align: center;
}

/* --- CONTENT TRANSITION --- */
#main-content {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1), 
                transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

body.loaded #main-content {
    opacity: 1;
    transform: translateY(0);
}

.dark { background-color: transparent; color: var(--text-light); }
.light { background-color: var(--bg-light); color: var(--text-dark); }

/* --- COMPONENTS --- */
.hero-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    filter: contrast(110%); 
    border: 2px solid var(--text-light);
    margin-bottom: 30px;
    object-fit: cover;
}

.hero-h1 { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: 10px; margin: 10px 0; }
.hero-sub { font-size: 1.2rem; opacity: 0.7; letter-spacing: 4px; border-top: 1px solid currentColor; padding-top: 20px; }

.toolkit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px; width: 100%; margin-top: 50px;
}
/* --- TOOLKIT BOX ENHANCEMENT --- */
.toolkit-box {
    border: 1px solid currentColor;
    padding: 20px;
    background: transparent;
    position: relative;
    z-index: 1;
    /* Smooth transition for scale, background, and the new glow */
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                background 0.3s ease, 
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

.toolkit-box:hover {
    transform: scale(1.1); /* 1.1x expansion */
    z-index: 10;
    background: rgba(146, 30, 23, 0.08); /* Very subtle accent tint */
    border: 2px solid currentColor;
    
    /* THE GLOW: A soft, technical bloom using your accent color */
    box-shadow: 0 0 25px rgba(146, 30, 23, 0.5), 
                0 0 50px rgba(146, 30, 23, 0.2);
}


.toolkit-box h3 { font-size: 0.9rem; margin-bottom: 15px; opacity: 0.6; border-bottom: 1px solid currentColor; padding-bottom: 10px; }
.toolkit-box p { font-size: 1rem; line-height: 1.8; letter-spacing: 1px; }


.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px; width: 100%; margin-top: 50px;
}

.project-card {
    border: 1px solid currentColor;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}


/*.project-card:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); 
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}*/

.light .project-card:hover {
    background: rgba(0,0,0,0.05);
}

@keyframes glitch {
    0% { transform: translate(0); text-shadow: none; }
    20% { transform: translate(-2px, 2px); text-shadow: 2px 0 var(--accent); }
    40% { transform: translate(-2px, -2px); text-shadow: -2px 0 #0ff; }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* --- LOADER SYSTEM --- */
#loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000; 
    z-index: 999999; 
    display: flex; 
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1), visibility 0.5s;
}

body.loaded #loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#progress-text {
    display: inline-block;
    width: 60px;
    text-align: right;
    font-size: 1.5rem;
}

.progress-container { width: 200px; height: 2px; background: #333; margin-top: 20px; }
#progress-bar { height: 100%; width: 0%; background: #fff; transition: width 0.1s linear; }

/* --- SYMMETRIC STEALTH CURSOR --- */
#cursor-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 28px;
    pointer-events: none;
    z-index: 9999999; /* Higher than loader */
    mix-blend-mode: difference;
    opacity: 0; /* Changed from 0.8 to 0 to hide it at 0,0 */
    transition: opacity 0.2s ease;
}

#cursor-glitch.visible {
    opacity: 1;
}

.pointer {
    position: absolute;
    width: 100%;
    height: 100%;
    /* Exact symmetric polygon based on your provided image */
    clip-path: polygon(0% 0%, 100% 70%, 50% 70%, 50% 100%, 0% 0%);
    background: #fff;
}

/* RGB Split Layers */
.red, .cyan {
    position: absolute;
    width: 100%;
    height: 100%;
    clip-path: polygon(0% 0%, 100% 70%, 50% 70%, 50% 100%, 0% 0%);
}

.red {
    background: #ff0000;
    mix-blend-mode: screen;
    animation: glitch-anim 0.6s infinite alternate-reverse;
    opacity: 0.4;
}

.cyan {
    background: #00ffff;
    mix-blend-mode: screen;
    animation: glitch-anim 0.8s infinite alternate;
    opacity: 0.4;
}

.main {
    background: #fff;
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.3));
    transition: transform 0.15s ease-out;
}

/* Micro-Jitter (Normal) */
@keyframes glitch-anim {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-0.8px, 0.8px); }
    100% { transform: translate(0.8px, -0.8px); }
}

/* Hover States */
#cursor-glitch.is-hovering .red {
    animation: mega-glitch-1 0.2s infinite; 
    opacity: 0.7;
}

#cursor-glitch.is-hovering .cyan {
    animation: mega-glitch-2 0.2s infinite;
    opacity: 0.7;
}

#cursor-glitch.is-hovering .main {
    transform: scale(1.15);
}

@keyframes mega-glitch-1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 1px); }
    75% { transform: translate(1px, -1px); }
}

@keyframes mega-glitch-2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(2px, -1px); }
    75% { transform: translate(-1px, 1px); }
}

/* Disable the custom glitch cursor on mobile/tablets */
@media (max-width: 768px) {
    #cursor-glitch { 
        display: none !important; 
    }
    html, body, a, button, .project-card { 
        cursor: auto !important; 
    }

    /* Allow card headings to wrap instead of cutting off */
    .project-card h3 {
        font-size: 1.1rem; /* Smaller font for mobile */
        white-space: normal; /* Forces text to wrap */
        word-break: break-word; /* Prevents overflow of long words */
        line-height: 1.4;
        letter-spacing: 2px; /* Reduces tracking slightly for readability */
    }

    /* Adjust padding to give the text more room */
    .project-card {
        padding: 20px;
    }

    /* Reduce vertical spacing in the grid */
    .project-grid {
        gap: 20px;
        margin-top: 30px;
    }

    /* Ensure the section title doesn't overflow */
    .section-title {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }

}

/* Utility */
footer { padding: 40px; display: flex; gap: 30px; justify-content: center; z-index: 2; position: relative; }


.icon-link:hover svg { opacity: 1; fill: #0A66C2; transform: scale(1.2); }


/* Fix the Icon Spacing and Underscore */
.social-icons {
    display: flex;
    justify-content: center;
    gap: 30px; /* Adjust this for the spacing between LinkedIn and Email */
    margin-top: 20px;
}

.icon-link {
    text-decoration: none !important; /* Forces underscore to stay hidden */
    display: inline-flex;
}

.icon-link svg {
    width: 36px; height: 36px; fill: #ffffff; opacity: 1; transition: 0.3s;
    /* fill: #000; /* Adjust to match your light section theme */ 
}

/* Match Privacy Policy to About Me Text */
.site-footer {
    text-align: center;
    padding: 40px 20px;
}

.privacy-link {
    /* Inherit everything from about-text */
    font-family: inherit; /* Matches your About Me font */
    font-weight: inherit;
    letter-spacing: 1px;
    
    /* Size requirement: 75% of About Me text */
    font-size: 0.75rem; 
    
    color: #dcdcdcd7;
    opacity: 0.8;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.privacy-link:hover {
    opacity: 1;
    color: #00ffff; /* Subtle Cyan hover to maintain the glitch theme */
}


/* The Overlay: Now truly fixed to the viewport */
.modal-overlay {
    position: fixed; 
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Slightly more transparent to see the glitch behind */
    display: none; 
    justify-content: center; /* Center horizontally */
    align-items: center;     /* Center vertically */
    z-index: 999999; 
    backdrop-filter: blur(8px);
}

/* The Big Card: Use Flexbox centering from the parent instead of translate */
.modal-content.light-modal {
    position: relative; /* Changed from fixed since parent is flex */
    width: 90%;
    max-width: 800px;
    background: #f4f4f4;
    border: 2px solid #000;
    padding: 40px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

/* Modal Typography Updates for Light Theme */
.modal-content.light-modal .modal-h2 { 
    color: #000;
    border-bottom: 2px solid #000; 
    letter-spacing: 5px; 
    padding-bottom: 15px; 
    margin-bottom: 30px; 
}

.modal-content.light-modal .modal-section-h4 { 
    color: #000;
    opacity: 0.7; /* Slightly higher opacity for better legibility on light */
    font-weight: 900;
    font-size: 0.8rem; 
    margin-top: 25px; 
}

.modal-content.light-modal .modal-body-text { 
    color: #000;
    line-height: 1.6; 
    letter-spacing: 1px; 
    text-transform: uppercase; 
}

/* Close Button (The X) */
.modal-content.light-modal.close-btn {
    position: absolute;
    top: 20px; right: 20px;
    background: transparent;
    border: 1px solid #000;
    color: #000;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
}

.modal-content.light-modal .close-btn:hover {
    background: #000;
    color: #f4f4f4;
}

/* Glitch Effect for Title Cards */
/*.glitch-trigger:hover h3 {
        transform: translateY(-5px);
    background: rgba(255,255,255,0.05);
    animation: glitch 0.4s cubic-bezier(.25,.46,.45,.94) both infinite;
    cursor: pointer;
    transition: color 0.3s ease;
}*/

/* --- UNIFIED CARD HOVER & GLITCH --- */
.project-card:hover, 
.glitch-trigger:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    /* Reactivating the infinite glitch at standard intensity */
    animation: glitch 0.4s cubic-bezier(.25, .46, .45, .94) both infinite;
    cursor: pointer;
    transition: color 0.3s ease;
}

/* Specific text jitter for the Lab headings 
#projects .project-card:hover h3,
.glitch-trigger:hover h3 {
    text-shadow: 2px 0 var(--accent), -2px 0 #0ff;
    color: var(--text-light);
}

/* Light section override (Track Record)
.light .project-card:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-dark);
}*/

/* BOTTOM CONTAINER: Forces centering */
.bottom-btn-container {
    display: flex;
    justify-content: center; /* Center-aligned horizontally */
    width: 100%;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px dashed rgba(0,0,0,0.1);
}

.close-btn-bottom {
    background: transparent;
    border: 1px solid #000;
    color: #000;
    padding: 12px 40px;
    font-family: inherit;
    letter-spacing: 4px;
    font-weight: 900;
    transition: 0.3s ease;
}

.close-btn-bottom:hover {
    background: #000;
    color: #f4f4f4;
    transform: translateY(-2px);
}