/*
 * bra0 site — unified design tokens
 * Source of truth: blueprint.html palette (Tailwind gray + semantic accents)
 * Loaded by all site pages: home.html, knowledge-space.html, blueprint.html
 */

/* ---- Fonts (shared Google Fonts link expected in each page <head>) ---- */
:root {
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

/* ================================================================
   DARK THEME (default)
   ================================================================ */
:root {
  /* Surfaces */
  --bg: #202020;
  --surface: #2a2a2a;
  --surface2: #353535;
  --surface3: #444444;

  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-bright: rgba(255,255,255,0.15);

  /* Text */
  --text: #eeeeee;
  --text-dim: #8e8e8e;
  --text-muted: #6a6a6a;

  /* ---- Accent colors — SimplClan PDF exact values ---- */
  /* why (orange) */
  --orange: #fb6818;  --orange-dim: rgba(251,104,24,0.12);
  --orange-light: #fcb691;
  --orange-deep: #e74e03;
  --orange-darkest: #b83f09;
  /* map (green/mint) */
  --green: #43ca9b;   --green-dim: rgba(67,202,155,0.12);
  --green-light: #59f8c1;
  --green-dark: #1ea773;
  --green-darkest: #038350;
  /* rythm (pink) */
  --pink: #df4678;    --pink-dim: rgba(223,70,120,0.12);
  --pink-light: #f1abbf;
  --pink-lightest: #f7cedaff;
  --pink-dark: #8D1953;
  /* known (yellow) */
  --yellow: #ffe808;  --yellow-dim: rgba(255,232,8,0.12);
  --yellow-light: #f3ff7b;
  --yellow-dark: #c67601;
  --yellow-darkest: #8a2d00;
  /* neutrals */
  --neutral-light: #8e8e8e;
  --neutral-mid: #6a6a6a;
  --neutral-dark: #404145;
  /* bra0 logo blue */
  --bra0-blue: #0046b2;  --bra0-blue-dim: rgba(0,70,178,0.15);
  --bra0-blue-light: #4d94ff;
  /* structural aliases */
  --purple: #a78bfa;  --purple-dim: rgba(167,139,250,0.12);
  --blue: #0046b2;    --blue-dim: rgba(0,70,178,0.12);
  --indigo: #818cf8;  --indigo-dim: rgba(129,140,248,0.10);
  /* Aliases for legacy var() references */
  --teal: #43ca9b;    --teal-dim: rgba(67,202,155,0.12);
  --cyan: #fb6818;    --cyan-dim: rgba(251,104,24,0.12);
  --amber: #ffe808;   --amber-dim: rgba(255,232,8,0.12);
  --red: #df4678;     --red-dim: rgba(223,70,120,0.12);

  /* ---- Blueprint capability families ---- */
  --cp: #1ea773;    --cp-dim: rgba(30,167,115,0.12);    /* Control Plane — map-dark */
  --sl: #43ca9b;    --sl-dim: rgba(67,202,155,0.12);    /* Semantic Layer — map */
  --dp: #60a5fa;    --dp-dim: rgba(96,165,250,0.12);    /* Data Plane */
  --ns: #ffe808;    --ns-dim: rgba(255,232,8,0.12);     /* Neurosymbolic — known */
  --tp: #df4678;    --tp-dim: rgba(223,70,120,0.12);    /* Topo Perception — rythm */

  /* ---- Status badges ---- */
  --ok: #43ca9b;
  --warn: #ffe808;
  --gap: #df4678;
  --plan: #60a5fa;
}

/* ================================================================
   LIGHT THEME — via data-theme attribute (set by site-nav.js)
   ================================================================ */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f9fafb;
  --surface2: #f3f4f6;
  --surface3: #e5e7eb;

  --border: rgba(0,0,0,0.08);
  --border-bright: rgba(0,0,0,0.15);

  --text: #303134;         /* SimplClan neutral-dark */
  --text-dim: #6a6a6a;     /* SimplClan neutral */
  --text-muted: #8e8e8e;   /* SimplClan neutral-light */

  --blue: #2563eb;    --blue-dim: rgba(37,99,235,0.08);
  --purple: #7c3aed;  --purple-dim: rgba(124,58,237,0.08);
  --green: #038350;   --green-dim: rgba(3,131,80,0.08);       /* map-darkest */
  --teal: #1ea773;    --teal-dim: rgba(30,167,115,0.08);      /* map-dark */
  /* SimplClan light-mode overrides — darker shades for white bg readability */
  --orange: #e74e03;  --orange-dim: rgba(231,78,3,0.08);       /* why-dark */
  --orange-deep: #b83f09;
  --orange-light: #fb6818;
  --yellow: #c67601;  --yellow-dim: rgba(198,118,1,0.08);      /* known-dark */
  --yellow-light: #ffe808;
  --yellow-dark: #8a2d00;
  --pink: #8D1953;    --pink-dim: rgba(141,25,83,0.06);        /* rythm-dark */
  --pink-light: #df4678;
  --bra0-blue: #0046b2;  --bra0-blue-dim: rgba(0,70,178,0.08);
  --bra0-blue-light: #0046b2;
  /* Legacy aliases */
  --amber: #c67601;   --amber-dim: rgba(198,118,1,0.08);
  --cyan: #e74e03;    --cyan-dim: rgba(231,78,3,0.08);
  --red: #8D1953;     --red-dim: rgba(141,25,83,0.06);

  --cp: #1ea773;    --cp-dim: rgba(30,167,115,0.08);
  --sl: #038350;    --sl-dim: rgba(3,131,80,0.08);
  --dp: #2563eb;    --dp-dim: rgba(37,99,235,0.08);
  --ns: #c67601;    --ns-dim: rgba(198,118,1,0.08);
  --tp: #8D1953;    --tp-dim: rgba(141,25,83,0.08);

  --ok: #16a34a;
  --warn: #d97706;
  --gap: #dc2626;
  --plan: #2563eb;
}

