:root {
    --bg-dark: #050505;
    --bg-panel: #0a0a0a;
    --text-primary: #ededed;
    --text-secondary: #888888;
    --accent: #2b57ff;
    --accent-dim: rgba(43, 87, 255, 0.1);
    --accent-glow: rgba(43, 87, 255, 0.4);
    --border: #222;
    --border-light: #333;
    
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --spacing-container: 1400px;
    --header-height: 80px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    cursor: crosshair;
}

/* --- Background Effects --- */

.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.1;
    z-index: -2;
    mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48ZmlsdGVyIGlkPSJnoiPjxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjY1IiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsdGVyPSJ1cmwoI2cpIiBvcGFjaXR5PSIwLjAzIi8+PC9zdmc+');
    opacity: 0.15;
    z-index: 9000;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px;
    z-index: 9001;
    pointer-events: none;
    opacity: 0.3;
}

/* Decorative Corners */
.screen-corner {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    z-index: 100;
    opacity: 0.5;
}
.top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.bottom-right { bottom: 20px; right: 20px; border-left: none; border-top: none; }

/* --- Typography --- */

.mono-text { font-family: var(--font-mono); }
.mono-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 1rem;
}
.mono-accent { color: var(--accent); }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.03em; }

.display-title {
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    line-height: 0.95;
    margin-bottom: 2rem;
    position: relative;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 0;
}

/* Glitch Effect */
.glitch {
    position: relative;
    color: var(--text-primary);
    -webkit-text-stroke: 1px var(--text-primary);
    color: transparent;
    transition: color 0.3s;
}

