/* ==========================================================================
   AUTONOMOUS AI — DESIGN SYSTEM · TOKENS  (reused from assets/ds/tokens.css)
   Single source of design truth. Components consume SEMANTIC tokens only.
   Namespace: --aai-*
   ========================================================================== */
:root{
  /* 1. PRIMITIVES — warm neutral (paper base is a brand asset) */
  --aai-c-ink-950:#060C15; --aai-c-ink-900:#0A1220; --aai-c-ink-800:#0E1B2C;
  --aai-c-ink-700:#1C2A3F; --aai-c-ink-600:#33415C; --aai-c-ink-500:#5D6B85;
  --aai-c-ink-400:#7A8499; --aai-c-ink-300:#A8B0C0; --aai-c-ink-200:#D8D3C6;
  --aai-c-ink-150:#E6E2D8; --aai-c-ink-100:#EFEDE6; --aai-c-ink-50:#F4F2EC;
  --aai-c-ink-0:#FBFAF7; --aai-c-white:#FFFFFF;
  /* Brand — British racing green */
  --aai-c-green-950:#061A11; --aai-c-green-900:#0A2B1D; --aai-c-green-800:#0E3A28;
  --aai-c-green-700:#17513A; --aai-c-green-600:#1E6A4B; --aai-c-green-500:#2A8560;
  --aai-c-green-400:#4CA57E; --aai-c-green-300:#7FC3A3; --aai-c-green-200:#B0DDC7;
  --aai-c-green-100:#D9EFE4; --aai-c-green-50:#EFF8F3;
  /* Gold — rare editorial accent */
  --aai-c-gold-600:#A67C2E; --aai-c-gold-500:#C89B4A; --aai-c-gold-300:#D9C08F;
  --aai-c-gold-100:#F2E7D0; --aai-c-gold-50:#FAF4E8;

  /* 2. SEMANTIC */
  --aai-surface-page:var(--aai-c-ink-0);
  --aai-surface-raised:var(--aai-c-white);
  --aai-surface-sunken:var(--aai-c-ink-50);
  --aai-surface-inverse:var(--aai-c-ink-900);
  --aai-surface-brand:var(--aai-c-green-700);
  --aai-surface-brand-sub:var(--aai-c-green-50);
  --aai-surface-overlay:rgba(10,18,32,.58);
  --aai-text-primary:var(--aai-c-ink-800);
  --aai-text-secondary:var(--aai-c-ink-600);
  --aai-text-tertiary:var(--aai-c-ink-500);
  --aai-text-inverse:var(--aai-c-ink-0);
  --aai-text-inverse-sub:rgba(251,250,247,.72);
  --aai-text-brand:var(--aai-c-green-700);
  --aai-text-on-brand:var(--aai-c-white);
  --aai-border-subtle:var(--aai-c-ink-150);
  --aai-border-default:var(--aai-c-ink-200);
  --aai-border-strong:var(--aai-c-ink-300);
  --aai-border-brand:var(--aai-c-green-700);
  --aai-action-primary:var(--aai-c-green-700);
  --aai-action-primary-hover:var(--aai-c-green-800);
  --aai-action-primary-active:var(--aai-c-green-900);
  --aai-action-subtle-hover:var(--aai-c-green-50);

  /* 3. TYPOGRAPHY */
  --aai-font-serif:'Fraunces','Iowan Old Style',Georgia,serif;
  --aai-font-sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --aai-text-2xs:.6875rem; --aai-text-xs:.75rem; --aai-text-sm:.8125rem;
  --aai-text-base:.9375rem; --aai-text-md:1rem;
  --aai-text-lg:clamp(1.0625rem,.4vw + .95rem,1.1875rem);
  --aai-text-xl:clamp(1.1875rem,.6vw + 1.05rem,1.375rem);
  --aai-text-2xl:clamp(1.375rem,1vw + 1.15rem,1.75rem);
  --aai-text-3xl:clamp(1.625rem,1.6vw + 1.25rem,2.25rem);
  --aai-text-4xl:clamp(1.875rem,2.6vw + 1.3rem,3rem);
  --aai-text-5xl:clamp(2.25rem,4vw + 1.4rem,3.75rem);
  --aai-text-6xl:clamp(2.625rem,6vw + 1.4rem,5rem);
  --aai-weight-regular:400; --aai-weight-medium:500; --aai-weight-semibold:600; --aai-weight-bold:700;
  --aai-leading-none:1; --aai-leading-tight:1.12; --aai-leading-snug:1.28;
  --aai-leading-normal:1.5; --aai-leading-relaxed:1.6; --aai-leading-loose:1.65;
  --aai-tracking-tighter:-.028em; --aai-tracking-tight:-.018em; --aai-tracking-normal:0;
  --aai-tracking-wide:.04em; --aai-tracking-wider:.12em;
  --aai-measure:66ch; --aai-measure-wide:78ch;

  /* 4. SPACE — 8px grid */
  --aai-space-1:.25rem; --aai-space-2:.5rem; --aai-space-3:.75rem; --aai-space-4:1rem;
  --aai-space-5:1.5rem; --aai-space-6:2rem; --aai-space-7:2.5rem; --aai-space-8:3rem;
  --aai-space-9:4rem; --aai-space-10:5rem; --aai-space-11:6rem; --aai-space-12:8rem;
  --aai-section:clamp(4rem,8vw,7rem); --aai-section-sm:clamp(2.5rem,5vw,4rem);

  /* 5. LAYOUT */
  --aai-container:1180px; --aai-container-wide:1360px; --aai-container-text:760px;
  --aai-gutter:clamp(1.25rem,5vw,4rem); --aai-grid-gap:clamp(1rem,2.4vw,2rem);

  /* 6. RADIUS / BORDER / ELEVATION */
  --aai-radius-xs:4px; --aai-radius-sm:8px; --aai-radius-md:12px; --aai-radius-lg:16px;
  --aai-radius-xl:22px; --aai-radius-full:999px; --aai-border-width:1px;
  --aai-shadow-sm:0 2px 6px rgba(14,27,44,.06);
  --aai-shadow-md:0 8px 22px rgba(14,27,44,.07);
  --aai-shadow-lg:0 18px 44px rgba(14,27,44,.09);
  --aai-shadow-focus:0 0 0 3px rgba(30,106,75,.28);

  /* 7. MOTION */
  --aai-duration-fast:140ms; --aai-duration-normal:200ms; --aai-duration-slow:320ms;
  --aai-ease-standard:cubic-bezier(.2,.7,.3,1);
  --aai-ease-out:cubic-bezier(0,0,.2,1);

  /* 8. Z-INDEX */
  --aai-z-header:200; --aai-z-overlay:400;
  color-scheme:light;
}

