:root {
    --bg-main: #0b0f19;
    --bg-card: #111827;
    --bg-nav: rgba(11, 15, 25, 0.92);
    --border-color: #1f2937;
    --accent-cyan: #00f2fe;
    --accent-blue: #38bdf8;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --status-green: #10b981;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Prevents layout shift on mobile orientation change */
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 242, 254, 0.08) 0%, transparent 65%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
    /* Safe-area padding for mobile notches / dynamic islands */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Glassmorphic Responsive Sticky Header */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem clamp(1rem, 5vw, 3rem);
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-text {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #00f2fe, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    font-weight: 500;
    white-space: nowrap;
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 1.75rem;
    padding: 0.2rem;
    cursor: pointer;
    touch-action: manipulation;
}

/* Fluid Hero Typography */
.hero-sub {
    padding: clamp(1.8rem, 5vw, 3.5rem) clamp(1rem, 5vw, 3rem) 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-sub h1 {
    font-size: clamp(1.75rem, 5vw, 2.8rem);
    line-height: 1.2;
    margin-bottom: 0.75rem;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    word-wrap: break-word;
}

.hero-sub p {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 800px;
}

/* Touch-Optimized Tables */
.table-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 clamp(1rem, 5vw, 3rem);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 480px; /* Minimum legible table width */
}

th, td {
    padding: clamp(0.6rem, 1.5vw, 1rem);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
}

th {
    background: #1e293b;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Universal Flexible Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(250px, 30%, 350px), 1fr));
    gap: 1.25rem;
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 clamp(1rem, 5vw, 3rem);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: clamp(1.1rem, 2vw, 1.8rem);
    border-radius: 10px;
    height: 100%;
}

.card h3 { 
    color: var(--accent-cyan); 
    margin-top: 0; 
    font-size: clamp(1.1rem, 2vw, 1.3rem);
}

/* Telemetry Terminal Box */
.terminal-wrapper {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 clamp(1rem, 5vw, 3rem);
}

.terminal-box {
    background: #060911;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    font-family: 'Consolas', 'Courier New', monospace;
}

