/* finclus-ui.css — the shared Finclus page design layer.
   One visual language for index / discover / student / brain / /schemes pages,
   taken from the partner app (MASTER.md): dark premium, one emerald accent,
   IBM Plex Sans, 160–240ms ease-out, flat hairline cards.
   Link AFTER app/design-tokens.css. Plain CSS, no build step, prefix: fx-.
   Light theme is the :root default; dark via [data-theme="dark"] or the OS
   preference (mirrored in the prefers-color-scheme block for pages that never
   set data-theme). Every token pair clears WCAG 4.5:1 in both themes —
   checked by node scripts/qa-contrast-ui.js. No token defines a figure. */

/* ── Tokens: light (default) ─────────────────────────────────────────────── */
:root {
  /* surfaces — light is airy, not grey: off-white green, white cards, hairlines */
  --fx-ink-0: #f6faf7;   /* page background */
  --fx-ink-1: #ffffff;   /* cards, sections */
  --fx-ink-2: #eef3ef;   /* inputs, raised rows */
  --fx-ink-3: #e2eae4;   /* pressed states, quiet chips */
  --fx-line: #d8e2dc;
  --fx-line-strong: #b9c8c0;
  /* text */
  --fx-fg: #16231d;
  --fx-fg-2: #334036;
  --fx-fg-3: #5d6b62;
  /* accent — light-mode green reads on white; dark mode swaps to partner emerald */
  --fx-accent: #15803d;
  --fx-accent-press: #0f5c2e;
  --fx-accent-ink: #ffffff;   /* text on accent fills */
  --fx-warn: #926422;
  --fx-risk: #be123c;
  --fx-info: #1d4ed8;
  /* type — IBM Plex Sans, MASTER.md scale (12/13/15/16/18/22/28/36) */
  --fx-font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --fx-font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --fx-ls-eyebrow: 0.06em;
  /* 8px rhythm, 20px page gutter (MASTER.md) */
  --fx-space-1: 4px; --fx-space-2: 8px; --fx-space-3: 12px; --fx-space-4: 16px;
  --fx-space-5: 20px; --fx-space-6: 24px; --fx-space-8: 32px; --fx-space-12: 48px;
  /* radii: inputs 12, cards 16, pills full */
  --fx-r-input: 12px; --fx-r-card: 16px; --fx-r-pill: 999px;
  /* elevation is surface steps + hairlines; one soft shadow for lifted cards */
  --fx-shadow-card: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px -8px rgba(20, 40, 28, .12);
  /* motion — MASTER.md: 160–240ms, ease-out only, no bounce */
  --fx-dur-fast: 160ms; --fx-dur-base: 200ms; --fx-dur-slow: 240ms;
  --fx-ease-out: cubic-bezier(0.2, 0, 0, 1);
  --fx-stagger: 30ms;
  /* focus ring, everywhere */
  --fx-focus: 2px solid var(--fx-accent);
  /* elevation scale — resting card, hover lift, floating overlay (menu / dialog only) */
  --fx-shadow-lift: 0 4px 10px -4px rgba(20, 40, 28, .12), 0 14px 30px -12px rgba(20, 40, 28, .22);
  --fx-shadow-pop: 0 1px 2px rgba(16, 24, 40, .06), 0 24px 48px -16px rgba(20, 40, 28, .30);
  /* radius scale: xs 8 / input 12 / card 16 / pill */
  --fx-r-xs: 8px;
  /* motion — strong ease-out for entrances (never ease-in on UI), 60ms stagger step */
  --fx-dur-reveal: 400ms;
  --fx-ease-reveal: cubic-bezier(0.23, 1, 0.32, 1);
  --fx-stagger-step: 60ms;
}