/* Respect system dark preference — genuine surface inversion (semantic only) */
@media (prefers-color-scheme:dark){
  :root:not([data-aai-theme="light"]){
    --aai-surface-page:var(--aai-c-ink-900);
    --aai-surface-raised:var(--aai-c-ink-800);
    --aai-surface-sunken:var(--aai-c-ink-950);
    --aai-surface-inverse:var(--aai-c-ink-0);
    --aai-surface-brand:var(--aai-c-green-600);
    --aai-surface-brand-sub:rgba(42,133,96,.14);
    --aai-text-primary:var(--aai-c-ink-0);
    --aai-text-secondary:rgba(251,250,247,.76);
    --aai-text-tertiary:rgba(251,250,247,.58);
    --aai-text-inverse:var(--aai-c-ink-800);
    --aai-text-brand:var(--aai-c-green-300);
    --aai-border-subtle:rgba(255,255,255,.10);
    --aai-border-default:rgba(255,255,255,.16);
    --aai-action-primary:var(--aai-c-green-500);
    --aai-action-primary-hover:var(--aai-c-green-400);
    --aai-shadow-sm:0 2px 6px rgba(0,0,0,.34);
    --aai-shadow-md:0 8px 22px rgba(0,0,0,.40);
    --aai-shadow-focus:0 0 0 3px rgba(127,195,163,.34);
    color-scheme:dark;
  }
}