/* ---- System preference fallback (for users without JS / first paint) ---- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --surface: #f9fafb;
    --surface2: #f3f4f6;
    --surface3: #e5e7eb;

    --border: rgba(0,0,0,0.08);
    --border-bright: rgba(0,0,0,0.15);

    --text: #303134;
    --text-dim: #6a6a6a;
    --text-muted: #8e8e8e;

    --blue: #2563eb;    --blue-dim: rgba(37,99,235,0.08);
    --purple: #7c3aed;  --purple-dim: rgba(124,58,237,0.08);
    --green: #038350;   --green-dim: rgba(3,131,80,0.08);
    --teal: #1ea773;    --teal-dim: rgba(30,167,115,0.08);
    --orange: #e74e03;  --orange-dim: rgba(231,78,3,0.08);
    --orange-deep: #b83f09;
    --yellow: #c67601;  --yellow-dim: rgba(198,118,1,0.08);
    --yellow-dark: #8a2d00;
    --pink: #8D1953;    --pink-dim: rgba(141,25,83,0.06);
    --bra0-blue: #0046b2;  --bra0-blue-dim: rgba(0,70,178,0.08);
    --bra0-blue-light: #0046b2;
    --amber: #c67601;   --amber-dim: rgba(198,118,1,0.08);
    --cyan: #e74e03;    --cyan-dim: rgba(231,78,3,0.08);
    --red: #8D1953;     --red-dim: rgba(141,25,83,0.06);

    --cp: #1ea773;    --cp-dim: rgba(30,167,115,0.08);
    --sl: #038350;    --sl-dim: rgba(3,131,80,0.08);
    --dp: #2563eb;    --dp-dim: rgba(37,99,235,0.08);
    --ns: #c67601;    --ns-dim: rgba(198,118,1,0.08);
    --tp: #8D1953;    --tp-dim: rgba(141,25,83,0.08);

    --ok: #16a34a;
    --warn: #d97706;
    --gap: #dc2626;
    --plan: #2563eb;
  }
}

/* ================================================================
   SHARED RESET & BASE
   ================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* Subtle dot grid background (shared atmosphere) */
body {
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--orange); }
a:hover { color: var(--text); }

/* ---- Animations ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeScale { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
}

/* ================================================================
   MOBILE NAV — burger toggle + dropdown
   Shared across all pages. Specificity > inline .head-nav rule.
   ================================================================ */
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
}
@media (min-width: 900px) {
  .nav-toggle { display: none; }
}

@media (max-width: 899px) {
  .site-head[data-nav-open="true"] .head-nav {
    display: flex !important;
    flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0;
    padding: 18px 24px 22px; gap: 14px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px -16px rgba(0,0,0,0.45);
  }
  .site-head[data-nav-open="true"] .head-nav a {
    font-size: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .site-head[data-nav-open="true"] .head-nav a:last-child {
    border-bottom: none;
  }
}

/* ================================================================
   SECONDARY NAV — "More" dropdown (desktop) / flattened (mobile)
   The menu opens rightward from its button's left edge: the buttons sit on the left of the header, and a
   menu anchored on the right ran off the left edge of the screen (measured 2026-09-29: -42 to -87 px at
   900–1280 px wide).
   Shared across all pages. Holds the secondary section cluster so
   the primary bar stays short. Behaviour wired in site-nav.js.
   ================================================================ */
.head-nav-more { position: relative; display: inline-flex; align-items: center; }
.head-nav-more-btn {
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--text-dim); background: none; border: none; cursor: pointer;
  padding: 0 0 2px; letter-spacing: -0.005em;
  display: inline-flex; align-items: center; gap: 4px;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}
