/* dotHuman — app styles.
   Brand tokens live in :root; everything else references them.
   Shared by the homepage (body.home) and all rendered pages. External + cached —
   edit here, not inline. Bump the ?v= query in the <link> tags when this changes. */

/* ===================== Design tokens (brand) — dark default + light theme ===================== */
/* All colour flows through these, so theming is a token swap (no markup changes).
   Dark is the default. Light applies when the OS asks (prefers-color-scheme) UNLESS the visitor
   explicitly chose dark, OR when [data-theme="light"] is set. data-theme is written before first
   paint by the inline <head> script (no flash). See .human/Goals/2026-06-11_adaResearch/. */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0d1f2d;
  --bg-glow: #15273a;
  --surface-2: #1c2f43;
  --surface-2-hover: #243a52;
  /* text */
  --ink: #f0f0ec;
  --ink-soft: #b5b8b5;
  --muted: #a8aba7;
  /* accent */
  --accent: #4f9cf9; /* bright brand teal — the dark-theme accent */
  --accent-hover: #3b82f6;
  --toggle-off: #44566b; /* "off" switch track (cookie modal) — token-driven so it flips in light */
  /* lines / effects */
  --rule: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --inset-bg: rgba(255, 255, 255, 0.04);
  --hover-bg: rgba(255, 255, 255, 0.06);
  --overlay: rgba(6, 16, 26, 0.6);
  --shadow: rgba(0, 0, 0, 0.5);
  --text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  --home-bg: linear-gradient(160deg, #1c3a52 0%, #0d1f2d 45%, #0e2a35 100%);
  --logo-img: url("/emblem-white.png"); /* theme-swapped in-page logo (follows OS pref + the toggle) */
  /* type / layout */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 760px;
  --radius: 6px;
}

/* Light palette. INTENTIONALLY duplicated under two selectors below — the @media auto path AND the
   explicit [data-theme="light"] toggle. Pure CSS can't share one token block across a media-query
   boundary, and resolving "auto" in JS instead would regress no-JS graceful degradation. So: keep the
   two blocks in sync (see weeklyReview F9). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f8fa;
    --bg-glow: #ffffff;
    --surface-2: #eef2f6;
    --surface-2-hover: #e2e9f0;
    --ink: #0d1f2d;
    --ink-soft: #33485c;
    --muted: #586a78;
    --accent: #1d4ed8; /* darkened teal — the bright teal fails AA on a light background */
    --accent-hover: #1e40af;
    --toggle-off: #c8d2db;
    --rule: rgba(13, 31, 45, 0.12);
    --glass-bg: rgba(13, 31, 45, 0.035);
    --inset-bg: rgba(13, 31, 45, 0.04);
    --hover-bg: rgba(13, 31, 45, 0.05);
    --overlay: rgba(13, 31, 45, 0.4);
    --shadow: rgba(13, 31, 45, 0.18);
    --text-shadow: none;
    --home-bg: linear-gradient(160deg, #e8f1f3 0%, #f6f8fa 45%, #edf4f2 100%);
    --logo-img: url("/emblem-dark.png");
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-glow: #ffffff;
  --surface-2: #eef2f6;
  --surface-2-hover: #e2e9f0;
  --ink: #0d1f2d;
  --ink-soft: #33485c;
  --muted: #586a78;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --toggle-off: #c8d2db;
  --rule: rgba(13, 31, 45, 0.12);
  --glass-bg: rgba(13, 31, 45, 0.035);
  --inset-bg: rgba(13, 31, 45, 0.04);
  --hover-bg: rgba(13, 31, 45, 0.05);
  --overlay: rgba(13, 31, 45, 0.4);
  --shadow: rgba(13, 31, 45, 0.18);
  --text-shadow: none;
  --home-bg: linear-gradient(160deg, #e8f1f3 0%, #f6f8fa 45%, #edf4f2 100%);
  --logo-img: url("/emblem-dark.png");
}

/* ===================== Reset / base ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== Accessibility ===================== */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: var(--bg); padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ===================== Site header (branding on subpages) ===================== */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg-glow); }
.site-header .brand { display: flex; align-items: center; gap: .55rem; max-width: var(--wrap); margin: 0 auto; padding: .85rem 1.25rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; text-decoration: none; }
.site-header .brand:hover { text-decoration: none; }
.site-header .brand .brand-logo { width: 30px; height: 30px; display: block; background: var(--logo-img) center / contain no-repeat; }
.site-header .brand .hl { color: var(--accent); }