/* ── Tokens: dark (partner app values, MASTER.md colour table) ──────────── */
:root[data-theme="dark"] {
  --fx-ink-0: #0B0F0D;
  --fx-ink-1: #121815;
  --fx-ink-2: #18201C;
  --fx-ink-3: #202A25;
  --fx-line: #26302B;
  --fx-line-strong: #34403A;
  --fx-fg: #ECEFEA;
  --fx-fg-2: #B4BEB8;
  --fx-fg-3: #8A968F;
  --fx-accent: #34D399;
  --fx-accent-press: #2BB884;
  --fx-accent-ink: #04140D;
  --fx-warn: #F5B94A;
  --fx-risk: #F87171;
  --fx-info: #7DD3FC;
  --fx-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --fx-shadow-lift: 0 4px 10px -4px rgba(0, 0, 0, .45), 0 14px 30px -12px rgba(0, 0, 0, .6);
  --fx-shadow-pop: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 48px -16px rgba(0, 0, 0, .7);
}

/* Pages that adopt this file without running the data-theme script follow the OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --fx-ink-0: #0B0F0D;
    --fx-ink-1: #121815;
    --fx-ink-2: #18201C;
    --fx-ink-3: #202A25;
    --fx-line: #26302B;
    --fx-line-strong: #34403A;
    --fx-fg: #ECEFEA;
    --fx-fg-2: #B4BEB8;
    --fx-fg-3: #8A968F;
    --fx-accent: #34D399;
    --fx-accent-press: #2BB884;
    --fx-accent-ink: #04140D;
    --fx-warn: #F5B94A;
    --fx-risk: #F87171;
    --fx-info: #7DD3FC;
    --fx-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --fx-shadow-lift: 0 4px 10px -4px rgba(0, 0, 0, .45), 0 14px 30px -12px rgba(0, 0, 0, .6);
    --fx-shadow-pop: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 48px -16px rgba(0, 0, 0, .7);
  }
}

/* Reduced motion: timed transitions and entrance animations collapse to zero. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --fx-dur-fast: 0ms;
    --fx-dur-base: 0ms;
    --fx-dur-slow: 0ms;
    --fx-dur-reveal: 0ms;
    --fx-stagger: 0ms;
    --fx-stagger-step: 0ms;
  }
  .fx-reveal,
  .fx-reveal.is-in,
  .fx-lift,
  .fx-lift.fx-lift,
  :is(.fx-reveal, .fx-lift) {
    transition: none !important;
    transition-duration: 0s !important;
  }
}

/* ── Base (scoped under .fx-scope so adopting pages opt in per-element) ─── */
:is(.fx-hero, .fx-section, .fx-card, .fx-stat, .fx-trust, .fx-steps, .fx-faq, .fx-footer, .fx-actions) {
  font-family: var(--fx-font-sans);
  color: var(--fx-fg);
  box-sizing: border-box;
}
.fx-scope {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}
/* no border-radius here: this file is linked whole-page, and a global radius would
   reshape every focused control that already carries its own larger corner. */
:focus-visible { outline: var(--fx-focus); outline-offset: 2px; }

/* ── Hero / page header ──────────────────────────────────────────────────── */
.fx-hero {
  background: var(--fx-ink-0);
  color: var(--fx-fg);
  padding: 48px 0 40px;
}
.fx-hero-kicker {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--fx-ls-eyebrow); color: var(--fx-fg-3);
  margin: 0 0 8px;
}
.fx-hero-title {
  font-size: 36px; line-height: 40px; font-weight: 300;
  letter-spacing: -0.01em; margin: 0 0 12px;
}
.fx-hero-sub {
  font-size: 15px; line-height: 22px; color: var(--fx-fg-2);
  max-width: 56ch; margin: 0 0 24px;
}
@media (min-width: 720px) { .fx-hero-title { font-size: 40px; line-height: 44px; } }

