/* AI Agent Assembly — shared doc brand layer for mdBook (hub + core).
   Install: copy to docs/theme/aaasm-brand.css and add to book.toml:
       [output.html]
       additional-css = ["theme/aaasm-brand.css"]
   Set themes:  default-theme = "light"   preferred-dark-theme = "navy"
   Tokens: design/doc-tokens.md */

/* ---- Typography (all themes) ---- */
html { font-size: 16px; }
@media (min-width: 60rem) { html { font-size: 17px; } }
.content {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
}
.content code, pre, code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.content main { max-width: 72ch; }            /* readability measure */
.content h1 { font-size: 2rem;    font-weight: 700; }
.content h2 { font-size: 1.5rem;  font-weight: 700; }
.content h3 { font-size: 1.25rem; font-weight: 600; }

/* ---- Light themes (light, rust) ---- */
.light, .rust {
  --bg: #f5f4f0;
  --fg: #111827;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #111827;
  --sidebar-active: #6366f1;
  --links: #4f46e5;
  --inline-code-color: #b8291e;
  --theme-popup-bg: #ffffff;
  --table-border-color: #e5e7eb;
  --searchbar-border-color: #e5e7eb;
  --searchbar-bg: #ffffff;
  --icons: #6b7280;
  --icons-hover: #6366f1;
}

/* ---- Dark themes (navy, coal) ---- */
.navy, .coal {
  --bg: #0e0e0e;
  --fg: #ededed;
  --sidebar-bg: #1a1a1a;
  --sidebar-fg: #ededed;
  --sidebar-active: #818cf8;
  --links: #818cf8;
  --inline-code-color: #f08a80;
  --theme-popup-bg: #1a1a1a;
  --table-border-color: #2e2e2e;
  --searchbar-border-color: #2e2e2e;
  --searchbar-bg: #1a1a1a;
  --icons: #a3a3a3;
  --icons-hover: #818cf8;
}

/* ---- Light/dark toggle (AAASM-2745) ----
   Sun is shown in dark mode (click → go light); moon in light mode
   (click → go dark). `.is-dark` is toggled by the wiring script. */
.aaasm-light-dark-toggle .aaasm-icon-sun { display: none; }
.aaasm-light-dark-toggle .aaasm-icon-moon { display: inline-flex; }
.aaasm-light-dark-toggle.is-dark .aaasm-icon-sun { display: inline-flex; }
.aaasm-light-dark-toggle.is-dark .aaasm-icon-moon { display: none; }
.aaasm-light-dark-toggle { color: var(--icons); }
.aaasm-light-dark-toggle:hover { color: var(--icons-hover); }

/* ---- Doc version selector (AAASM-2752, sized per AAASM-2841) ---- */
.aaasm-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
#aaasm-version-selector-label {
  display: inline-flex;
  align-items: center;
  margin: 0 0.6rem;
}
#aaasm-version-selector-label.hidden { display: none; }
.aaasm-version-selector {
  /* Closed-state trigger: rem values bumped from the initial 1.0 / 0.5 / 0.75
     sizes so the trigger text is comfortably readable next to mdBook's native
     toolbar icons. Trigger font 1.32rem (= 13.2px against mdBook's 1rem=10px),
     option text 1.2375rem, padding scaled proportionally. min-height 40px
     stays in px so the hit-target is preserved regardless of body typography.
     Meets WCAG 2.5.5 (target ≥ 24px) and Apple HIG (≥ 40px). */
  font: inherit;
  font-size: 1.32rem;
  line-height: 1.4;
  color: var(--icons);
  background: var(--theme-popup-bg, var(--bg));
  border: 1px solid var(--table-border-color, var(--icons));
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  min-width: 220px;
  min-height: 40px;
  cursor: pointer;
}
.aaasm-version-selector:hover { color: var(--icons-hover); }
.aaasm-version-selector:focus-visible {
  outline: 2px solid var(--sidebar-active, var(--links));
  outline-offset: 2px;
}
/* Native option list: most engines (Chromium, Gecko) honour font-size on
   <optgroup>/<option>; Safari is the most restrictive but accepts these
   declarations harmlessly. All rem values are scaled with the trigger to
   match its visual weight. */
.aaasm-version-selector optgroup {
  font-style: normal;
  font-weight: 600;
  font-size: 1.32rem;
  margin: 0.6rem 0 0.3rem;
  padding: 0.3rem 0.6rem;
}
.aaasm-version-selector option {
  font-size: 1.2375rem;
  padding: 0.6rem 0.9rem;
  min-height: 40px;
  line-height: 1.5;
}

/* Mobile viewport: keep the trigger from overflowing the menu bar on narrow
   screens. The native option popup is positioned by the user agent and will
   anchor to the trigger; shrinking the trigger keeps it on-screen. */
@media (max-width: 480px) {
  .aaasm-version-selector {
    min-width: 0;
    width: 100%;
    max-width: calc(100vw - 2rem);
    font-size: 1.2375rem;
    padding: 0.48rem 0.72rem;
  }
  #aaasm-version-selector-label { margin: 0 0.3rem; }
}

/* ---- Version-warning banner (AAASM-2752) ---- */
.aaasm-version-banner {
  margin: 0 0 1.25rem 0;
  padding: 0.7rem 1rem;
  border: 1px solid #f0c000;
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff7e0;
  color: #5a4500;
  /* Match mdBook body typography (general.css: body { font-size: 1.6rem }). */
  font-size: 1.6rem;
  line-height: 1.5;
}
.aaasm-version-banner.hidden { display: none; }
.aaasm-version-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
.aaasm-version-banner a:hover { text-decoration: none; }
.navy .aaasm-version-banner,
.coal .aaasm-version-banner {
  border-color: #b8901f;
  background: #2a2310;
  color: #f1d98a;
}