/* ===================== Content pages (legal, sitemap) ===================== */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 2.5rem 1.25rem 2rem; }
.legal h1 { font-size: 2rem; margin: 0 0 .25rem; }
.legal .updated { color: var(--muted); font-size: .9rem; margin: 0 0 2rem; }
.legal h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; color: var(--ink); }
.legal p, .legal li { color: var(--ink-soft); }
.legal p a, .legal li a { text-decoration: underline; }  /* in-text links must not rely on color alone */
.legal .review { background: var(--bg-glow); border-left: 3px solid var(--accent); padding: .75rem 1rem; border-radius: var(--radius); font-size: .9rem; margin: 0 0 2rem; }
.home-link { display: inline-block; margin-top: 1.5rem; color: var(--accent); }

/* Cookie policy table (rendered from the cookies registry) */
.cookie-table { margin: .5rem 0 1.75rem; }
.cookie-row { background: var(--bg-glow); border: 1px solid var(--rule); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .6rem; }
.cookie-row .ck-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--ink); font-size: .95rem; margin: 0 0 .35rem; }
.cookie-row .ck-meta { color: var(--ink-soft); font-size: .9rem; line-height: 1.5; margin: .1rem 0; }
.cookie-row .ck-label { display: inline-block; min-width: 5.5rem; color: var(--muted); }

/* CookieConsent v3 — brand theme (tracks the :root tokens, so it adapts to light/dark) */
#cc-main {
  --cc-font-family: var(--font-sans);
  --cc-bg: var(--bg-glow);
  --cc-primary-color: var(--ink);
  --cc-secondary-color: var(--ink-soft);
  --cc-link-color: var(--accent);
  --cc-btn-primary-bg: var(--accent);
  --cc-btn-primary-color: var(--bg);
  --cc-btn-primary-border-color: var(--accent);
  --cc-btn-primary-hover-bg: var(--accent-hover);
  --cc-btn-primary-hover-border-color: var(--accent-hover);
  --cc-btn-primary-hover-color: var(--bg);
  --cc-btn-secondary-bg: var(--surface-2);
  --cc-btn-secondary-color: var(--ink);
  --cc-btn-secondary-border-color: var(--rule);
  --cc-btn-secondary-hover-bg: var(--surface-2-hover);
  --cc-btn-secondary-hover-border-color: var(--ink-soft);
  --cc-toggle-on-bg: var(--accent);
  --cc-toggle-off-bg: var(--toggle-off);
  --cc-cookie-category-block-bg: var(--bg);
  --cc-cookie-category-block-border: var(--rule);
  --cc-cookie-category-block-hover-bg: var(--surface-2);
  --cc-separator-border-color: var(--rule);
  --cc-modal-border-radius: 12px;
  --cc-btn-border-radius: 999px;
  --cc-overlay-bg: var(--overlay);
}

/* Persistent "manage cookies" controls */
.cc-float { position: fixed; left: .85rem; bottom: .85rem; z-index: 40; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-glow); color: var(--accent); border: 1px solid var(--rule); cursor: pointer; box-shadow: 0 4px 16px var(--shadow); transition: color .2s, background .2s, border-color .2s; }
.cc-float:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.cc-float[hidden] { display: none; }
.btn-manage { display: inline-block; margin: .25rem 0; padding: .5rem 1.1rem; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-size: .9rem; cursor: pointer; }
.btn-manage:hover { background: var(--accent); color: var(--bg); }

/* CookieConsent reuses --cc-btn-border-radius (our pill value) for category blocks too;
   its CSS is injected after app.css, so override with !important → clean 10px rects
   (keeps the pill buttons + the library's expanded-state squared corners). */
#cc-main .pm__section,
#cc-main .pm__section--toggle,
#cc-main .pm__section-title { border-radius: 10px !important; }
#cc-main .pm__section--toggle .pm__section-desc-wrapper { border-radius: 0 0 10px 10px !important; }
#cc-main .pm__section--toggle.is-expanded .pm__section-title { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }

