/* ============================================================
   ANTHROPOS ORG — CANONICAL DESIGN TOKENS  v2  (2026-05-23)
   Single source of truth for the whole anthroposorg.org estate.
   Themes: legal (default) | events | maximal | veil
   Switch by setting <body data-theme="..."> or <html data-theme="...">.
   Per-section MAXIMAL accent rotation: <section data-section-hue="2..5">.
   Honours prefers-reduced-motion, prefers-contrast and print.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Audiowide&family=Yatra+One&family=JetBrains+Mono:wght@400;600&display=swap');

/* --- DEFAULT (LEGAL) -------------------------------------- */
:root,
[data-theme="legal"] {
  /* colour */
  --bg:            #f6f1e8;
  --surface:       #ffffff;
  --surface-2:     #fbf7f0;
  --ink:           #2c211a;
  --ink-on-accent: #1a0a05;
  --muted:         #8a7a68;
  --border:        #e7dccc;
  --accent:        #f7941d;
  --accent-deep:   #c44b00;
  --accent-soft:   #fff2dd;
  --accent-tint:   rgba(247,148,29,.12);
  --amber:         #b9770e;
  --gold:          #ffd700;
  --green:         #2e7d32;
  --red:           #c0392b;
  --info:          #2e6fa5;
  --warn:          #d97706;
  --danger:        #c0392b;
  --success:       #2e7d32;
  --navbg:         #1a0a05;
  --navink:        #fff5e6;
  --focus-ring:    0 0 0 3px rgba(247,148,29,.55);
  /* spacing scale */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
  --space-4: 1rem;   --space-5: 1.5rem; --space-6: 2rem;
  --space-7: 3rem;   --space-8: 4rem;
  --gutter: 1.25rem;
  --container-max: 1180px;
  /* radius */
  --radius-sm: 6px;  --radius: 10px;  --radius-lg: 16px;
  /* shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  /* typography */
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  /* motion */
  --motion-fast: 120ms;
  --motion-base: 220ms;
  --motion-slow: 420ms;
  --ease:        cubic-bezier(.2,.7,.2,1);
  /* z-index */
  --z-base: 1; --z-nav: 100; --z-overlay: 500; --z-modal: 1000; --z-toast: 2000;
  /* maximal hue palette (rotated per-section) */
  --maximal-hue-1: 31;
  --maximal-hue-2: 8;
  --maximal-hue-3: 330;
  --maximal-hue-4: 260;
  --maximal-hue-5: 180;
}

/* --- EVENTS (warm dark forest) ---------------------------- */
[data-theme="events"] {
  --bg:           #0e0014;
  --surface:      #1c0810;
  --surface-2:    #1a0a05;
  --ink:          #fff5e6;
  --ink-on-accent:#1a0a05;
  --muted:        #b89880;
  --border:       rgba(255,212,122,.18);
  --accent:       #f7941d;
  --accent-deep:  #c44b00;
  --accent-soft:  rgba(247,148,29,.18);
  --accent-tint:  rgba(247,148,29,.12);
  --amber:        #ffd47a;
  --gold:         #ffd47a;
  --navbg:        #050008;
  --navink:       #fff5e6;
  --focus-ring:   0 0 0 3px rgba(255,212,122,.65);
  --shadow-md:    0 8px 32px rgba(0,0,0,.55), 0 2px 8px rgba(247,148,29,.08);
  --shadow-lg:    0 16px 48px rgba(0,0,0,.7),  0 4px 12px rgba(247,148,29,.12);
  --radius-sm: 4px; --radius: 8px; --radius-lg: 12px;
  --font-display: 'Yatra One', 'Aladin', 'Audiowide', serif;
  /* Events legacy aliases (from current events-index.html) */
  --ant-bg-1:   var(--surface);
  --ant-bg-2:   var(--bg);
  --ant-c1:     #ffd47a;
  --ant-c2:     #f7941d;
  --ant-c3:     #f46b0f;
  --ant-c4:     #c44b00;
  --ant-c-glow: #ff7b00;
  --ant-ink:    var(--ink);
  --orange-1:   #ffd47a;
  --orange-2:   #f7941d;
  --orange-3:   #f46b0f;
  --orange-4:   #c44b00;
  --orange-glow:#ff7b00;
  --panel:      var(--surface);
  --bg-deep:    var(--bg);
  --bg-pitch:   #050008;
  --bg-warm:    #1a0a05;
}

