/* ============================================
   Base — Typography and global styles
   ============================================ */

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Skip link — visible only on focus for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-md);
    z-index: 10000;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-dark);
    color: var(--cyan);
    border: 1px solid var(--cyan);
    font-size: var(--text-sm);
    text-decoration: none;
}

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

/* Grid background — Tron Legacy infinite grid */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--cyan-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--cyan-dim) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-bright);
    line-height: 1.2;
    letter-spacing: 0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

/* Links */
a {
    color: var(--cyan-dim);
    transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

a:hover {
    color: var(--cyan);
    text-shadow: var(--glow-cyan-sm);
}

/* Selection */
::selection {
    background: var(--cyan-muted);
    color: var(--text-bright);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

/* Canvas WebGL — created dynamically by JS */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    filter: blur(1.5px);
}

/* Section titles — accent underline */
.section-title {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2xl);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--cyan);
    box-shadow: var(--glow-cyan-sm);
}

/* Section subtitle */
.section-subtitle {
    color: var(--text-dim);
    font-size: var(--text-lg);
    margin-bottom: var(--space-3xl);
    max-width: 700px;
}

/* Text readability — halo on floating text over 3D scene */
.section-title,
.section-subtitle,
.hero__title,
.hero__subtitle,
.hero__tagline {
    text-shadow: var(--text-shadow-heading);
}

/* Paragraph spacing in content blocks */
.content p + p {
    margin-top: var(--space-md);
}

/* High contrast mode — toggled via data-contrast="high" on <html> */
[data-contrast="high"] {
    --text: #FFFFFF;
    --text-bright: #FFFFFF;
    --text-dim: #E0E0E0;
    --text-muted: #CCCCCC;
    --cyan: #00FFFF;
    --cyan-dim: #00FFFF;
    --orange: #FF9933;
    --orange-dim: #FF9933;
    --border: rgba(0, 255, 255, 0.5);
    --border-bright: rgba(0, 255, 255, 0.8);
    --glow-idle: none;
    --glow-hover: none;
    --glow-active: none;
    --glow-disabled: none;
    --glow-cyan: none;
    --glow-cyan-sm: none;
    --glow-idle-orange: none;
    --glow-hover-orange: none;
    --glow-active-orange: none;
}

[data-contrast="high"] a {
    text-decoration: underline;
}

[data-contrast="high"] .btn,
[data-contrast="high"] .card {
    border-width: 2px;
}

[data-contrast="high"] #webgl-canvas,
[data-contrast="high"] .grid-bg {
    opacity: 0.15;
}

/* Contrast toggle button */
.contrast-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: var(--text-xs);
    padding: 2px var(--space-sm);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: clickable-shimmer-dim 5s ease-in-out infinite -2s,
               border-shimmer-dim 5s ease-in-out infinite -2s;
    transition: color var(--transition-glow-out),
                border-color var(--transition-glow-out);
}

.contrast-toggle:hover {
    animation: none;
    color: var(--amber);
    border-color: var(--amber);
    transition: color var(--transition-glow-in),
                border-color var(--transition-glow-in);
}

.contrast-toggle:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}
