/* ==========================================================================
   The Indie Scientist — Base
   Design tokens, font faces, reset, typography and utilities.
   Every other stylesheet builds on the custom properties defined here.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette */
  --c-black: #111111;
  --c-crimson: #c51f32;
  --c-gunmetal: #24272c;
  --c-white: #f2f2f2;
  --c-gray: #a0a0a0;

  /* Derived surfaces */
  --c-bg: #0c0c0d;
  --c-bg-raised: #111111;
  --c-panel: #17191c;
  --c-panel-2: #1c1f23;
  --c-line: #2b2f35;
  --c-line-strong: #3a3f47;
  --c-text: var(--c-white);
  --c-text-muted: var(--c-gray);
  --c-text-dim: #6f737a;

  /* Accent — overridden per product brand (see [data-brand]) */
  --accent: var(--c-crimson);
  --accent-hi: #e0384b;
  --accent-rgb: 197 31 50;
  --accent-glow: rgb(var(--accent-rgb) / 0.35);
  --accent-soft: rgb(var(--accent-rgb) / 0.12);

  /* Status colours */
  --c-status-dev: #e0a526;
  --c-status-released: #3fb68b;
  --c-status-concept: #8a93a6;

  /* Typography */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
  --fs-2xl: clamp(2rem, 1.5rem + 2.4vw, 3.25rem);
  --fs-3xl: clamp(2.5rem, 1.6rem + 4.2vw, 5rem);

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --section-pad: clamp(4rem, 3rem + 5vw, 8rem);

  /* Layout */
  --container: 1240px;
  --container-narrow: 820px;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --header-h: 72px;

  /* Shape & depth */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-panel: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 20px 40px -24px rgb(0 0 0 / 0.8);
  --glow: 0 0 0 1px rgb(var(--accent-rgb) / 0.4), 0 0 28px -4px var(--accent-glow);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 150ms;
  --dur: 280ms;
  --dur-slow: 700ms;

  color-scheme: dark;
}

/* Product / game brand themes. Add a block per new product line. */
[data-brand="vantom"] {
  --accent: #c51f32;
  --accent-hi: #ff4058;
  --accent-rgb: 197 31 50;
  --brand-secondary: #9fb3c8;
}
[data-brand="urban-syndicate"] {
  --accent: #e0384b;
  --accent-hi: #ff5a6c;
  --accent-rgb: 224 56 75;
  --brand-secondary: #39c6d6;
}
[data-brand="warehouse-master"] {
  --accent: #e0a526;
  --accent-hi: #f4bd45;
  --accent-rgb: 224 165 38;
  --brand-secondary: #c51f32;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
body {
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
::selection {
  background: var(--accent);
  color: #fff;
}

/* Focus — visible, on-brand, keyboard only */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-hi);
}
.eyebrow::before {
  content: "";
  width: 1.75em;
  height: 1px;
  background: currentColor;
  opacity: 0.8;
}
.eyebrow--plain::before {
  display: none;
}
.lead {
  font-size: var(--fs-md);
  color: var(--c-text-muted);
  max-width: 62ch;
}
.muted {
  color: var(--c-text-muted);
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.text-accent {
  color: var(--accent-hi);
}

.prose {
  max-width: 70ch;
  color: var(--c-text-muted);
}
.prose > * + * {
  margin-top: 1.1em;
}
.prose h2 {
  margin-top: 2.2em;
  font-size: var(--fs-lg);
  color: var(--c-text);
}
.prose h3 {
  margin-top: 1.8em;
  font-size: var(--fs-md);
  color: var(--c-text);
}
.prose a {
  color: var(--c-text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.prose ul {
  padding-left: 1.2em;
}
.prose li + li {
  margin-top: 0.4em;
}
.prose strong {
  color: var(--c-text);
}

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 1000;
  padding: var(--sp-3) var(--sp-4);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: var(--sp-3);
}
[hidden] {
  display: none !important;
}

/* ---------- Reveal-on-scroll (enabled by JS only) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
