/* ============================================================
   base.css
   Foundation: design tokens, reset, ambient background,
   typography, global utilities, reveal primitive, a11y motion.
   ============================================================ */

:root {
    --bg: #030712;
    --bg-2: #0a1322;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --primary: #0ea5e9;
    --primary-2: #38bdf8;
    --blue: #3b82f6;
    --indigo: #6366f1;
    --text: #f1f5f9;
    --muted: #93a3b8;
    --muted-2: #64748b;
    --gradient: linear-gradient(120deg, #38bdf8, #3b82f6);
    --glow: rgba(14, 165, 233, 0.22);
    --radius: 20px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --maxw: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Ambient background layer */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(900px 600px at 80% -10%, rgba(59, 130, 246, 0.16), transparent 60%),
        radial-gradient(700px 500px at 0% 20%, rgba(14, 165, 233, 0.12), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg) 100%);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    will-change: transform;
}

.blob.b1 {
    width: 460px;
    height: 460px;
    top: -120px;
    right: -80px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.55), transparent 70%);
    animation: float1 18s ease-in-out infinite;
}

.blob.b2 {
    width: 520px;
    height: 520px;
    bottom: -160px;
    left: -120px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.45), transparent 70%);
    animation: float2 22s ease-in-out infinite;
}

.blob.b3 {
    width: 360px;
    height: 360px;
    top: 40%;
    left: 55%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.30), transparent 70%);
    animation: float1 26s ease-in-out infinite reverse;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 30px) scale(1.08); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -40px) scale(1.12); }
}

/* Grain / mesh overlay */
.ambient::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; }

p { color: var(--muted); font-size: 1.05rem; }

a { text-decoration: none; color: inherit; transition: color 0.25s var(--ease); }

.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Focus visibility (a11y) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-2);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Global utilities */
.hidden { display: none; }

/* Scroll reveal primitive */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.in { opacity: 1; transform: none; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .blob { display: none; }
}
