/* ============================================
   CORE — Variables, Reset, Typography, Utilities
   rolandmantama.ch
   ============================================ */

/* --- Theme Variables --- */
:root {
    /* Light theme (default) */
    --color-bg-primary: #fafaf9;
    --color-bg-secondary: #f5f5f4;
    --color-bg-tertiary: #e7e5e4;
    --color-text-primary: #1c1917;
    --color-text-secondary: #44403c;
    --color-text-muted: #78716c;
    --color-accent: #0ea5e9;
    --color-accent-hover: #0284c7;
    --color-accent-glow: rgba(14, 165, 233, 0.25);
    --color-purple: #8b5cf6;
    --color-pink: #ec4899;
    --color-emerald: #10b981;
    --color-orange: #f97316;
    --gradient-primary: linear-gradient(135deg, #0ea5e9, #8b5cf6, #ec4899);
    --gradient-accent: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-cool: linear-gradient(135deg, #10b981, #0ea5e9);
    --color-border: #d6d3d1;
    --color-card-bg: #ffffff;
    --color-code-bg: #292524;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
    --shadow-md: 0 4px 6px rgba(28, 25, 23, 0.07);
    --shadow-lg: 0 10px 25px rgba(28, 25, 23, 0.1);
    --shadow-xl: 0 20px 50px rgba(28, 25, 23, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-display: 'Clash Display', 'Satoshi', system-ui, -apple-system, sans-serif;
    --font-body: 'DM Sans', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
    --text-sm: clamp(0.8125rem, 0.75rem + 0.3vw, 0.875rem);
    --text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1rem);
    --text-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.125rem);
    --text-xl: clamp(1.1875rem, 1rem + 0.5vw, 1.25rem);
    --text-2xl: clamp(1.375rem, 1.125rem + 0.75vw, 1.5rem);
    --text-3xl: clamp(1.625rem, 1.25rem + 1vw, 1.875rem);
    --text-4xl: clamp(2rem, 1.5rem + 1.5vw, 2.5rem);
    --text-5xl: clamp(2.5rem, 1.75rem + 2.5vw, 3.5rem);
    --text-6xl: clamp(3rem, 2rem + 3.5vw, 4.5rem);

    /* 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;
    --space-5xl: 8rem;

    /* Layout */
    --container-max: 1200px;
    --container-padding: clamp(1rem, 3vw, 2rem);
    --nav-height: 4rem;

    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --color-bg-primary: #0c0a09;
    --color-bg-secondary: #1c1917;
    --color-bg-tertiary: #292524;
    --color-text-primary: #fafaf9;
    --color-text-secondary: #d6d3d1;
    --color-text-muted: #a8a29e;
    --color-accent: #38bdf8;
    --color-accent-hover: #7dd3fc;
    --color-accent-glow: rgba(56, 189, 248, 0.3);
    --color-border: #44403c;
    --color-card-bg: #1c1917;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
}

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

html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition:
        background-color var(--transition-normal),
        color var(--transition-normal);
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

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

ul,
ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

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

p {
    color: var(--color-text-secondary);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* --- Utilities --- */
.u-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.u-visually-hidden.u-focus-visible:focus {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    width: auto;
    height: auto;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
}

.u-text-center { text-align: center; }
.u-text-muted { color: var(--color-text-muted); }

/* --- Section Title --- */
.section-title {
    text-align: center;
    margin-bottom: var(--space-3xl);
    position: relative;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    margin: var(--space-md) auto 0;
    border-radius: var(--radius-full);
}

/* --- Container --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
