/* ============================================
   SnapShot — Enterprise Design System
   Rebuilt from first principles
   ============================================ */

/* ============================================
   CSS Reset
   ============================================ */

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

/* ============================================
   Design Tokens
   ============================================ */

:root {
    /* ── Background Scale (dark theme — SuperX-inspired) ── */
    --color-bg-primary: #050505;
    --color-bg-secondary: #080808;
    --color-bg-tertiary: #111111;
    --color-bg-elevated: #0a0a0a;
    --color-bg-overlay: rgba(0, 0, 0, 0.75);

    /* ── Inverse (light sections if needed) ── */
    --color-bg-inverse: #050505;
    --color-bg-inverse-secondary: #0a0a0a;

    /* ── Text Scale (dark theme) ── */
    --color-text-primary: #f5f5f5;
    --color-text-secondary: #90939b;
    --color-text-tertiary: #71717a;
    --color-text-disabled: rgba(255, 255, 255, 0.25);
    --color-text-inverse: #f5f5f5;
    --color-text-inverse-secondary: #90939b;

    /* ── Brand Accent (brighter for dark bg) ── */
    --color-accent: #3b82f6;
    --color-accent-hover: #60a5fa;
    --color-accent-active: #2563eb;
    --color-accent-light: #60a5fa;
    --color-accent-subtle: rgba(59, 130, 246, 0.08);
    --color-accent-muted: rgba(59, 130, 246, 0.15);
    --color-accent-border: rgba(59, 130, 246, 0.30);

    /* ── Semantic Colors (tuned for dark bg) ── */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    /* ── Borders (dark theme — glass-morphism) ── */
    --color-border: rgba(255, 255, 255, 0.06);
    --color-border-hover: rgba(255, 255, 255, 0.12);
    --color-border-strong: rgba(255, 255, 255, 0.15);

    /* ── Typography ── */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", Monaco, "Cascadia Code", Consolas, monospace;

    /* Type Scale */
    --text-display: 4.5rem;
    --text-h1: 3rem;
    --text-h2: 1.875rem;
    --text-h3: 1.375rem;
    --text-h4: 1.125rem;
    --text-body: 1rem;
    --text-small: 0.875rem;
    --text-xs: 0.75rem;

    /* Line Heights */
    --leading-tight: 1.15;
    --leading-snug: 1.3;
    --leading-normal: 1.55;
    --leading-relaxed: 1.7;

    /* Font Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Letter Spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: -0.011em;
    --tracking-wide: 0.05em;

    /* ── Spacing Scale (numbered, base-4/8) ── */
    --space-1: 0.25rem;    /*  4px */
    --space-2: 0.5rem;     /*  8px */
    --space-3: 0.75rem;    /* 12px */
    --space-4: 1rem;       /* 16px */
    --space-5: 1.5rem;     /* 24px */
    --space-6: 2rem;       /* 32px */
    --space-7: 2.5rem;     /* 40px */
    --space-8: 3rem;       /* 48px */
    --space-9: 4rem;       /* 64px */
    --space-10: 5rem;      /* 80px */
    --space-11: 6rem;      /* 96px */
    --space-12: 8rem;      /* 128px */

    /* ── Border Radius (SuperX-generous) ── */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* ── Shadows (for dark bg — ambient glow) ── */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6), 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-screenshot: 0 24px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-glow-accent: 0 0 20px rgba(59, 130, 246, 0.15), 0 0 60px rgba(59, 130, 246, 0.05);
    --shadow-glow-card: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 30px rgba(0, 0, 0, 0.4);

    /* ── Transitions ── */
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Z-index Scale ── */
    --z-dropdown: 1000;
    --z-sticky: 1100;
    --z-fixed: 1200;
    --z-modal-backdrop: 1300;
    --z-modal: 1400;
    --z-popover: 1500;
    --z-tooltip: 1600;

}

/* ============================================
   Base Styles
   ============================================ */

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-body);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
}

::selection {
    background: rgba(59, 130, 246, 0.30);
    color: #ffffff;
}

::-moz-selection {
    background: rgba(59, 130, 246, 0.30);
    color: #ffffff;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #050505;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-5);
}

h1 {
    font-size: var(--text-display);
    letter-spacing: var(--tracking-tight);
}

h2 {
    font-size: var(--text-h2);
    letter-spacing: var(--tracking-tight);
}

h3 {
    font-size: var(--text-h2);
}

h4 {
    font-size: var(--text-h3);
}

