:root {
    /* DEFAULT: DARK MODE (SPACE BLACK) */
    --bg: #050505;
    --text-high: #FFFFFF;
    --text-mid: rgba(255, 255, 255, 0.7);
    --text-low: rgba(255, 255, 255, 0.4);
    --accent: #00F2FF;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --mesh-stroke: rgba(0, 242, 255, 0.1);
    --btn-secondary-bg: rgba(255, 255, 255, 0.03);
    
    --font-heading: 'Outfit', sans-serif;
    --font-main: 'Inter', sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        /* LIGHT MODE (CLOUD WHITE) */
        --bg: #F8F9FA;
        --text-high: #121212;
        --text-mid: rgba(18, 18, 18, 0.7);
        --text-low: rgba(18, 18, 18, 0.4);
        --accent: #007680; /* Slightly deeper Cyan for contrast */
        --glass-bg: rgba(0, 0, 0, 0.02);
        --glass-border: rgba(0, 0, 0, 0.08);
        --mesh-stroke: rgba(0, 118, 128, 0.1);
        --btn-secondary-bg: rgba(0, 0, 0, 0.02);
    }
}

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

body {
    background-color: var(--bg);
    color: var(--text-high);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Background Mesh & Texture */
#bg-mesh {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    opacity: 0.8;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("https://grainy-gradients.vercel.app/noise.svg");
    opacity: 0.04;
    pointer-events: none;
    z-index: 1000;
    filter: contrast(120%) brightness(100%);
}

/* Initialisation Overlay */
#init-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: background-color 0.5s ease, opacity 0.8s ease;
}

.init-text {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 4px;
}

.init-bar {
    width: 200px;
    height: 2px;
    background: var(--glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.init-progress {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5000;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 4px;
    color: var(--text-high);
}

.nav-links {
    display: flex;
    gap: 40px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-low);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.nav-links a:hover { color: var(--accent); }

.nav-cta {
    background: var(--text-high);
    color: var(--bg) !important;
    padding: 8px 20px;
    border-radius: 4px;
}

/* Hero Section */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 120px 0 80px;
}

h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 10vw, 8.5rem);
    line-height: 0.85;
    font-weight: 800;
    margin-bottom: 40px;
    position: relative;
    letter-spacing: -2px;
}

.no-wrap {
    white-space: nowrap;
    display: inline-block;
}

.char {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px) skewY(5deg);
    transition: all 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}

.char.revealed {
    opacity: 1;
    transform: translateY(0) skewY(0deg);
}

.accent {
    color: var(--accent);
    font-style: italic;
    -webkit-text-stroke: 1px var(--accent);
    -webkit-text-fill-color: transparent;
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.2, 0, 0.2, 1);
}

.accent.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Scanline Effect */
.scanline {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

@keyframes scan {
    0% { top: -10%; opacity: 0.8; }
    100% { top: 110%; opacity: 0; }
}

.scan-active {
    animation: scan 1.2s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

/* System Pulse */
@keyframes pulse-bg {
    0% { filter: brightness(1); }
    50% { filter: brightness(2) saturate(1.5); }
    100% { filter: brightness(1); }
}

.pulse-active {
    animation: pulse-bg 0.8s ease-out;
}

.hero-sub {
    font-size: 1.25rem;
    color: var(--text-mid);
    max-width: 600px;
    margin: 0 auto 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s cubic-bezier(0.2, 0, 0.2, 1);
}

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn {
    padding: 18px 36px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border: none;
}

.btn-primary:hover {
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.6);
    transform: translateY(-4px) scale(1.02);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.btn-secondary {
    border: 1px solid var(--glass-border);
    color: var(--text-high);
    background: var(--btn-secondary-bg);
}

/* Identity Section */
#identity { padding: 160px 0; }

.grid-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 80px;
    align-items: center;
}

.eyebrow {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 4px;
    display: block;
    margin-bottom: 20px;
}

h2 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    margin-bottom: 30px;
    line-height: 1.1;
}

.id-text p {
    font-size: 1.2rem;
    color: var(--text-mid);
}

.id-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.metric-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
}

.metric-card h3 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--accent);
}

/* Projects Section */
#projects { padding: 100px 0; }

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 60px;
}

.project-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s;
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.card-visual {
    height: 220px;
    position: relative;
    overflow: hidden;
}

.noise-visual {
    background: linear-gradient(135deg, var(--bg) 0%, var(--accent) 100%);
}

.pia-visual {
    background: linear-gradient(135deg, var(--bg) 0%, #0047FF 100%);
}

.cobble-visual {
    background: linear-gradient(135deg, var(--bg) 0%, #3BFF4D 100%);
}

.tyre-visual {
    background: linear-gradient(135deg, var(--bg) 0%, #FFD700 100%);
}

.card-visual::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23ffffff' fill-opacity='0.05' d='M1 3h1v1H1V3zm2-2h1v1H2V1z'%3E%3C/path%3E%3C/svg%3E");
    opacity: 0.5;
}

.card-content { padding: 40px; }
.card-content h3 { font-family: var(--font-heading); font-size: 1.75rem; margin-bottom: 15px; }
.card-content p { color: var(--text-mid); font-size: 0.95rem; margin-bottom: 25px; }

.card-meta { display: flex; gap: 10px; }
.card-meta span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-low);
    border: 1px solid var(--glass-border);
    padding: 4px 12px;
    border-radius: 4px;
}

.card-meta span.visit {
    color: var(--accent);
    border-color: var(--accent);
    margin-left: auto;
}

/* Footer */
#contact {
    padding: 200px 0 100px;
    text-align: center;
}

#contact h2 { font-size: 5rem; }
.footer-email {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 800;
    transition: opacity 0.3s;
}

.footer-email:hover { opacity: 0.7; }

.footer-bottom {
    margin-top: 100px;
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-low);
}

/* Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s cubic-bezier(0.2, 0, 0.2, 1);
}

.reveal.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}