.terminal-header {
    background: #111827;
    padding: 0.5rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.terminal-body {
    padding: 1rem;
    height: clamp(130px, 20vh, 200px);
    overflow-y: auto;
    font-size: clamp(0.72rem, 1.2vw, 0.88rem);
    color: #38bdf8;
    line-height: 1.5;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #00a8ff 100%);
    color: #0b0f19;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    text-decoration: none !important;
    text-align: center;
    display: inline-block;
    touch-action: manipulation;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

/* Status Tags */
.status-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-tag.hardened { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-tag.airgapped { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 5vw, 3rem);
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 1.2vw, 0.9rem);
    margin-top: 3rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* =================================================== */
/* 📱 DEVICE-SPECIFIC ADAPTIVE MEDIA BREAKPOINTS       */
/* =================================================== */

/* Tablets & Mobile Devices (Portrait & Landscape) */
@media (max-width: 900px) {
    .menu-toggle { 
        display: block; 
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(17, 24, 39, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        padding: 1.25rem clamp(1rem, 5vw, 3rem);
        gap: 1rem;
        box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    }

    .nav-links.open { 
        display: flex; 
    }

    .nav-links a {
        font-size: 1.05rem;
        width: 100%;
        padding: 0.3rem 0;
    }

    .btn-primary {
        width: 100%;
        padding: 0.75rem;
    }
}

/* Small Foldables & Compact Smartphones (e.g. Galaxy Z Flip, iPhone SE) */
@media (max-width: 380px) {
    body {
        background-size: 100% 100%, 20px 20px, 20px 20px;
    }

    .logo-text {
        font-size: 0.9rem;
    }

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

/* Glowing Card Icon Badges */
.card-header-icon {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
    flex-shrink: 0;
}

/* Card Hover Accent Glow */
.card {
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 242, 254, 0.5);
    box-shadow: 0 8px 30px rgba(0, 242, 254, 0.15);
}

/* Hero Section Overlay Grid Graphic */
.hero-wrapper {
    position: relative;
    padding: 3rem 5% 2rem;
    text-align: center;
}

.hero-backdrop-graphic {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 900px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* =================================================== */
/* 🌐 CROSS-OS & CROSS-ENGINE COMPATIBILITY RESETS    */
/* =================================================== */

html {
    /* Prevent unwanted text scaling on iOS Safari & Android Chrome */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    
    /* Dynamic Viewport Height (fixes mobile browser address bar jumps) */
    min-height: 100dvh;
    
    /* Smooth scrolling engine across browsers */
    scroll-behavior: smooth;
}

body {
    /* Touch actions optimization for Android & Windows touchscreens */
    touch-action: manipulation;
    
    /* Prevent horizontal bounce scrolling on macOS & iOS Safari */
    overscroll-behavior-x: none;
    
    /* Cross-platform font smoothing (Mac/Windows/Linux) */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Custom Uniform Scrollbars across Windows, Mac, Chrome & Edge */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0b0f19;
}

::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: #00f2fe;
}

/* Firefox Scrollbar Support */
* {
    scrollbar-width: thin;
    scrollbar-color: #1f2937 #0b0f19;
}

/* Mobile Safari Safe Area & Touch Target Overrides */
@supports (padding: env(safe-area-inset-top)) {
    nav {
        padding-top: calc(0.85rem + env(safe-area-inset-top));
    }
    
    footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

/* Disable Hover Effects on Pure Touchscreens (Prevents Sticky Mobile State) */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* High-Contrast / Forced Colors Mode for Windows Accessibility */
@media (forced-colors: active) {
    .btn-primary, .card, nav, .icon-badge {
        border: 2px solid CanvasText !important;
    }
}

/* Hero Ambient Cyber Grid Graphic */
.hero-container {
    position: relative;
    padding: 4rem 1.5rem 3rem;
    text-align: center;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    overflow: hidden;
}

.hero-glow-overlay {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, rgba(56, 189, 248, 0.05) 50%, transparent 80%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}

/* Hero Action CTA Buttons */
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #060911;
    font-weight: 700;
    padding: 0.85rem 1.75rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 242, 254, 0.7);
}

.btn-secondary {
    background: rgba(17, 24, 39, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 600;
    padding: 0.85rem 1.75rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.05);
}

/* Terminal Graphic Box */
.hero-telemetry-box {
    max-width: 800px;
    margin: 2.5rem auto 1rem;
    background: rgba(6, 9, 17, 0.9);
    border: 1px solid rgba(0, 242, 254, 0.25);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 2;
}

/* HUD Crosshair Corners for Cards */
.card-hud {
    position: relative;
    border: 1px solid rgba(0, 242, 254, 0.2) !important;
    background: rgba(11, 15, 25, 0.7) !important;
    backdrop-filter: blur(8px);
}

.card-hud::before, .card-hud::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: #00f2fe;
    border-style: solid;
    pointer-events: none;
}

/* Top-Left & Bottom-Right HUD accents */
.card-hud::before {
    top: -1px;
    left: -1px;
    border-width: 2px 0 0 2px;
}

.card-hud::after {
    bottom: -1px;
    right: -1px;
    border-width: 0 2px 2px 0;
}

/* Cyber CRT Scanline Effect */
.scanlines {
    position: relative;
    overflow: hidden;
}

.scanlines::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

/* Animated Background Radar Sweeper */
.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    margin-top: -250px;
    margin-left: -250px;
    border-radius: 50%;
    border: 1px solid rgba(0, 242, 254, 0.15);
    background: conic-gradient(from 0deg, rgba(0, 242, 254, 0.2) 0deg, transparent 60deg, transparent 360deg);
    animation: radarRotate 8s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes radarRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tactical Status Beacon */
.pulse-beacon {
    width: 10px;
    height: 10px;
    background-color: #00f2fe;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-beacon::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 50%;
    border: 2px solid #00f2fe;
    animation: beaconExpand 1.8s infinite ease-out;
}

@keyframes beaconExpand {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3.5); opacity: 0; }
}

/* 3D Cyber Grid Floor Backdrop */
.cyber-grid-floor {
    position: absolute;
    bottom: -100px;
    left: -50%;
    width: 200%;
    height: 350px;
    background-image: 
        linear-gradient(rgba(0, 242, 254, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, 0.15) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(400px) rotateX(75deg);
    animation: gridScroll 10s linear infinite;
    pointer-events: none;
    z-index: 0;
    mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
}

@keyframes gridScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 40px; }
}

/* SVG Ring Gauge & Metric Graphics */
.metric-ring-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 242, 254, 0.15);
}

.ring-svg {
    width: 50px;
    height: 50px;
    transform: rotate(-90deg);
}

.ring-bg {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3.8;
}

.ring-fill {
    stroke: var(--accent-cyan);
    stroke-width: 3.8;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 25; /* 75% Completion */
    animation: fillGauge 2.5s ease-out forwards;
}

@keyframes fillGauge {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 25; }
}

/* Live Waveform SVG Graphic */
.waveform-box {
    background: #060911;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.waveform-path {
    stroke: #00f2fe;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawWave 3s ease-in-out infinite alternate;
}

@keyframes drawWave {
    0% { stroke-dashoffset: 300; }
    100% { stroke-dashoffset: 0; }
}