/* ── Section ─────────────────────────────────────────────────────────────── */
.fx-section { padding: 32px 0; }
.fx-section-head { margin: 0 0 20px; }
.fx-section-title {
  font-size: 22px; line-height: 28px; font-weight: 400; margin: 0 0 8px;
}
.fx-section-meta { font-size: 13px; line-height: 18px; color: var(--fx-fg-3); margin: 0; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.fx-card {
  background: var(--fx-ink-1);
  border: 1px solid var(--fx-line);
  border-radius: var(--fx-r-card);
  padding: 16px 20px;
}
.fx-card-title {
  font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 4px;
}
.fx-card-body { font-size: 15px; line-height: 22px; color: var(--fx-fg-2); margin: 0; }

/* ── Stat / money tile — the value slot + a mandatory source footnote slot ──
   Money truth: .fx-stat-src exists so every figure carries its source line;
   a tile without a source is a bug, not a style choice. */
.fx-stat {
  background: var(--fx-ink-1);
  border: 1px solid var(--fx-line);
  border-radius: var(--fx-r-card);
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.fx-stat-value {
  font-size: 28px; line-height: 32px; font-weight: 300;
  font-variant-numeric: tabular-nums; margin: 0;
}
.fx-stat-label { font-size: 13px; line-height: 18px; color: var(--fx-fg-2); margin: 0; }
.fx-stat-src {
  font-size: 12px; line-height: 16px; color: var(--fx-fg-3);
  border-top: 1px solid var(--fx-line);
  padding-top: 8px; margin-top: 8px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.fx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: var(--fx-r-input);
  font: 600 15px/22px var(--fx-font-sans);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--fx-dur-fast) var(--fx-ease-out),
              transform var(--fx-dur-fast) var(--fx-ease-out);
  -webkit-tap-highlight-color: transparent;
}
.fx-btn:active:not(:disabled) { transform: scale(0.98); }
.fx-btn:disabled { opacity: 40%; cursor: not-allowed; }
.fx-btn-primary { background: var(--fx-accent); color: var(--fx-accent-ink); }
.fx-btn-primary:active:not(:disabled) { background: var(--fx-accent-press); }
.fx-btn-ghost { background: transparent; color: var(--fx-fg); border-color: var(--fx-line-strong); }
.fx-btn-ghost:active:not(:disabled) { background: var(--fx-ink-3); }
.fx-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
@media (hover: hover) and (pointer: fine) {
  .fx-btn-primary:hover:not(:disabled) { background: var(--fx-accent-press); }
  .fx-btn-ghost:hover:not(:disabled) { background: var(--fx-ink-2); }
}

/* ── Trust strip — official sources, privacy, free. Words and dots, no claims. */
.fx-trust {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--fx-line);
  border-bottom: 1px solid var(--fx-line);
}
.fx-trust-item {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 18px; color: var(--fx-fg-2);
}
.fx-trust-item::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fx-accent); flex-shrink: 0;
}

/* ── Steps list ──────────────────────────────────────────────────────────── */
.fx-steps { list-style: none; margin: 0; padding: 0; counter-reset: fx-step; }
.fx-steps li {
  counter-increment: fx-step;
  display: flex; gap: 16px; align-items: flex-start;
  padding: 16px 0;
}
.fx-steps li + li { border-top: 1px solid var(--fx-line); }
.fx-steps li::before {
  content: counter(fx-step);
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 600 12px/1 var(--fx-font-mono);
  border: 1px solid var(--fx-line-strong);
  color: var(--fx-fg-3);
}
.fx-steps li.fx-step-now::before {
  background: var(--fx-accent); color: var(--fx-accent-ink);
  border-color: var(--fx-accent);
}
.fx-step-title { font-size: 15px; line-height: 22px; font-weight: 600; margin: 2px 0 0; }
.fx-step-body { font-size: 13px; line-height: 18px; color: var(--fx-fg-2); margin: 2px 0 0; }

