/* ==========================================================================
   SAAO — base.css
   Reset, design tokens, typography, layout primitives
   Dark theme only. Mobile-first.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  tab-size: 4;
}

body {
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
html { overflow-x: clip; }

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

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

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Design tokens -------------------------------------------------- */
:root {
  /* Surfaces & foreground */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --fg: #f5f5f5;
  --fg-muted: #888;
  --fg-dim: #555;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;

  /* Brand */
  --accent: #ffcc00;
  --accent-hover: #ffd633;
  --accent-dim: rgba(255, 204, 0, 0.18);
  --accent-glow: rgba(255, 204, 0, 0.35);

  /* Status */
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;

  /* Radius */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Spacing scale */
  --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: 128px;

  /* Unified section rhythm */
  --space-section:     clamp(56px, 5.5vw, 88px);
  --space-subsection:  clamp(36px, 3.5vw, 56px);
  --space-section-sm:  clamp(40px, 4vw, 64px);
  --space-gap:         clamp(20px, 2vw, 32px);

  /* Fluid type scale (clamp(min, preferred, max)) */
  --fs-xs:      clamp(0.70rem, 0.67rem + 0.15vw, 0.78rem);
  --fs-sm:      clamp(0.82rem, 0.79rem + 0.18vw, 0.92rem);
  --fs-base:    clamp(0.95rem, 0.90rem + 0.20vw, 1.05rem);
  --fs-md:      clamp(1.05rem, 0.98rem + 0.35vw, 1.20rem);
  --fs-lg:      clamp(1.20rem, 1.10rem + 0.55vw, 1.45rem);
  --fs-xl:      clamp(1.45rem, 1.25rem + 1.00vw, 2.00rem);
  --fs-2xl:     clamp(1.90rem, 1.55rem + 1.70vw, 2.85rem);
  --fs-3xl:     clamp(2.40rem, 1.85rem + 2.70vw, 3.80rem);
  --fs-display: clamp(3.00rem, 1.80rem + 6.00vw, 7.50rem); /* 48px -> 120px */

  /* Typography */
  --font-display: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Line heights */
  --lh-tight: 1.05;
  --lh-snug: 1.25;
  --lh-normal: 1.55;
  --lh-loose: 1.75;

  /* Letter spacing */
  --tracking-tight: -0.02em;
  --tracking-snug:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:  0.06em;
  --tracking-wider: 0.16em;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.7);
  --shadow-accent: 0 10px 40px -10px var(--accent-glow);

  /* Motion */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.64, 0, 0.78, 0);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 160ms;
  --dur:      280ms;
  --dur-slow: 520ms;

  /* Layout */
  --container: 1280px;
  --container-wide: 1440px;
  --container-narrow: 960px;
  --header-h: 72px;

  /* Z-index scale */
  --z-base: 1;
  --z-raised: 10;
  --z-sticky: 50;
  --z-header: 100;
  --z-drawer: 200;
  --z-modal: 300;
  --z-cursor: 900;
  --z-toast: 1000;
}

/* ---------- Base body / typography ---------------------------------------- */
html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 400;
  letter-spacing: var(--tracking-normal);
}

body {
  background-image:
    radial-gradient(circle at 15% -10%, rgba(255, 204, 0, 0.05), transparent 45%),
    radial-gradient(circle at 90% 110%, rgba(255, 204, 0, 0.03), transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

p {
  color: var(--fg);
  max-width: 68ch;
}

small {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}

strong, b {
  font-weight: 600;
  color: var(--fg);
}

em, i {
  font-style: italic;
}

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-6) 0;
}

/* ---------- Typography helpers -------------------------------------------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--accent);
  padding: var(--s-1) 0;
  margin-bottom: var(--s-3);
  position: relative;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: var(--s-3);
}

.h-display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-display);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-wrap: balance;
}

.lead {
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--fg-muted);
  max-width: 62ch;
}

.text-muted  { color: var(--fg-muted); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.uppercase   { text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.mono        { font-family: var(--font-mono); }

/* ---------- Layout primitives --------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-4);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--s-4);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--s-4);
}

.section {
  padding-block: var(--s-8);
}

.section-lg {
  padding-block: var(--s-9);
}

.stack > * + * {
  margin-top: var(--s-4);
}
.stack-lg > * + * {
  margin-top: var(--s-6);
}
.stack-xl > * + * {
  margin-top: var(--s-7);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--s-5);
}

.flex {
  display: flex;
  gap: var(--s-3);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

/* ---------- Divider -------------------------------------------------------- */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  border: 0;
  margin-block: var(--s-7);
}

/* ---------- Breakpoints ---------------------------------------------------- */
@media (min-width: 768px) {
  :root {
    --header-h: 80px;
  }
  .container,
  .container-wide,
  .container-narrow {
    padding-inline: var(--s-6);
  }
  .section    { padding-block: var(--s-9); }
  .section-lg { padding-block: var(--s-10); }
}

@media (min-width: 1200px) {
  .container,
  .container-wide,
  .container-narrow {
    padding-inline: var(--s-7);
  }
}

/* ---------- Scrollbar (webkit) -------------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) var(--bg);
}