.head-nav-more-btn:hover { color: var(--text); border-bottom-color: var(--orange); }
.head-nav-more[data-more-active="true"] .head-nav-more-btn {
  color: var(--text); font-weight: 600; border-bottom-color: var(--orange);
}
.head-nav-more .more-caret { font-size: 10px; transition: transform 150ms ease; }
.head-nav-more[data-more-open="true"] .more-caret { transform: rotate(180deg); }
.head-nav-more-menu {
  display: none; position: absolute; top: calc(100% + 10px); left: 0; right: auto;
  min-width: 232px; max-width: calc(100vw - 32px); flex-direction: column; gap: 2px; padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px -16px rgba(0,0,0,0.55); z-index: 60;
}
.head-nav-more[data-more-open="true"] .head-nav-more-menu { display: flex; }
.head-nav-more-menu a {
  font-size: 14px; padding: 7px 10px; border-radius: 6px;
  border-bottom: none !important; color: var(--text-dim); white-space: nowrap;
}
.head-nav-more-menu a:hover { color: var(--text); background: var(--orange-dim); }
.head-nav-more-menu a[aria-current="page"] { color: var(--text); font-weight: 600; }
.head-nav-more-group {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim); opacity: 0.72; padding: 8px 10px 3px; white-space: nowrap;
}
.head-nav-more-group:first-child { padding-top: 2px; }
/* a part is a link to its page since 2026-11-04 (the author's openings) : the group's look, the link's hover */
.head-nav-more-menu a.head-nav-more-group {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim); opacity: 0.72; padding: 8px 10px 3px; border-radius: 6px;
}
.head-nav-more-menu a.head-nav-more-group:hover { opacity: 1; color: var(--text); background: var(--orange-dim); }
.head-nav-more-menu a.head-nav-more-group[aria-current="page"] { opacity: 1; color: var(--text); }
/* second level of group : the three categories of chapter 8's patterns (2026-11-02), indented under the chapter */
.head-nav-more-group.head-nav-more-subgroup { padding-left: 22px; opacity: 0.6; letter-spacing: 0.06em; }   /* two classes : holds on the mobile column too */
.head-nav-more-menu a.head-nav-more-sub { padding-left: 22px; }
.head-nav-more-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Mobile: flatten the More group into the burger column */
@media (max-width: 899px) {
  .head-nav-more { display: contents; }
  .head-nav-more-btn { display: none; }
  .head-nav-more-menu {
    display: flex !important; position: static; min-width: 0;
    flex-direction: column; gap: 14px; padding: 0;
    background: none; border: none; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .head-nav-more-menu a {
    font-size: 16px; padding: 8px 0; border-radius: 0;
    border-bottom: 1px solid var(--border) !important;
  }
  .head-nav-more-group { padding: 10px 0 2px; }
  .head-nav-more-sep { display: none; }
}

/* The Fondation's « Dons » button stays in the header on small screens (Sacha, 2026-10-27: a « Dons » button). The
   pages hide .head-cta below 560–600 px; this selector is more specific, so the donation button alone stays, compact. */
@media (max-width: 600px) {
  .site-head .head-cta.primary[href*="dons.fondationdefrance.org"] { display: inline-flex; padding: 6px 10px; }
}

/* The investigation's sub-site: its name after the « Fondation FAM » wordmark (Sacha, 2026-10-27). */
.subsite-mark {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--orange); text-decoration: none; white-space: nowrap;
  padding-left: 10px; margin-left: -12px; border-left: 1px solid var(--border-bright);
}
.subsite-mark:hover { color: var(--text); }
.subsite-mark[aria-current="page"] { color: var(--text); }
@media (max-width: 600px) { .subsite-mark { font-size: 11px; padding-left: 8px; margin-left: -6px; } }

/* The Fondation's home: an event strip for « Numérique, 5ème cycle », one dark band (after Ink & Switch's banner). */
.event-strip {
  display: block; height: 38px; line-height: 38px; text-align: center; text-decoration: none;
  background: var(--text); color: var(--bg); font-size: 14px; letter-spacing: 0.01em;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 16px;
}
.event-strip strong { font-weight: 600; }
.event-strip .go { border-bottom: 1px solid currentColor; margin-left: 6px; }
.event-strip:hover .go { color: var(--orange); border-bottom-color: var(--orange); }
/* the global a:hover sets the text colour to --text, which is this band's background: keep the band's own colour */
.event-strip:hover { color: var(--bg); }