.hero:hover .glitch { color: var(--text-primary); }

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    background: var(--bg-dark);
    opacity: 0.8;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(21px, 9999px, 89px, 0); }
    5% { clip: rect(66px, 9999px, 8px, 0); }
    10% { clip: rect(8px, 9999px, 93px, 0); }
    15% { clip: rect(10px, 9999px, 2px, 0); }
    20% { clip: rect(42px, 9999px, 78px, 0); }
    25% { clip: rect(96px, 9999px, 25px, 0); }
    30% { clip: rect(7px, 9999px, 28px, 0); }
    35% { clip: rect(15px, 9999px, 13px, 0); }
    40% { clip: rect(61px, 9999px, 44px, 0); }
    45% { clip: rect(54px, 9999px, 96px, 0); }
    50% { clip: rect(98px, 9999px, 54px, 0); }
    55% { clip: rect(86px, 9999px, 20px, 0); }
    60% { clip: rect(25px, 9999px, 46px, 0); }
    65% { clip: rect(56px, 9999px, 32px, 0); }
    70% { clip: rect(31px, 9999px, 60px, 0); }
    75% { clip: rect(2px, 9999px, 83px, 0); }
    80% { clip: rect(74px, 9999px, 69px, 0); }
    85% { clip: rect(19px, 9999px, 55px, 0); }
    90% { clip: rect(3px, 9999px, 3px, 0); }
    95% { clip: rect(56px, 9999px, 36px, 0); }
    100% { clip: rect(28px, 9999px, 49px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    100% { clip: rect(32px, 9999px, 11px, 0); }
}

/* --- Layout --- */

.container {
    max-width: var(--spacing-container);
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
    z-index: 1;
}

.section { padding: 140px 0; }

/* --- Header --- */

.site-header { position: fixed; top: 0; width: 100%; z-index: 1000; }
.header-inner {
    max-width: var(--spacing-container);
    margin: 0 auto;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.logo { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.05em; }
.blink { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.main-nav ul { display: flex; gap: 40px; list-style: none; }
.main-nav a {
    color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
    transition: color 0.2s; font-family: var(--font-mono); text-transform: uppercase;
}
.main-nav a:hover { color: var(--text-primary); }
.nav-num { color: var(--accent); margin-right: 6px; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; padding: 12px 24px;
    font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
    cursor: pointer; transition: all 0.2s; border: 1px solid var(--border); position: relative; overflow: hidden;
}
.btn-primary { background: var(--text-primary); color: var(--bg-dark); border-color: var(--text-primary); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 20px var(--accent-glow); }
.btn-link { background: transparent; color: var(--text-primary); border: none; border-bottom: 1px solid var(--border); }
.btn-link:hover { color: var(--accent); border-color: var(--accent); }

/* --- Hero --- */
.hero { min-height: 100vh; display: flex; align-items: center; position: relative; padding-top: 80px; overflow: hidden; }

/* Hex Background */
.hero-hex-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) perspective(1000px) rotateX(25deg) scale(1.2);
    width: 150%; /* Larger to cover rotations */
    height: 150%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
    
    mask-image: radial-gradient(circle at center, black 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 80%);
    
    /* Hardware acceleration hints for the container */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* The scrolling pattern layer */
.hero-hex-bg::after {
    content: '';
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 200%;
    
    /* Using a brighter, simpler SVG pattern with geometricPrecision for cleaner lines */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='104' viewBox='0 0 60 104' xmlns='http://www.w3.org/2000/svg' shape-rendering='geometricPrecision'%3E%3Cpath d='M30 0l25.98 15v30L30 60 4.02 45V15z' fill='none' stroke='%232b57ff' stroke-width='1.5' stroke-opacity='0.4'/%3E%3Cpath d='M30 52l25.98 15v30L30 112 4.02 97V67z' fill='none' stroke='%232b57ff' stroke-width='1.5' stroke-opacity='0.4'/%3E%3C/svg%3E");
    background-size: 60px 104px;
    
    /* Use transform for buttery smooth 60fps animation */
    animation: hexScroll 40s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes hexScroll {
    0% { transform: translateY(0) translateZ(0); }
    100% { transform: translateY(208px) translateZ(0); } /* 208px = 2 * 104px (pattern height) */
}

.status-badge {
    display: inline-flex; align-items: center; gap: 12px; margin-bottom: 2rem;
    border: 1px solid var(--border); padding: 8px 16px; background: rgba(255,255,255,0.02);
    position: relative; z-index: 2;
}
.status-dot { width: 8px; height: 8px; background-color: #00ff88; border-radius: 50%; box-shadow: 0 0 8px #00ff88; }
.hero-sub {
    font-size: 1.1rem; color: var(--text-secondary); max-width: 650px; margin-bottom: 3.5rem;
    margin-top: 2rem; display: flex; gap: 16px; position: relative; z-index: 2;
}
.arrow { color: var(--accent); }
.hero-text { position: relative; z-index: 2; }
.scroll-indicator {
    position: absolute; bottom: 40px; right: 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; z-index: 2;
}
.scroll-indicator .line { width: 1px; height: 60px; background: linear-gradient(to bottom, var(--text-secondary), transparent); }

/* --- Services (Modules Grid) --- */

.section-header { margin-bottom: 60px; border-bottom: 1px solid var(--border); padding-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-end; }

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
}

.module-card {
    background: rgba(10, 10, 10, 0.5);
    border: 1px solid var(--border);
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 380px; /* Uniform height */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: rgba(20, 20, 20, 0.8);
}

.module-header { margin-bottom: 24px; }
.module-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 16px; border-bottom: 1px solid #222; padding-bottom: 8px; }
.mod-status { color: #00ff88; }

.module-card h3 { font-size: 1.75rem; margin-bottom: 0; color: var(--text-primary); }

.module-body { flex-grow: 1; }
.module-body p { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.6; }

.module-footer { margin-top: 32px; border-top: 1px solid #222; padding-top: 16px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--accent); }

/* --- Impact Logs --- */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.log-entry {
    background: rgba(255,255,255,0.03);
    border-left: 2px solid var(--border);
    padding: 24px;
    transition: all 0.3s;
}

.log-entry:hover {
    border-left-color: var(--accent);
    background: rgba(255,255,255,0.05);
}

.log-time { font-size: 0.75rem; color: var(--text-secondary); display: block; margin-bottom: 8px; }
.log-title { font-size: 1.25rem; margin-bottom: 12px; color: var(--text-primary); }
.log-desc { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.log-stat { display: flex; flex-direction: column; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.1em; }


/* --- Terminal --- */
.tech-terminal { background: #0d0d0d; border: 1px solid var(--border); max-width: 900px; margin: 0 auto; box-shadow: 0 0 50px rgba(0,0,0,0.5); }
.terminal-header { background: #151515; padding: 12px 16px; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.traffic-lights { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.terminal-title { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); margin-left: 16px; }
.terminal-body { padding: 40px; font-size: 1rem; color: #ccc; }
.code-line { margin-bottom: 8px; min-height: 1.5em; }
.indent { padding-left: 32px; }
.keyword { color: #c678dd; } .var { color: #e5c07b; } .key { color: #e06c75; } .string { color: #98c379; } .comment { color: #5c6370; font-style: italic; }
.cursor { display: inline-block; width: 8px; height: 1.2em; background: var(--text-primary); vertical-align: middle; animation: blink 1s infinite; margin-left: 4px; }

/* --- About Stats --- */
.about-grid { display: grid; grid-template-columns: 200px 1fr; gap: 60px; }
.about-content h2 { font-size: 3rem; margin-bottom: 2rem; }
.lead { font-size: 1.4rem; margin-bottom: 2rem; color: var(--text-primary); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 60px; border-top: 1px solid var(--border); padding-top: 40px; }
.stat-item { display: flex; flex-direction: column; gap: 8px; }
.stat-val { font-size: 2.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.9rem; color: var(--text-secondary); text-transform: uppercase; }

/* --- Contact Form --- */
.contact-wrapper { background: var(--bg-panel); border: 1px solid var(--border); padding: 80px; display: grid; grid-template-columns: 300px 1fr; gap: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.form-group { position: relative; }
.form-group label { margin-bottom: 16px; font-size: 0.8rem; }
.form-group input, .form-group textarea { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--border); padding: 16px 0; color: var(--text-primary); font-family: var(--font-mono); font-size: 1.1rem; border-radius: 0; }
.form-group input:focus, .form-group textarea:focus { outline: none; }
.input-line { position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--accent); transition: width 0.3s ease; }
.form-group input:focus ~ .input-line, .form-group textarea:focus ~ .input-line { width: 100%; }
.form-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; }
.btn-icon { margin-left: 8px; }

/* --- Footer --- */
.site-footer { padding: 40px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); }
.sys-status { color: #00ff88; }

/* --- Animations --- */
.fade-in { opacity: 0; animation: fadeIn 0.8s forwards; }
.fade-in-delay { opacity: 0; animation: fadeIn 0.8s 0.2s forwards; }
.fade-in-delay-2 { opacity: 0; animation: fadeIn 0.8s 0.4s forwards; }
.stagger-load { opacity: 0; animation: slideUp 0.8s 0.1s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* --- Mobile --- */
@media (max-width: 900px) {
    .display-title { font-size: 3rem; }
    .hero-grid { grid-template-columns: 1fr; }
    .contact-wrapper { grid-template-columns: 1fr; padding: 40px; gap: 40px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
    .stat-grid { grid-template-columns: 1fr; gap: 24px; }
    .main-nav { display: none; }
    
    /* Mobile Grid Reset */
    .modules-grid { grid-template-columns: 1fr; }
    .module-card { min-height: auto; }
}