/* --- MAXIMAL (light, anchored Legal, pulled to Events) ---- */
[data-theme="maximal"] {
  --bg:           #faf5ec;
  --surface:      #ffffff;
  --surface-2:    #fff8ea;
  --ink:          #2a1a10;
  --ink-on-accent:#ffffff;
  --muted:        #8a7560;
  --border:       #ead9bc;
  --accent:       hsl(31, 90%, 50%);
  --accent-deep:  hsl(31, 90%, 38%);
  --accent-soft:  hsl(31, 90%, 92%);
  --accent-tint:  hsla(31, 90%, 50%, .12);
  --navbg:        #1a0a05;
  --navink:       #fff5e6;
  --focus-ring:   0 0 0 3px hsla(31, 90%, 50%, .55);
  --font-display: 'Audiowide', 'Inter', system-ui, sans-serif;
  --grad-rainbow: linear-gradient(90deg,
    hsl(31, 85%, 55%),
    hsl(8,  78%, 60%),
    hsl(330,50%, 62%),
    hsl(260,50%, 64%),
    hsl(180,45%, 48%));
}
[data-theme="maximal"] [data-section-hue="2"]{
  --accent: hsl(8, 78%, 58%); --accent-deep: hsl(8, 78%, 42%);
  --accent-soft: hsl(8, 78%, 94%); --accent-tint: hsla(8, 78%, 58%, .12);
  --focus-ring: 0 0 0 3px hsla(8, 78%, 58%, .55);
}
[data-theme="maximal"] [data-section-hue="3"]{
  --accent: hsl(330,50%, 60%); --accent-deep: hsl(330,50%, 42%);
  --accent-soft: hsl(330,50%, 94%); --accent-tint: hsla(330,50%, 60%, .12);
  --focus-ring: 0 0 0 3px hsla(330,50%, 60%, .55);
}
[data-theme="maximal"] [data-section-hue="4"]{
  --accent: hsl(260,50%, 62%); --accent-deep: hsl(260,50%, 44%);
  --accent-soft: hsl(260,50%, 94%); --accent-tint: hsla(260,50%, 62%, .12);
  --focus-ring: 0 0 0 3px hsla(260,50%, 62%, .55);
}
[data-theme="maximal"] [data-section-hue="5"]{
  --accent: hsl(180,45%, 45%); --accent-deep: hsl(180,45%, 30%);
  --accent-soft: hsl(180,45%, 94%); --accent-tint: hsla(180,45%, 45%, .12);
  --focus-ring: 0 0 0 3px hsla(180,45%, 45%, .55);
}

/* --- VEIL (own theme, isolated) --------------------------- */
[data-theme="veil"] {
  --bg:           #04001e;
  --surface:      #10082e;
  --surface-2:    #0a0030;
  --ink:          #e8e0ff;
  --ink-on-accent:#04001e;
  --muted:        #a898e8;
  --border:       #2a1a70;
  --accent:       #7a4dff;
  --accent-deep:  #4a3dff;
  --accent-soft:  rgba(122,77,255,.18);
  --accent-tint:  rgba(122,77,255,.12);
  --gold:         #b8a0ff;
  --magenta:      #ff4dd8;
  --cyan:         #4de8ff;
  --teal:         #3df0c8;
  --rose:         #ff5a8c;
  --amber:        #ffaa3d;
  --navbg:        #04001e;
  --navink:       #e8e0ff;
  --focus-ring:   0 0 0 3px rgba(122,77,255,.65);
  --font-display: 'Audiowide', system-ui, sans-serif;
}

/* --- BASE LAYER (theme-agnostic) -------------------------- */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
}
a  { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--motion-fast) var(--ease); }
a:hover  { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); color: var(--ink); margin: 0 0 var(--space-3); }
p  { margin: 0 0 var(--space-4); }
hr { border:0; border-top:1px solid var(--border); margin: var(--space-5) 0; }

/* a11y modifiers (carried from legal-portal.css) */
body.font-dyslexic { font-family: 'OpenDyslexic','Comic Sans MS','Trebuchet MS', sans-serif; }
body.font-mono     { font-family: var(--font-mono); }
body.hc {
  --ink:#000; --bg:#fff; --border:#000; --muted:#222;
  --accent:#0040c0; --accent-deep:#002080; --accent-soft:#e6edff;
  --focus-ring: 0 0 0 3px #000;
}
body.hc a { text-decoration: underline; }
body.hc .accent-rainbow { background-image: none !important; background-color: var(--accent) !important; }

