/* ============================================================
   AIMonger design system - shared across all pages
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces */
  --bg-deep: #050508;
  --bg-elevated: #0b0b12;
  --bg-glass: rgba(11, 11, 18, 0.72);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shine: rgba(255, 255, 255, 0.04);

  /* Foreground */
  --fg-primary: #e8eaef;
  --fg-secondary: rgba(232, 234, 239, 0.70);
  --fg-muted: rgba(232, 234, 239, 0.40);

  /* Accents - semantic, referenced via var() only */
  --teal: #2ee6d6;
  --amber: #d97757;
  --indigo: #4630e6;
  --teal-soft: rgba(46, 230, 214, 0.08);
  --amber-soft: rgba(217, 119, 87, 0.08);
  --indigo-soft: rgba(70, 48, 230, 0.10);

  /* Type */
  --font-display: "SF Pro Display", "Helvetica Neue", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", monospace;
  --h1: clamp(3rem, 7vw, 6rem);
  --h2: clamp(1.75rem, 4vw, 3rem);
  --h3: clamp(1.1rem, 2vw, 1.35rem);
  --lede-size: clamp(1.05rem, 2.2vw, 1.3rem);
  --track-display: -0.03em;

  /* Spacing - 8px system */
  --s1: 0.5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2rem;
  --s5: 3rem; --s6: 4rem; --s7: 6rem; --s8: 8rem;

  /* Glass physics */
  --glass-blur: 14px;
  --glass-saturate: 1.8;
  --glass-brightness: 1.06;
  --radius: 6px;
  --radius-lg: 14px;

  /* Depth / structure */
  --line: rgba(255, 255, 255, 0.05);
  --grid-size: 64px;
  --noise-opacity: 0.022;
  --maxw: 64rem;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.35s; --dur: 0.6s; --dur-slow: 1.1s;
}

html {
  background: var(--bg-deep);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.55;
  position: relative;
}

/* Background field: layered radial glows */
.field {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, var(--teal-soft), transparent 60%),
    radial-gradient(circle at 88% 78%, var(--amber-soft), transparent 45%),
    radial-gradient(circle at 12% 90%, var(--indigo-soft), transparent 40%),
    var(--bg-deep);
}
.grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
}

/* Tactile grain overlay */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: var(--noise-opacity); mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Glass material */
.glass {
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) brightness(var(--glass-brightness));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) brightness(var(--glass-brightness));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--glass-shine), 0 24px 60px -30px rgba(0,0,0,0.7);
  position: relative;
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, var(--teal-soft), transparent 40%, var(--amber-soft));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}

/* Layout primitives */
.wrap {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 5vw, 3rem);
}
section { position: relative; z-index: 1; }
.section-pad { padding: var(--s7) 0; }

/* Typography */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: var(--track-display); line-height: 1.08; }
h1 { font-size: var(--h1); margin-bottom: var(--s3); }
h2 { font-size: var(--h2); margin-bottom: var(--s3); }
h3 { font-size: var(--h3); margin-bottom: var(--s2); }
.lede { font-size: var(--lede-size); line-height: 1.65; color: var(--fg-secondary); max-width: 40em; }
.lede + .lede { margin-top: var(--s2); color: var(--fg-muted); }
.eyebrow, .section-label {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--fg-muted);
}
.section-label { display: block; margin-top: var(--s6); margin-bottom: var(--s3); }
mark { background: none; color: var(--teal); font-style: normal; }

/* Links */
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--teal); opacity: 0.85; }

/* Footer */
footer {
  position: relative; z-index: 1; border-top: 1px solid var(--line);
  padding: var(--s4) clamp(1.25rem, 5vw, 3rem);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-muted);
}
footer a { color: var(--fg-secondary); text-decoration: none; transition: color var(--dur-fast); }
footer a:hover, footer a:focus-visible { color: var(--teal); }
footer a:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }

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