/* ── FAQ (details/summary) ──────────────────────────────────────────────── */
.fx-faq { margin: 0; }
.fx-faq details {
  background: var(--fx-ink-1);
  border: 1px solid var(--fx-line);
  border-radius: var(--fx-r-input);
  margin-bottom: 8px;
}
.fx-faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 48px; padding: 12px 16px;
  font-size: 15px; line-height: 22px; font-weight: 600;
  cursor: pointer; list-style: none;
}
.fx-faq summary::-webkit-details-marker { display: none; }
.fx-faq summary::after {
  content: '+'; font: 400 18px/1 var(--fx-font-sans); color: var(--fx-fg-3);
}
.fx-faq details[open] summary::after { content: '−'; }
.fx-faq details[open] summary { border-bottom: 1px solid var(--fx-line); }
.fx-faq .fx-faq-body { padding: 12px 16px; font-size: 14px; line-height: 21px; color: var(--fx-fg-2); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.fx-footer {
  background: var(--fx-ink-0);
  border-top: 1px solid var(--fx-line);
  padding: 24px 0;
  color: var(--fx-fg-3);
  font-size: 13px; line-height: 18px;
}
.fx-footer a { color: var(--fx-fg-2); text-decoration: underline; text-underline-offset: 4px; }

/* ── Shared motion contract (B + C apply these classes; nothing else touches this file)
   Every reveal/transition is transform + opacity only (composite-only, GPU). The hidden
   start state is applied ONLY when a page adds .fx-js to <html> on script start — no-JS
   visitors see everything (content-first). prefers-reduced-motion collapses all of it:
   instant state, no travel, no shimmer. ───────────────────────────────────────────── */
html.fx-js .fx-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--fx-dur-reveal) var(--fx-ease-reveal),
              transform var(--fx-dur-reveal) var(--fx-ease-reveal);
}
/* IntersectionObserver (page script) adds .is-in; transition-delay stays on the element,
   so the reveal can still be interrupted by un-observing mid-flight. Specificity matches
   html.fx-js so the reveal end-state beats the start-state. */
html.fx-js .fx-reveal.is-in,
.fx-reveal.is-in { opacity: 1; transform: none; }
/* .fx-reveal-stagger on a container: its .fx-reveal children step 60ms apart, capped so a
   long list can never hold content off-screen for more than ~600ms. */
.fx-reveal-stagger > .fx-reveal:nth-child(1) { transition-delay: 0ms; }
.fx-reveal-stagger > .fx-reveal:nth-child(2) { transition-delay: var(--fx-stagger-step); }
.fx-reveal-stagger > .fx-reveal:nth-child(3) { transition-delay: calc(var(--fx-stagger-step) * 2); }
.fx-reveal-stagger > .fx-reveal:nth-child(4) { transition-delay: calc(var(--fx-stagger-step) * 3); }
.fx-reveal-stagger > .fx-reveal:nth-child(5) { transition-delay: calc(var(--fx-stagger-step) * 4); }
.fx-reveal-stagger > .fx-reveal:nth-child(n + 6) { transition-delay: calc(var(--fx-stagger-step) * 5); }

/* .fx-lift — hover/focus affordance on cards, buttons, links. Shadow is pre-painted at
   rest and cross-faded via opacity on a pseudo layer, so the lift animates composite-only
   (an animated box-shadow repaints every frame). Gated to real pointers: touch fires
   false hovers on tap. */
.fx-lift { position: relative; }
.fx-lift::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: var(--fx-shadow-lift); opacity: 0; pointer-events: none;
  transition: opacity var(--fx-dur-base) var(--fx-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .fx-lift:hover { transform: translateY(-2px); }
  .fx-lift:hover::after { opacity: 1; }
}
.fx-lift:focus-visible { transform: translateY(-2px); }
.fx-lift:focus-visible::after { opacity: 1; }
/* .fx-lift.fx-lift — the compound lifts specificity to (0,2,0) so the lift's transform
   transition beats a Tailwind transition-* utility on the same element: this file links
   before the Tailwind build, and at equal (0,1,0) the later stylesheet would win and the
   2px lift would snap instead of easing. Cost: color transitions on that element go
   instant — the lift is the affordance, and the shadow cross-fade on ::after still eases. */
.fx-lift.fx-lift { transition: transform var(--fx-dur-base) var(--fx-ease-out); }