/* maximal accent gradient utility */
[data-theme="maximal"] .accent-rainbow { background-image: var(--grad-rainbow); }

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

/* high contrast */
@media (prefers-contrast: more) {
  :root { --border:#000; --muted:#333; }
}

/* print */
@media print {
  body, [data-theme] {
    --bg:#fff !important; --surface:#fff !important; --surface-2:#fff !important;
    --ink:#000 !important; --muted:#333 !important; --border:#999 !important;
    --navbg:#fff !important; --navink:#000 !important;
  }
  nav, header, footer, .no-print { display: none !important; }
  a { color:#000 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color:#555; }
}

/* ============================================================
   v3 PATCH  2026-05-23
   (a) Canonical attribute aliasing: [data-ef-theme] mirrors [data-theme]
   (b) Bootstrap legibility floor  final guard so no consumer page
       can fall below Bootstrap 5.3 baseline for body text.
   ============================================================ */

/* (a) Mirror selectors so estate-canonical data-ef-theme works */
[data-ef-theme="legal"]    { color-scheme: light; }
[data-ef-theme="events"]   { color-scheme: light; }
[data-ef-theme="maximal"]  { color-scheme: light; }
[data-ef-theme="veil"]     { color-scheme: dark; }

[data-ef-theme="legal"]   body, body[data-ef-theme="legal"]   { --bg:#fff8e1; --ink:#3a2a00; --accent:#b8860b; --accent-deep:#7a5a00; }
[data-ef-theme="events"]  body, body[data-ef-theme="events"]  { --bg:#fdfaf5; --ink:#2a2a2a; --accent:#c0392b; --accent-deep:#7a2018; }
[data-ef-theme="maximal"] body, body[data-ef-theme="maximal"] { --bg:#fffbf0; --ink:#1a1a1a; --accent:#c47f00; --accent-deep:#7a5a00; }
[data-ef-theme="veil"]    body, body[data-ef-theme="veil"]    { --bg:#04001c; --ink:#e8e0ff; --accent:#7a4dff; --accent-deep:#4a3dff; }

/* (b) Legibility floor  Bootstrap 5.3 baseline as hard minimum.
   Re-asserted near end of file so any consumer-set values that go BELOW
   Bootstrap defaults get clamped back up. We use min()/max() where helpful
   and explicit values where Bootstrap is non-negotiable. */
html { -webkit-text-size-adjust: 100%; }
body {
  font-size: max(1rem, 16px);              /* Bootstrap default 1rem = 16px floor */
  line-height: 1.5;                        /* Bootstrap default  our 1.6 stays since CSS resolves higher first-set */
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
p, li, dd, dt, td, th, label, input, textarea, select, button {
  font-size: max(1rem, 16px);              /* never shrink interactive/body text below 16px */
}
small, .small { font-size: max(.875em, 14px); }   /* Bootstrap small floor */
h1 { font-size: clamp(2rem,  4vw + 1rem, 2.5rem); }   /* Bootstrap h1 ~2.5rem max, 2rem min */
h2 { font-size: clamp(1.75rem, 3vw + .9rem, 2rem); }
h3 { font-size: clamp(1.5rem,  2vw + .9rem, 1.75rem); }
h4 { font-size: max(1.25rem, 1.25rem); }
h5 { font-size: max(1.125rem, 1.125rem); }
h6 { font-size: max(1rem,     1rem); }

/* Link contrast floor: derived accent-deep is darker, used where accent fails on light */
a { color: var(--accent-deep, #0d6efd); }      /* fallback = Bootstrap link blue */
a:hover, a:focus { color: var(--accent, #0a58ca); text-decoration: underline; }

/* Focus ring must always be visible */
:focus-visible {
  outline: 2px solid var(--accent, #0d6efd);
  outline-offset: 2px;
}

/* Buttons  ensure tap target floor 44x44 per WCAG 2.5.5 */
.btn, button, [role="button"] {
  min-height: 44px;
  min-width: 44px;
  padding-inline: max(.75rem, 12px);
}

/* Forced-colors mode  surrender all tokens to system */
@media (forced-colors: active) {
  :root, [data-theme], [data-ef-theme] {
    --bg: Canvas; --ink: CanvasText; --accent: LinkText; --accent-deep: LinkText;
  }
  a { color: LinkText; }
  :focus-visible { outline: 2px solid Highlight; }
}

/* End v3 patch */