/* ===================== Site footer (content pages) ===================== */
.site-footer { border-top: 1px solid var(--rule); background: var(--bg-glow); margin-top: 3rem; }
.ft-cols { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
.ft-col h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin: 0 0 .75rem; }
.ft-col a { display: block; color: var(--ink-soft); padding: .4rem 0; }
.ft-col a:hover { color: var(--accent); }
.ft-col p { color: var(--ink-soft); margin: .15rem 0; }
.ft-muted { color: var(--muted); font-size: .85rem; }
.ft-social a { display: inline-block; margin-right: .75rem; }
.ft-bar { border-top: 1px solid var(--rule); max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.ft-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.ft-link:hover { text-decoration: underline; }

/* ===================== Homepage (coming-soon) — body.home ===================== */
body.home {
  background-image: var(--home-bg);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4rem 1.5rem;
}
.home main { max-width: 640px; width: 100%; }
.home .home-logo { width: 164px; height: 164px; display: block; margin: 0 auto 2rem; background: var(--logo-img) center / contain no-repeat; filter: drop-shadow(0 8px 26px var(--shadow)); }
.home .tagline { font-size: clamp(2.25rem, 7vw, 4.25rem); line-height: 1.15; font-weight: 700; letter-spacing: -.025em; margin-bottom: 2rem; text-align: center; text-shadow: var(--text-shadow); }
.home .tagline .wordmark { font-weight: 800; letter-spacing: -.04em; }
.home .tagline .human { color: var(--accent); }
.home .positioning { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 3rem; text-align: center; }
.home .intro { font-size: .95rem; color: var(--ink-soft); line-height: 1.7; margin-bottom: 3.5rem; }
.home .preview-glass { background: var(--glass-bg); padding: 1.75rem 1.75rem 1.5rem; border-radius: 14px; border: 1px solid var(--rule); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin-bottom: 4.5rem; }
.home .preview-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); margin-bottom: 1.25rem; }
.home ul.preview { list-style: none; }
.home ul.preview li { padding: .75rem 0 .75rem 1.5rem; border-bottom: 1px solid var(--rule); font-size: .95rem; color: var(--ink); position: relative; }
.home ul.preview li:last-child { border-bottom: none; }
.home ul.preview li::before { content: "·"; color: var(--accent); font-weight: 800; position: absolute; left: 0; font-size: 1.5rem; line-height: .6; top: 1.1rem; }
.home footer { font-size: .85rem; color: var(--muted); text-align: center; }
.home footer .launch { color: var(--ink); font-weight: 600; margin-bottom: .5rem; }
.home footer .meta { margin-bottom: 1rem; }
.home footer a { color: var(--muted); text-decoration: none; transition: color .2s; }
.home footer a:hover { color: var(--accent); }
.home .social { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--rule); border-radius: 50%; color: var(--muted); transition: color .2s, border-color .2s; }
.home .social:hover { color: var(--accent); border-color: var(--accent); }
.home .social svg { width: 18px; height: 18px; display: block; }
.home footer .legal-links { margin-top: 1.25rem; font-size: .8rem; line-height: 1.9; }
@media (max-width: 480px) { body.home { padding: 3rem 1.25rem; } }

/* ===================== External-link bumper ===================== */
/* Screen-reader-only text (e.g. "opens in a new tab") */
.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; }
/* The ↗ external-link affordance, appended to outbound links */
.ext-icon { display: inline-block; width: .7em; height: .7em; margin-left: .15em; vertical-align: .18em; opacity: .7; flex: none; }
a:hover .ext-icon { opacity: 1; }

/* "You're leaving …" interstitial dialog (reuses the consent modal's visual language) */
#lb-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--overlay); }
#lb-overlay[hidden] { display: none; }
#lb-modal { background: var(--bg-glow); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; max-width: 30rem; width: 100%; padding: 1.5rem 1.5rem 1.25rem; box-shadow: 0 18px 48px var(--shadow); }
#lb-modal h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
#lb-modal #lb-desc { color: var(--ink-soft); font-size: .95rem; margin: 0 0 .5rem; }
#lb-modal #lb-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; color: var(--accent); word-break: break-all; background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: .5rem .65rem; margin: 0 0 1.25rem; }
#lb-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.lb-btn { font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; padding: .55rem 1.2rem; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--bg); }
.lb-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.lb-btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.lb-btn-secondary:hover { background: var(--hover-bg); border-color: var(--ink-soft); }

