/* AtomForge Labs — Design Tokens (noir grain) */

:root {
  /* Color — DARK BY DEFAULT — noir/grainy aesthetic */
  --bg: #0B0B0C;            /* near-black canvas */
  --bg-elevated: #131315;   /* card surface */
  --bg-sunken: #060607;     /* deepest */
  --bg-spot: #2A2A2C;       /* spotlight floor */
  --ink: #F1EFE8;           /* warm off-white */
  --ink-soft: #C9C7BF;
  --muted: #6F6E68;
  --line: rgba(241, 239, 232, 0.10);
  --line-soft: rgba(241, 239, 232, 0.05);
  --accent: #4F8FFF;        /* electric blue */
  --accent-warm: #7BAFFF;
  --accent-deep: #1F4FB7;
  --accent-soft: rgba(245, 165, 36, 0.12);

  /* Type */
  --font-sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale */
  --text-eyebrow: 11px;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-xl: 28px;
  --text-2xl: 36px;
  --text-3xl: 48px;
  --text-4xl: 64px;
  --text-5xl: 84px;
  --text-display: clamp(56px, 8vw, 120px);

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 144px;

  /* Radii */
  --r-1: 4px; --r-2: 8px; --r-3: 14px; --r-4: 22px; --r-pill: 999px;

  /* Easing */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Layout */
  --maxw: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
}

[data-theme="light"] {
  --bg: #ECEAE3;
  --bg-elevated: #F4F2EC;
  --bg-sunken: #DAD7CE;
  --bg-spot: #C9C5BA;
  --ink: #0B0B0C;
  --ink-soft: #2B2A28;
  --muted: #8E8C84;
  --line: rgba(11, 11, 12, 0.10);
  --line-soft: rgba(11, 11, 12, 0.05);
  --accent: #2E63D9;
  --accent-warm: #4F8FFF;
  --accent-deep: #1A3D8C;
  --accent-soft: rgba(200, 132, 26, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

body { transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out); }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #0B0B0C; }

/* === GRAIN ===
   Use .grain on any element for grainy noise overlay.
   .spot creates the noir spotlight gradient — pair with .grain. */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  z-index: 1; mix-blend-mode: overlay; opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}
.grain--strong::after { opacity: 0.55; }
.grain--soft::after { opacity: 0.20; }

/* Noir spotlight surface — dark vignette with central glow */
.spot {
  position: relative;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(255, 230, 180, 0.18), transparent 60%),
    radial-gradient(ellipse 90% 75% at 50% 50%, var(--bg-spot) 0%, var(--bg) 70%);
}

/* Type primitives */
.eyebrow { font-family: var(--font-mono); font-size: var(--text-eyebrow); font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.display { font-family: var(--font-sans); font-size: var(--text-display); font-weight: 500; letter-spacing: -0.035em; line-height: 0.96; text-wrap: balance; }
.h1 { font-size: var(--text-3xl); font-weight: 500; letter-spacing: -0.025em; line-height: 1.04; text-wrap: balance; }
.h2 { font-size: var(--text-2xl); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.h3 { font-size: var(--text-xl); font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; }
.lede { font-size: var(--text-lg); line-height: 1.4; color: var(--ink-soft); letter-spacing: -0.005em; text-wrap: pretty; }
.body { font-size: var(--text-base); line-height: 1.55; color: var(--ink-soft); text-wrap: pretty; }
.small { font-size: var(--text-sm); color: var(--ink-soft); }
.mono { font-family: var(--font-mono); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 20px;
  border-radius: var(--r-pill);
  font-family: var(--font-sans); font-size: 15px; font-weight: 500; letter-spacing: -0.005em;
  border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--ink);
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* Grain overlay shared by buttons, cards, panels — matches hero aesthetic */
.btn, .card, .uc-card, .channel, .stat, .contact-card, .hiw-stage, .demo-card, .spec, .toggle {
  position: relative;
  isolation: isolate;
}
.btn::before, .card::before, .uc-card::before, .channel::before, .stat::before, .contact-card::before, .hiw-stage::before, .demo-card::before, .spec::before, .toggle::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  border-radius: inherit;
  mix-blend-mode: overlay; opacity: 0.45;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.85 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}
.btn > *, .card > *, .uc-card > *, .channel > *, .stat > *, .contact-card > *, .hiw-stage > *, .demo-card > *, .spec > *, .toggle > * {
  position: relative; z-index: 1;
}

.btn--primary { background: var(--accent); color: #0B0B0C; }
.btn--primary:hover { background: var(--accent-warm); }

.btn--ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

.btn--accent { background: var(--accent); color: #0B0B0C; }
.btn--accent:hover { background: var(--accent-warm); }

.btn .arrow { display: inline-block; transition: transform 0.25s var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }

/* Container */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-6);
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  position: relative; isolation: isolate;
}
.card:hover { border-color: var(--ink-soft); }

/* Section */
.section { padding: clamp(80px, 10vw, 144px) 0; border-top: 1px solid var(--line-soft); }

/* Placeholder */
.placeholder {
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(135deg, var(--bg-sunken) 0 8px, transparent 8px 16px),
    var(--bg-elevated);
  border: 1px solid var(--line); border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.reveal.in { opacity: 1; transform: translateY(0); }