/* .fx-skel — shimmer skeleton for loading states (discover results). A gradient sweep on
   ::before is transform-only; the base fill is a flat tone step (no layout shift). */
.fx-skel {
  position: relative; overflow: hidden;
  background: var(--fx-ink-3);
  border-radius: var(--fx-r-xs);
  min-height: 12px;
}
.fx-skel::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--fx-ink-1) 70%, transparent) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: fx-skel-sweep 1.4s linear infinite;
}
@keyframes fx-skel-sweep { to { transform: translateX(100%); } }
.fx-skel-block { min-height: 84px; border-radius: var(--fx-r-card); }
.fx-skel-line { height: 12px; }
.fx-skel-line + .fx-skel-line { margin-top: 8px; }

/* .fx-icon — inline SVG sizing + colour. Icons inherit currentColor so theme + hover
   follow the text; 20px is the 15px-body default, sized via em so it tracks font size. */
.fx-icon { width: 1.25em; height: 1.25em; flex: none; color: inherit; vertical-align: -0.25em; }
.fx-icon-24 { width: 1.5em; height: 1.5em; }
.fx-icon-sm { width: 1em; height: 1em; }
.fx-icon-accent { color: var(--fx-accent); }

/* number styling — the "every figure cited" motif: tabular figures, tight tracking,
   the source line right under any value so a number never sits un-sourced. */
.fx-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-weight: 600;
}
.fx-num-unit { font-size: 0.6em; font-weight: 600; letter-spacing: 0; margin-left: 2px; color: var(--fx-fg-2); }
.fx-num-not { color: var(--fx-fg-3); font-weight: 400; font-style: italic; }

/* ── Section accents + dividers (brand-consistent, aria-hidden by default) ── */
.fx-divider {
  display: block; width: 100%; height: 1px;
  background: var(--fx-line); border: 0; margin: 32px 0;
}
.fx-accent-leaf {
  display: inline-block; width: 24px; height: 24px;
  color: var(--fx-accent); vertical-align: middle;
}

/* ── Empty state anatomy (no fake data, clear honest copy, escape action) ── */
.fx-empty {
  text-align: center; padding: 48px 24px;
  border-radius: var(--fx-r-card);
  background: var(--fx-ink-2);
  border: 1px dashed var(--fx-line-strong);
}
.fx-empty-icon {
  width: 40px; height: 40px; margin: 0 auto 12px;
  color: var(--fx-fg-3);
}
.fx-empty-title {
  font-size: 16px; font-weight: 600; color: var(--fx-fg); margin: 0 0 6px;
}
.fx-empty-desc {
  font-size: 14px; line-height: 20px; color: var(--fx-fg-3); max-width: 44ch; margin: 0 auto 16px;
}

/* ── Smooth state transitions (tabs, accordion bodies) ─────────────────────── */
.fx-tab-panel {
  transition: opacity var(--fx-dur-base) var(--fx-ease-out),
              transform var(--fx-dur-base) var(--fx-ease-out);
}
/* .fx-accordion-content — open/close as an opacity crossfade. Height is owned by the
   element's content (or a layout system), never animated here: max-height animates layout. */
.fx-accordion-content {
  overflow: hidden;
  transition: opacity var(--fx-dur-base) var(--fx-ease-out);
}

/* ── Reduced motion: instant, no travel, no shimmer, no float ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html.fx-js .fx-reveal { opacity: 1; transform: none; transition: none; }
  .fx-reveal.is-in { transition: none; }
  .fx-reveal-stagger > .fx-reveal { transition-delay: 0ms; }
  /* .fx-lift.fx-lift included: its (0,2,0) lift transition would otherwise beat this
     (0,1,0) override and keep the 2px travel alive under reduced motion. */
  .fx-lift, .fx-lift::after, .fx-lift.fx-lift { transform: none; transition: none; }
  .fx-lift:hover, .fx-lift:focus-visible { transform: none; }
  .fx-skel::before { animation: none; transform: none; }
}