p {
    margin-bottom: var(--space-4);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

/* Content body text */
section p:not(.hero-subtitle):not(.hero-description),
.section-header p,
.card p,
.card li,
.architecture-list li,
.demo-caption {
    font-size: var(--text-body);
    line-height: 1.6;
    font-weight: var(--weight-normal);
    letter-spacing: var(--tracking-normal);
}

.section-header p {
    font-size: var(--text-h4);
    line-height: var(--leading-relaxed);
}

strong, b {
    color: var(--color-text-primary);
    font-weight: var(--weight-semibold);
}

em, i {
    font-style: italic;
}

a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--duration-fast) var(--ease);
}

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

a:visited:not(.btn):not(.site-logo):not(.skip-link) {
    color: #93c5fd;
}

nav a,
.btn,
.site-logo,
.skip-link {
    text-decoration: none;
}

/* Ensure buttons never inherit visited link colors */
.btn-primary,
.btn-primary:visited,
.btn-primary:hover,
.btn-primary:active {
    color: #ffffff;
}

.btn-secondary:visited {
    color: var(--color-text-primary);
}

/* Glass card base mixin */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.125rem 0.375rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    color: #60a5fa;
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-small);
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-5);
}

pre code {
    padding: 0;
    background: none;
    border: none;
}

ul, ol {
    list-style: none;
}

/* ============================================
   Layout Utilities
   ============================================ */

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.container-wide {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.content-narrow {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Section Utilities
   ============================================ */

section {
    padding: var(--space-10) 0;
}

.section-header {
    text-align: center;
    max-width: 760px;
    margin: 0 auto var(--space-8);
}

.section-header h2 {
    font-size: 40px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-5);
}

.section-header p {
    color: var(--color-text-secondary);
    font-size: var(--text-h4);
    line-height: var(--leading-relaxed);
}

.section-header-left {
    max-width: 800px;
    margin-bottom: var(--space-7);
    text-align: left;
}

.section-header-left h2 {
    margin-bottom: var(--space-4);
}

.section-header-left p {
    font-size: var(--text-h4);
    color: var(--color-text-secondary);
    max-width: 700px;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

/* ============================================
   Utility Classes
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-large { font-size: var(--text-h4); }
.text-small { font-size: var(--text-small); }
.text-secondary { color: var(--color-text-secondary); }
.text-primary { color: var(--color-text-primary); }
.text-accent { color: var(--color-accent); }
.m-0 { margin: 0; }
.border-left-primary {
    border-left: 3px solid var(--color-accent);
}

.border-left-error {
    border-left: 3px solid var(--color-danger);
}

/* ============================================
   Grid System
   ============================================ */

.grid {
    display: grid;
    gap: var(--space-7);
    align-items: stretch;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ============================================
   Flex Utilities
   ============================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-sm { gap: var(--space-2); }
.gap-md { gap: var(--space-4); }
.gap-lg { gap: var(--space-5); }
.gap-xl { gap: var(--space-6); }
.gap-2xl { gap: var(--space-7); }

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    :root {
        --text-display: 2.75rem;
        --text-h1: 2.25rem;
    }

    .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --text-display: 2.25rem;
        --text-h1: 2rem;
        --text-h2: 1.5rem;
    }

    .container,
    .container-wide,
    .container-narrow {
        padding: 0 var(--space-5);
    }

    section {
        padding: var(--space-9) 0;
    }

    .section-header h2 {
        font-size: var(--text-h2);
    }

    section p:not(.hero-subtitle):not(.hero-description),
    .card p,
    .card li,
    .architecture-list li,
    .demo-caption {
        font-size: var(--text-small);
    }

    .section-header p {
        font-size: var(--text-body);
    }
}

/* ============================================
   Accessibility
   ============================================ */

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

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-accent);
    color: #ffffff;
    padding: var(--space-4) var(--space-5);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: var(--z-tooltip);
}

.skip-link:focus {
    top: var(--space-4);
    left: var(--space-4);
}

/* ============================================
   Scroll Reveal Animations
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 60ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 120ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 180ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .reveal.visible {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   Print Styles
   ============================================ */

/* Noise texture overlay for premium feel */
.noise-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.015;
    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");
}

/* Gradient text utility */
.gradient-text {
    background: linear-gradient(135deg, #f0f0f0 0%, rgba(255,255,255,0.5) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-accent {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section pill badge */
.section-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 9999px;
    background: rgba(59, 130, 246, 0.08);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.15);
    margin-bottom: 1.5rem;
}

.section-pill-green {
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.15);
}

.section-pill-purple {
    background: rgba(139, 92, 246, 0.08);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.15);
}

.section-pill-orange {
    background: rgba(245, 158, 11, 0.08);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.15);
}

.section-pill-cyan {
    background: rgba(6, 182, 212, 0.08);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.15);
}

@media print {
    body {
        background: #ffffff;
        color: #1e293b;
    }

    .no-print {
        display: none !important;
    }
}
