/* Inclawbate — Core Theme & Layout */
/* Design system aligned with clawn.ch aesthetic */

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

:root {
    /* ── Clawnch-aligned color system (warm charcoal + lobster) ── */

    /* Background hierarchy — warm undertone (hue 12) */
    --bg-deepest: hsl(12, 6%, 5%);
    --bg-surface: hsl(12, 5%, 8%);
    --bg-elevated: hsl(12, 4%, 11%);
    --bg-card: hsl(12, 4%, 15%);
    --bg-card-hover: hsl(25, 4%, 17%);
    --bg-tertiary: hsl(12, 3%, 13%);

    /* Borders — warm tint */
    --border-subtle: hsl(12, 3%, 22%);
    --border-default: hsl(12, 3%, 28%);
    --border-bright: hsl(12, 2%, 36%);

    /* Primary accent — Lobster Red/Coral */
    --lobster-200: hsl(11, 44%, 76%);
    --lobster-300: hsl(10, 41%, 64%);
    --lobster-400: hsl(9, 44%, 54%);
    --lobster-500: hsl(8, 41%, 46%);
    --accent-primary: var(--lobster-400);
    --accent-glow: hsla(9, 52%, 54%, 0.15);
    --accent-gradient: linear-gradient(135deg, var(--lobster-400), var(--lobster-300));

    /* Secondary accent — Seafoam Teal */
    --seafoam-400: hsl(172, 27%, 46%);
    --seafoam-500: hsl(172, 29%, 38%);
    --accent-secondary: var(--seafoam-400);

    /* Tertiary accent — Warm Sand/Gold */
    --sand-300: hsl(32, 27%, 64%);
    --sand-400: hsl(30, 26%, 54%);

    /* Info — Slate Blue */
    --blue-400: hsl(210, 24%, 52%);
    --blue-500: hsl(210, 27%, 44%);

    /* Status */
    --green: var(--seafoam-400);
    --green-dim: hsla(172, 27%, 46%, 0.15);
    --red: hsl(0, 65%, 55%);
    --red-dim: hsla(0, 65%, 55%, 0.12);
    --yellow: var(--sand-300);
    --yellow-dim: hsla(32, 27%, 64%, 0.15);
    --orange: hsl(24, 70%, 50%);

    /* Text — warm tint */
    --text-primary: hsl(12, 6%, 90%);
    --text-secondary: hsl(12, 3%, 56%);
    --text-dim: hsl(12, 2%, 44%);
    --text-on-accent: hsl(12, 8%, 96%);

    /* Typography — matching clawn.ch font approach */
    --font-display: 'Nunito', 'Quicksand', system-ui, -apple-system, sans-serif;
    --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 14px;
    --space-lg: 18px;
    --space-xl: 24px;
    --space-2xl: 36px;
    --space-3xl: 56px;
    --space-4xl: 72px;

    /* Radius — tighter, like clawn.ch */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-2xl: 18px;
    --radius-full: 9999px;

    /* Shadows — warm */
    --shadow-sm: 0 1px 2px hsla(12, 6%, 5%, 0.4);
    --shadow-md: 0 4px 12px hsla(12, 6%, 5%, 0.5);
    --shadow-lg: 0 8px 24px hsla(12, 6%, 5%, 0.6);
    --shadow-glow: 0 0 20px hsla(9, 52%, 54%, 0.15);
    --shadow-glow-teal: 0 0 20px hsla(172, 32%, 46%, 0.12);

    /* Transitions — snappy */
    --transition-fast: 120ms ease-out;
    --transition-base: 200ms ease-out;
    --transition-slow: 350ms ease-out;
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);

    /* Layout */
    --max-width: 1280px;
    --max-width-narrow: 560px;
    --nav-height: 56px;

    /* Token page overrides (set dynamically via JS) */
    --token-primary: var(--accent-primary);
    --token-secondary: var(--accent-secondary);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-deepest);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
}

/* Noise texture overlay — like clawn.ch */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    pointer-events: none;
    z-index: 9999;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Selection color */
::selection {
    background: hsla(9, 50%, 54%, 0.2);
    color: var(--text-primary);
}

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

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

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

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

a:hover {
    color: var(--lobster-200);
}

code, pre {
    font-family: var(--font-mono);
}

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

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

/* Layout Utilities */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-narrow {
    max-width: var(--max-width-narrow);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.text-center { text-align: center; }
.text-right { text-align: right; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* Spacing helpers */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.pt-xl { padding-top: var(--space-xl); }
.pt-2xl { padding-top: var(--space-2xl); }
.pt-3xl { padding-top: var(--space-3xl); }
.pb-xl { padding-bottom: var(--space-xl); }
.pb-2xl { padding-bottom: var(--space-2xl); }
.pb-3xl { padding-bottom: var(--space-3xl); }

/* Visibility */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Scrollbar — warm */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(12, 3%, 22%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(12, 2%, 32%);
}

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

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

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes subtleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes ping {
    0% { transform: scale(1); opacity: 0.6; }
    75%, 100% { transform: scale(2); opacity: 0; }
}

.animate-fade-in { animation: fadeIn 0.6s var(--ease-smooth) forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s var(--ease-smooth) forwards; }
.animate-float { animation: subtleFloat 4s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --nav-height: 52px;
    }

    h1 { font-size: 1.625rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }

    .container { padding: 0 var(--space-lg); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .hide-mobile { display: none !important; }
}

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