/* ============================================
   MUKHABARAT - Intelligence Technology
   Design System & Core Styles
   ============================================ */

/* CSS Custom Properties */
:root {
    /* Colors */
    --color-black: #000000;
    --color-white: #ffffff;
    --color-gray-100: #f5f5f5;
    --color-gray-200: #e5e5e5;
    --color-gray-300: #d4d4d4;
    --color-gray-400: #a3a3a3;
    --color-gray-500: #737373;
    --color-gray-600: #525252;
    --color-gray-700: #404040;
    --color-gray-800: #262626;
    --color-gray-900: #171717;
    --color-gray-950: #0a0a0a;

    /* Accent colors for subtle highlights */
    --color-accent: rgba(255, 255, 255, 0.1);
    --color-accent-hover: rgba(255, 255, 255, 0.15);
    --color-glow: rgba(255, 255, 255, 0.6);

    /* Typography */
    --font-primary: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;

    /* Z-index layers */
    --z-canvas: 0;
    --z-content: 10;
    --z-nav: 100;
    --z-overlay: 1000;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-black);
    color: var(--color-white);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-black);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-700);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-500);
}

/* Selection */
::selection {
    background: var(--color-white);
    color: var(--color-black);
}

/* ============================================
   Entry Overlay
   ============================================ */
.entry-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.entry-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.entry-content {
    text-align: center;
}

.entry-branding {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.entry-title {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--color-white);
    margin-bottom: var(--space-md);
    animation: fadeInUp 0.8s ease forwards;
}

.entry-subtitle {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-gray-500);
    letter-spacing: 0.15em;
    animation: fadeInUp 0.8s ease 0.3s forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.enter-prompt {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-gray-500);
    animation: fadeInDelayed 0.5s ease 1.6s forwards;
    opacity: 0;
}

.blink {
    animation: blink 1s step-end infinite 1.6s;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes fadeInDelayed {
    to {
        opacity: 1;
    }
}

/* ============================================
   Canvas Background
   ============================================ */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-canvas);
    pointer-events: none;
}

/* ============================================
   Navigation
   ============================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--space-lg) var(--space-xl);
    z-index: var(--z-nav);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-brand {
    position: relative;
}

.brand-text {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.3em;
}

/* ============================================
   Glitch Effect
   ============================================ */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch:hover::before {
    animation: glitch-1 0.3s infinite linear alternate-reverse;
    color: var(--color-white);
    opacity: 0.8;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch:hover::after {
    animation: glitch-2 0.3s infinite linear alternate-reverse;
    color: var(--color-white);
    opacity: 0.8;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes glitch-2 {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(2px, -2px);
    }

    40% {
        transform: translate(2px, 2px);
    }

    60% {
        transform: translate(-2px, -2px);
    }

    80% {
        transform: translate(-2px, 2px);
    }

    100% {
        transform: translate(0);
    }
}

/* ============================================
   Main Content & Sections
   ============================================ */
.main {
    position: relative;
    z-index: var(--z-content);
    flex: 1;
}

.section {
    min-height: 100vh;
    padding: var(--space-4xl) var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-header {
    margin-bottom: var(--space-2xl);
    display: flex;
    align-items: baseline;
    gap: var(--space-lg);
}

.section-index {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-gray-600);
}

.section-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 0.2em;
}

/* ============================================
   Hero Section - Compact
   ============================================ */
.hero {
    padding-top: 120px;
    position: relative;
}

.hero-compact {
    min-height: auto;
    padding-bottom: var(--space-2xl);
}

.hero-content {
    max-width: 900px;
}

.hero-label {
    margin-bottom: var(--space-lg);
}

.label-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-gray-500);
    letter-spacing: 0.1em;
}

.hero-title {
    font-size: clamp(2.875rem, 11.5vw, 7.875rem);
    font-weight: 600;
    letter-spacing: 0.15em;
    line-height: 1;
    margin-bottom: var(--space-xl);
}

.title-line {
    display: block;
    overflow: hidden;
}

.reveal-text {
    display: inline-block;
    animation: revealText 1s ease 0.5s forwards;
    opacity: 0;
    transform: translateY(100%);
}

