/**
 * Rapid Texter TUI - Base Styles & Design System
 * Terminal-themed design using Cascadia Code and High Contrast Colors
 * * DESIGN PRINCIPLES:
 * 1. Monospace Everything (Cascadia Code)
 * 2. High Contrast (Black BG, Neon Accents)
 * 3. Sharp Edges (No border-radius)
 * 4. Terminal Aesthetics (Scanlines, ASCII art)
 */

:root {
    /* --- Colors (Terminal Palette) --- */
    --bg-primary: #0c0c0c;
    --bg-secondary: #121212;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #262626;

    --text-primary: #cccccc;
    --text-secondary: #888888;
    --text-muted: #555555;

    --border-primary: #333333;
    --border-secondary: #444444;

    /* --- Accents (ANSI Colors) --- */
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    --accent-cyan: #39d0d8;
    --accent-magenta: #d2a8ff;

    /* --- Status Opacities --- */
    --success-bg: rgba(63, 185, 80, 0.1);
    --info-bg: rgba(88, 166, 255, 0.1);

    /* --- Spacing System --- */
    --spacing-xs: 4px;
    --spacing-s: 8px;
    --spacing-m: 16px;
    --spacing-l: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
    --spacing-huge: 80px;
    --spacing-gap: 40px;

    /* --- Dimensions --- */
    --status-bar-height: 60px;
    --max-content-width: 1100px;

    /* --- Icons Sizes --- */
    --icon-size-xs: 12px;
    --icon-size-sm: 14px;
    --icon-size-md: 18px;
    --icon-size-lg: 24px;
    --icon-size-xl: 32px;
    --icon-size-xxl: 48px;

    /* --- Typography --- */
    --font-family: 'Cascadia Code', 'Cascadia Mono', 'Consolas', monospace;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-m: 15px;
    --font-size-l: 17px;
    --font-size-xl: 20px;
    --font-size-xxl: 24px;
    --font-size-display: 32px;
    --font-size-hero: 48px;
    --font-size-logo: 64px;

    /* --- Borders --- */
    --radius-none: 0px;
    /* STRICT TUI RULE: No rounded corners */
}

/* ========================================================================
 * RESET & BASE
 * ======================================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--status-bar-height) + 20px);
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-m);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
    /* Dot pattern background */
    background-image: radial-gradient(#21262d 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ========================================================================
 * CUSTOM SCROLLBAR (TUI Style)
 * ======================================================================== */
::-webkit-scrollbar {
    width: 12px;
    background: var(--bg-primary);
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border: 1px solid var(--border-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ========================================================================
 * CRT / TERMINAL EFFECTS
 * ======================================================================== */

/* Scanlines */
.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;
    pointer-events: none;
    z-index: 999;
}

/* Vignette */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 998;
}

/* ========================================================================
 * TYPOGRAPHY
 * ======================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.5px;
    margin-bottom: var(--spacing-m);
}

h1 {
    font-size: var(--font-size-logo);
}

h2 {
    font-size: var(--font-size-display);
}

h3 {
    font-size: var(--font-size-xxl);
}

h4 {
    font-size: var(--font-size-xl);
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-m);
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
    color: var(--accent-cyan);
}

/* Accessibility Focus Styles (TUI Theme) */
:focus-visible {
    outline: 2px solid var(--accent-yellow);
    outline-offset: 2px;
    background-color: rgba(210, 153, 34, 0.1);
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-yellow);
    outline: none;
}

/* ========================================================================
 * LAYOUT UTILITIES
 * ======================================================================== */

.container {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 var(--spacing-l);
}

.container-wide {
    max-width: 1400px;
}

.container-narrow {
    max-width: 800px;
}

/* Section Styling */
.section {
    padding: var(--spacing-huge) 0;
    position: relative;
    border-bottom: 1px dashed var(--border-secondary);
}

.section-alt {
    background-color: var(--bg-secondary);
}

.section-title {
    font-size: var(--font-size-display);
    font-weight: bold;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--spacing-m);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-m);
}

.section-title .icon {
    color: var(--accent-blue);
}

.section-subtitle {
    color: var(--text-secondary);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    font-size: var(--font-size-l);
    margin-bottom: var(--spacing-gap);
}

/* ========================================================================
 * HELPERS
 * ======================================================================== */

.text-center {
    text-align: center;
}

.text-blue {
    color: var(--accent-blue);
}

.text-green {
    color: var(--accent-green);
}

.text-yellow {
    color: var(--accent-yellow);
}

.text-red {
    color: var(--accent-red);
}

.text-cyan {
    color: var(--accent-cyan);
}

.text-muted {
    color: var(--text-muted);
}

.mt-gap {
    margin-top: var(--spacing-s);
}

.mt-5 {
    margin-top: var(--spacing-huge);
}

/* Scroll Animations (Fade In) */
.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================================================
 * RESPONSIVE
 * ======================================================================== */
@media (max-width: 768px) {
    :root {
        --spacing-huge: 60px;
        --spacing-gap: 30px;
        --font-size-hero: 32px;
        --font-size-logo: 40px;
    }
}

/* Small Mobile Optimization (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --spacing-huge: 40px;
        --spacing-xl: 24px;
        --spacing-l: 16px;
        --spacing-gap: 20px;

        /* Compact Typography */
        --font-size-hero: 28px;
        --font-size-logo: 32px;
        --font-size-display: 24px;
        --font-size-xxl: 20px;
        --font-size-xl: 18px;
        --font-size-l: 15px;
        --font-size-m: 14px;
    }
}