/* ══════════════════════════════════════════
   THEME TOKENS
══════════════════════════════════════════ */
:root {
    --bg: #0e1015;
    --bg-accent: #13151b;
    --bg-elevated: #191c24;
    --bg-hover: #1f2330;
    --bg-muted: #1f2330;
    --card: #161920;
    --card-foreground: #f0f0f2;
    --card-highlight: rgba(255, 255, 255, 0.04);
    --popover: #191c24;
    --popover-foreground: #f0f0f2;
    --panel: #0e1015;
    --panel-strong: #191c24;
    --panel-hover: #1f2330;
    --chrome: rgba(14, 16, 21, 0.96);
    --chrome-strong: rgba(14, 16, 21, 0.98);
    --text: #d4d4d8;
    --text-strong: #f4f4f5;
    --chat-text: #d4d4d8;
    --muted: #838387;
    --muted-strong: #75757d;
    --muted-foreground: #838387;
    --border: #1e2028;
    --border-strong: #2e3040;
    --border-hover: #3e4050;
    --input: #1e2028;
    --ring: #ff5c5c;
    --accent: #ff5c5c;
    --accent-hover: #ff7070;
    --accent-muted: #ff5c5c;
    --accent-subtle: rgba(255, 92, 92, 0.1);
    --accent-foreground: #fafafa;
    --accent-glow: rgba(255, 92, 92, 0.2);
    --primary: #ff5c5c;
    --primary-foreground: #ffffff;
    --secondary: #161920;
    --secondary-foreground: #f0f0f2;
    --accent-2: #14b8a6;
    --accent-2-muted: rgba(20, 184, 166, 0.7);
    --accent-2-subtle: rgba(20, 184, 166, 0.1);
    --ok: #22c55e;
    --ok-muted: rgba(34, 197, 94, 0.75);
    --ok-subtle: rgba(34, 197, 94, 0.08);
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --warn: #f59e0b;
    --warn-muted: rgba(245, 158, 11, 0.75);
    --warn-subtle: rgba(245, 158, 11, 0.08);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.75);
    --danger-subtle: rgba(239, 68, 68, 0.08);
    --info: #3b82f6;
    --focus: rgba(255, 92, 92, 0.2);
    --focus-ring: 0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ring) 80%, transparent);
    --focus-glow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow);
    --grid-line: rgba(255, 255, 255, 0.03);
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: var(--font-body);
    --font-weight-bold: 750;
    --font-weight-semibold: 650;
    --font-weight-medium: 550;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.6);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.25), inset 0 -1px 2px 0 rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 24px var(--accent-glow), 0 0 48px rgba(255, 92, 92, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --radius: 12px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 100ms;
    --duration-normal: 180ms;
    --duration-slow: 300ms;
    color-scheme: dark;
}

:root[data-theme-mode="light"] {
    --bg: #f8f9fa;
    --bg-accent: #f1f3f5;
    --bg-elevated: #ffffff;
    --bg-hover: #eceef0;
    --bg-muted: #eceef0;
    --card: #ffffff;
    --card-foreground: #1a1a1e;
    --card-highlight: rgba(0, 0, 0, 0.02);
    --popover: #ffffff;
    --popover-foreground: #1a1a1e;
    --panel: #f8f9fa;
    --panel-strong: #f1f3f5;
    --panel-hover: #e6e8eb;
    --chrome: rgba(248, 249, 250, 0.96);
    --chrome-strong: rgba(248, 249, 250, 0.98);
    --text: #3c3c43;
    --text-strong: #1a1a1e;
    --chat-text: #3c3c43;
    --muted: #6e6e73;
    --muted-strong: #545458;
    --muted-foreground: #6e6e73;
    --border: #e5e5ea;
    --border-strong: #d1d1d6;
    --border-hover: #aeaeb2;
    --input: #e5e5ea;
    --accent: #dc2626;
    --accent-hover: #ef4444;
    --accent-muted: #dc2626;
    --accent-subtle: rgba(220, 38, 38, 0.08);
    --accent-foreground: #ffffff;
    --accent-glow: rgba(220, 38, 38, 0.1);
    --primary: #dc2626;
    --primary-foreground: #ffffff;
    --secondary: #f1f3f5;
    --secondary-foreground: #3c3c43;
    --accent-2: #0d9488;
    --ok: #15803d;
    --warn: #b45309;
    --danger: #dc2626;
    --focus: rgba(220, 38, 38, 0.15);
    --focus-ring: 0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ring) 70%, transparent);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.1);
    color-scheme: light;
}

:root[data-theme="openknot"] {
    --ring: #e5243b;
    --accent: #e5243b;
    --accent-hover: #f03e52;
    --primary: #e5243b;
    --bg: #080808;
    --bg-accent: #0d0d0f;
    --bg-elevated: #141416;
    --bg-hover: #1a1a1e;
    --card: #111113;
    --border: #1a1a1e;
    --text: #e0e0e2;
    --text-strong: #f5f5f7;
    --accent-subtle: rgba(229, 36, 59, 0.1);
    --accent-glow: rgba(229, 36, 59, 0.2);
}

:root[data-theme="dash"] {
    --ring: #b47840;
    --accent: #b47840;
    --accent-hover: #c8885a;
    --primary: #b47840;
    --bg: #1a1210;
    --bg-accent: #201816;
    --bg-elevated: #28201c;
    --card: #221a16;
    --text: #d8c8b8;
    --text-strong: #f0e4da;
    --border: #302418;
    --accent-subtle: rgba(180, 120, 64, 0.1);
    --accent-glow: rgba(180, 120, 64, 0.2);
}

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font: var(--font-weight-medium) 14px/1.55 var(--font-body);
    letter-spacing: -0.01em;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background var(--duration-normal), color var(--duration-normal);
    padding-top: 70px;
}

::selection {
    background: var(--accent-subtle);
    color: var(--text-strong);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

a {
    text-decoration: none;
    color: inherit;
}

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

input,
textarea,
button {
    font: inherit;
}

/* ══════════════════════════════════════════
   UTILITY CLASSES
══════════════════════════════════════════ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stagger-1 {
    animation: rise 0.35s 0.05s var(--ease-spring) both;
}

.stagger-2 {
    animation: rise 0.35s 0.1s var(--ease-spring) both;
}

.stagger-3 {
    animation: rise 0.35s 0.15s var(--ease-spring) both;
}

.stagger-4 {
    animation: rise 0.35s 0.2s var(--ease-spring) both;
}

/* ══════════════════════════════════════════
   TYPEWRITER
══════════════════════════════════════════ */
.cursor {
    display: inline-block;
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    margin-left: 2px;
    opacity: 1;
}

.cursor.blinking {
    animation: blink 1s step-start infinite;
}

/* ══════════════════════════════════════════
   SCROLL REVEAL
══════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
    visibility: hidden;
    will-change: transform, opacity;
}

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

/* Staggered reveals for children */
.reveal-stagger>* {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal-stagger.revealed>* {
    opacity: 1;
    transform: translateY(0);
}

/* Add delays for stagger children */
.reveal-stagger.revealed>*:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal-stagger.revealed>*:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal-stagger.revealed>*:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal-stagger.revealed>*:nth-child(4) {
    transition-delay: 0.4s;
}

.reveal-stagger.revealed>*:nth-child(5) {
    transition-delay: 0.5s;
}