@keyframes revealText {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tagline {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--color-gray-400);
    max-width: 500px;
    margin-bottom: var(--space-3xl);
}

/* Hero Visual - Data Grid */
.hero-visual {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-2xl);
    width: 100%;
    display: flex;
    justify-content: center;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}

/* Decrypt text effect */
.decrypt-text {
    position: relative;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-xl);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.1em;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--color-white);
    color: var(--color-black);
}

.btn-primary:hover {
    background: var(--color-gray-200);
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

.btn-icon {
    transition: transform var(--transition-fast);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================
   Contact Section - Compact
   ============================================ */
.contact-compact {
    min-height: auto;
    padding-top: var(--space-2xl);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
}

.contact-intro {
    font-size: 1.125rem;
    font-weight: 300;
    color: var(--color-gray-400);
    margin-bottom: var(--space-xl);
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.contact-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-gray-600);
    letter-spacing: 0.1em;
}

.contact-value {
    font-size: 1rem;
}

.contact-value.mono {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-gray-600);
    letter-spacing: 0.1em;
}

.form-input {
    background: transparent;
    border: 1px solid var(--color-gray-800);
    padding: var(--space-md);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    color: var(--color-white);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-white);
}

.form-input::placeholder {
    color: var(--color-gray-700);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Data Grid Visual */
.data-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    width: 300px;
    height: 60px;
}

.grid-cell {
    background: var(--color-gray-900);
    border: 1px solid var(--color-gray-800);
    transition: all var(--transition-base);
}

.grid-cell:hover,
.grid-cell.active {
    background: var(--color-white);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    border-top: 1px solid var(--color-gray-900);
    padding: var(--space-2xl) var(--space-xl);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.footer-brand .brand-text {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--color-gray-600);
}

.footer-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-gray-600);
}

.classification {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-gray-800);
}

.footer-grid {
    display: flex;
    gap: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-gray-900);
}

.grid-coord {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-gray-700);
    letter-spacing: 0.05em;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 1024px) {
    .contact-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2xl);
    }
}

@media (max-width: 768px) {
    .section {
        padding: var(--space-3xl) var(--space-lg);
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }

    .footer-content {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .footer-meta {
        align-items: flex-start;
    }

    .footer-grid {
        flex-wrap: wrap;
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .hero-title {
        letter-spacing: 0.05em;
    }

    .section-title {
        letter-spacing: 0.1em;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Glitch Loading Effect - Top to Bottom Reveal
   ============================================ */
.glitch-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.glitch-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Black cover that reveals from top */
.glitch-cover {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 100%;
    background: var(--color-black);
    z-index: 998;
    pointer-events: none;
}

/* Initially hide render line */
.render-line {
    opacity: 0;
}

.render-line.active {
    opacity: 1;
}

/* Render line - the glitchy edge where content reveals */
.render-line {
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 999;
    pointer-events: none;
    top: 0;
}

.render-line::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.1) 80%,
        transparent 100%
    );
}

.render-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: var(--color-white);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
                0 0 40px rgba(255, 255, 255, 0.4);
}

/* Scanlines overlay */
.glitch-scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 997;
    opacity: 0;
    transition: opacity 0.3s;
}

.glitch-scanlines.active {
    opacity: 1;
}

/* Noise texture */
.glitch-noise {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0;
    pointer-events: none;
    z-index: 996;
    mix-blend-mode: overlay;
}

.glitch-noise.active {
    opacity: 0.05;
}

/* Glitch fragments that appear near render line */
.glitch-fragment {
    position: fixed;
    height: 4px;
    background: var(--color-white);
    z-index: 1000;
    pointer-events: none;
    opacity: 0.7;
}

/* RGB shift on content being revealed */
.revealing {
    animation: revealGlitch 0.15s ease-out;
}

@keyframes revealGlitch {
    0% {
        filter: blur(2px);
        opacity: 0.5;
        text-shadow: -3px 0 #ff0000, 3px 0 #00ffff;
    }
    50% {
        filter: blur(1px);
        opacity: 0.8;
        text-shadow: -1px 0 #ff0000, 1px 0 #00ffff;
    }
    100% {
        filter: blur(0);
        opacity: 1;
        text-shadow: none;
    }
}
