/* ============================================================
   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;
  scrollbar-gutter: stable;
  /* clip (not hidden): avoids forcing overflow-y:auto on body, which traps
     position:fixed layers and can blank the lower viewport on tall monitors */
  overflow-x: clip;
}

body {
  min-height: 100dvh;
  line-height: 1.55;
  position: relative;
  isolation: isolate; /* keep z-index:-1 field layers above html bg, below content */
}

/* Background field: layered radial glows.
   z-index:-1 so content never needs a matching z-index:1 patch to stay visible. */
.field {
  position: fixed; inset: 0; z-index: -1; 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: -1; 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 - behind content. Full-viewport mix-blend soft-light at z-index 60
   blanked the lower half of tall (portrait) viewports on the whitepapers hub. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--noise-opacity);
  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; }

/* ----------------------------------------------------------
   Label accents - larger understated mono + soft teal shimmer
   Used on homepage section labels, WP series/section heads,
   team page titles. Keep understated; motion is slow.
   ---------------------------------------------------------- */
@keyframes label-shimmer {
  0%, 12% { background-position: 100% 50%; }
  45%, 55% { background-position: 0% 50%; }
  88%, 100% { background-position: 100% 50%; }
}
.label-shimmer-soft,
.section-label,
.page-header .sub,
.wp-search-label {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: var(--fg-secondary);
  background-image: linear-gradient(
    105deg,
    var(--fg-secondary) 0%,
    var(--fg-secondary) 38%,
    rgba(46, 230, 214, 0.95) 50%,
    var(--fg-secondary) 62%,
    var(--fg-secondary) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: label-shimmer 7s var(--ease-in-out) infinite;
}
.label-shimmer-teal,
.series,
.section-h,
.step-num,
.practice-band .band-label,
.practice-body dt,
.card-names .title {
  color: var(--teal);
  background-image: linear-gradient(
    105deg,
    var(--teal) 0%,
    var(--teal) 36%,
    #c6fff8 50%,
    var(--teal) 64%,
    var(--teal) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: label-shimmer 6.5s var(--ease-in-out) infinite;
}
.series,
.section-h {
  font-size: 1rem;
  letter-spacing: 0.16em;
}
.wp-search-label { font-size: 0.88rem; letter-spacing: 0.14em; }
.page-header .sub { font-size: 0.9rem; letter-spacing: 0.14em; }
.card-names .title { font-size: 0.92rem; letter-spacing: 0.06em; }

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

/* Canonical site brand mark - AFTER link rules so it wins cascade.
   36px logo.png + AIMONGER + page subtitle. Never teal/underlined like body links. */
a.brand,
a.brand:hover,
a.brand:focus,
a.brand:focus-visible {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--fg-primary);
  opacity: 1;
}
a.brand img {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}
a.brand .brand-text {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-primary);
  line-height: 1.2;
  display: block;
}
a.brand .brand-text small {
  display: block;
  margin-top: 0.15rem;
  color: var(--fg-muted);
  letter-spacing: 0.14em;
  font-weight: 500;
}

/* 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; }
  .label-shimmer-soft,
  .label-shimmer-teal,
  .section-label,
  .page-header .sub,
  .wp-search-label,
  .series,
  .section-h,
  .step-num,
  .practice-band .band-label,
  .practice-body dt,
  .card-names .title {
    animation: none !important;
    background-image: none;
    -webkit-text-fill-color: unset;
  }
  .section-label,
  .page-header .sub,
  .wp-search-label { color: var(--fg-secondary); }
  .series,
  .section-h,
  .step-num,
  .practice-band .band-label,
  .practice-body dt,
  .card-names .title { color: var(--teal); }
}