/* ===================== User OS preferences — Layer 2 ===================== */
/* High contrast — the OS request (unless the panel turned it off) or the panel's toggle on.
   Collapses softer text to full contrast, makes hairlines solid, thickens focus. Works in both themes. */
@media (prefers-contrast: more) {
  :root:not([data-contrast="off"]) { --ink-soft: var(--ink); --muted: var(--ink); --rule: var(--ink-soft); }
  :root:not([data-contrast="off"]) :focus-visible { outline-width: 3px; }
}
:root[data-contrast="more"] { --ink-soft: var(--ink); --muted: var(--ink); --rule: var(--ink-soft); }
:root[data-contrast="more"] :focus-visible { outline-width: 3px; }

/* Reduced transparency — turn the frosted-glass panel solid. */
@media (prefers-reduced-transparency: reduce) {
  .home .preview-glass { background: var(--bg-glow); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Forced colours (Windows High Contrast Mode) — keep interactive surfaces outlined + focus visible
   when the OS overrides our palette with its own. */
@media (forced-colors: active) {
  .lb-btn, .lb-btn-secondary, .btn-manage, .cc-float, .home .preview-glass, .cookie-row,
  #lb-modal, .site-header, .site-footer, .a11y-fab, #a11y-panel { border: 1px solid; }
  :focus-visible { outline: 2px solid; }
}

/* ===================== Display & accessibility panel (first-party) ===================== */
.a11y-fab { position: fixed; right: .85rem; bottom: .85rem; z-index: 55; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-glow); color: var(--accent); border: 1px solid var(--rule); cursor: pointer; box-shadow: 0 4px 16px var(--shadow); transition: color .2s, background .2s, border-color .2s; }
.a11y-fab:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
#a11y-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--overlay); }
#a11y-overlay[hidden] { display: none; }
#a11y-panel { background: var(--bg-glow); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; max-width: 24rem; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 18px 48px var(--shadow); }
.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem .65rem; }
.a11y-head h2 { font-size: 1.1rem; margin: 0; }
.a11y-x { background: none; border: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1; cursor: pointer; padding: .3rem; }
.a11y-x:hover { color: var(--ink); }
.a11y-body { padding: 0 1.25rem; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--rule); }
.a11y-row:first-child { border-top: 0; }
.a11y-label { font-size: .95rem; color: var(--ink); }
.a11y-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; flex: none; }
.a11y-opt { background: transparent; border: 0; color: var(--ink-soft); font: inherit; font-size: .85rem; padding: .35rem .75rem; cursor: pointer; }
.a11y-opt:hover { color: var(--ink); }
.a11y-opt.is-on { background: var(--accent); color: var(--bg); font-weight: 600; }
.a11y-switch { position: relative; width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface-2); cursor: pointer; padding: 0; flex: none; }
.a11y-switch .a11y-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-soft); transition: left .15s, background .15s; }
.a11y-switch.is-on { background: var(--accent); border-color: var(--accent); }
.a11y-switch.is-on .a11y-knob { left: 22px; background: var(--bg); }
.a11y-foot { padding: .65rem 1.25rem 1.1rem; }
.a11y-reset { background: transparent; border: 1px solid var(--rule); color: var(--ink-soft); font: inherit; font-size: .85rem; padding: .4rem .9rem; border-radius: 999px; cursor: pointer; }
.a11y-reset:hover { color: var(--ink); border-color: var(--ink-soft); }

/* Effects the panel toggles drive (same paths the OS media queries use). */
:root[data-text-scale="115"] { font-size: 115%; }
:root[data-text-scale="130"] { font-size: 130%; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
:root[data-underline] a { text-decoration: underline; }
:root[data-font="legible"] { --font-sans: Verdana, "Trebuchet MS", system-ui, sans-serif; }
