/* =============================================================
   fod-pillar3.css — FOD AIOS Pillar 3 Design System
   Authority: outputs/2026-05-20/quantum-research/aios-design-brief.md
              vault/ClickRebels/10-Quantum/01-design-system-golden-fib.md
   Scope:     Section-scoped via [data-pillar3] attribute.
                round-1 (2026-05-21): #sec-home, #sec-analytics, #sec-sales
                round-2 (2026-05-21): #sec-workflow, #sec-booking, #sec-comms
              Other 6 tabs untouched except for body typeface.
   Round:     T3-003 round_id=1, 2026-05-21 (Home / Analytics & KPIs / Sales)
              T3-004 round_id=2, 2026-05-21 (Workflow / Booking System / Comms)
   ============================================================= */

/* ---------- 1. Global design tokens (apply everywhere) ---------- */
:root {
  /* Typography — global swap to Geist Sans */
  --font-sans: 'Geist', 'Geist Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'DM Mono', ui-monospace, SFMono-Regular, monospace;

  /* Fibonacci spacing scale (px) */
  --space-8:   8px;
  --space-13: 13px;
  --space-21: 21px;
  --space-34: 34px;
  --space-55: 55px;
  --space-89: 89px;
  --space-144: 144px;

  /* Golden type scale (px) */
  --type-16:  16px;
  --type-26:  26px;
  --type-42:  42px;
  --type-68:  68px;
  --type-110: 110px;
  --type-178: 178px;

  /* Accent — canonical FOD gold (P11 + brief Q4 lock) */
  --accent: #B8924E;
  --accent-50:  #F5EBD9;
  --accent-200: #E5C99C;
  --accent-500: #B8924E;
  --accent-800: #5A4422;
  --accent-950: #2A1F0F;
  --accent-glow: rgba(184, 146, 78, 0.32);

  /* Animation timings (Fibonacci ms) */
  --t-snap:       89ms;
  --t-transition: 144ms;
  --t-settle:    233ms;
  --t-page:      377ms;

  /* Golden cubic-bezier (38.2% / 61.8% control points) */
  --ease-golden: cubic-bezier(0.382, 0, 0.618, 1);
}

/* ---------- 2. Global body typeface swap ---------- */
body,
html {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01', 'ss03';  /* Geist stylistic sets */
}

code,
pre,
.mono,
[class*='mono'] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Tabular numerals everywhere there's a number (per brief 2E lock) */
.kpi-value,
.kpi-num,
[data-pillar3] .num,
[data-pillar3] [class*='value'],
[data-pillar3] [class*='count'] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}

/* ---------- 3. Section-scoped Pillar 3 overrides ----------
   Apply ONLY to retrofitted sections to avoid bleed.
   `:is(...)` keeps specificity at (0,1,0,1) — identical to Round 1's
   per-ID selectors. Extending the scope is a single-line edit per round.
*/
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] {

  /* Override champagne legacy with gold inside scoped sections */
  --green:       var(--accent-500);
  --green-glow:  var(--accent-200);
  --green-dark:  var(--accent-800);
  --text-sec:    #C7B388;   /* warm neutral that reads with #B8924E */

  /* Section-level typography */
  font-family: var(--font-sans);
  letter-spacing: -0.005em;
}

/* Golden type scale — applied to retrofitted headings */
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] h1 {
  font-size: var(--type-110);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] h2 {
  font-size: var(--type-68);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(h3, .card-title) {
  font-size: var(--type-42);
  font-weight: 550;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(.lede, .subtitle) {
  font-size: var(--type-26);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-sec);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(p, li) {
  font-size: var(--type-16);
  line-height: 1.55;
}

/* Fibonacci spacing — top-level rhythm inside retrofitted sections */
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] {
  padding: var(--space-34) var(--space-55);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] > * + * {
  margin-top: var(--space-55);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] .card {
  padding: var(--space-21);
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--bg-card);
  transition: border-color var(--t-transition) var(--ease-golden),
              box-shadow var(--t-transition) var(--ease-golden);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] .card:hover {
  border-color: var(--accent-glow);
  box-shadow: 0 0 21px -8px var(--accent-glow);
}

/* 38.2 / 61.8 golden split — for any container that opts in */
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] .split-golden {
  display: grid;
  grid-template-columns: 38.2% 61.8%;
  gap: var(--space-34);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] .split-golden-rev {
  display: grid;
  grid-template-columns: 61.8% 38.2%;
  gap: var(--space-34);
}

/* Hairline dividers (per brief 1B lock: hairlines, not borders) */
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(hr, .divider) {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: var(--space-21) 0;
}

/* Buttons — single accent #B8924E */
:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(.btn-primary, button.primary) {
  background: var(--accent-500);
  color: #1A1208;
  border: 0;
  padding: var(--space-13) var(--space-21);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--type-16);
  border-radius: 8px;
  cursor: pointer;
  transition: transform var(--t-snap) var(--ease-golden),
              box-shadow var(--t-transition) var(--ease-golden);
}

:is(#sec-home, #sec-analytics, #sec-sales,
    #sec-workflow, #sec-booking, #sec-comms)[data-pillar3] :is(.btn-primary, button.primary):hover {
  box-shadow: 0 0 34px -8px var(--accent-glow);
  transform: translateY(-1px);
}

/* ---------- 4. Pulse Lane component (default OFF for FOD) ----------
   Built but inert: only activates when [data-pulse-lane=on].
   Per brief Q4 lock + T3-003 constraint.
*/
.pulse-lane {
  display: none;
  position: relative;
  margin: var(--space-21) 0;
  padding: var(--space-13) var(--space-21);
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-glow),
    transparent
  );
  background-size: 200% 100%;
  border-top: 1px solid rgba(184, 146, 78, 0.18);
  border-bottom: 1px solid rgba(184, 146, 78, 0.18);
  font-family: var(--font-sans);
  font-size: var(--type-16);
  color: var(--text-sec);
  letter-spacing: 0.01em;
}

body[data-pulse-lane='on'] .pulse-lane {
  display: block;
  animation: pulse-lane-sweep 4.5s var(--ease-golden) infinite;
}

@keyframes pulse-lane-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pulse-lane .pulse-lane-quote {
  display: block;
  font-style: italic;
  opacity: 0.85;
}

.pulse-lane .pulse-lane-attrib {
  display: block;
  font-size: 13px;
  color: var(--accent-500);
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- 5. Performance-mode toggle ---------- */
body[data-perf-mode='on'] .pulse-lane,
body[data-perf-mode='on'] .ambient-pulse,
body[data-perf-mode='on'] [class*='mesh-gradient'],
body[data-perf-mode='on'] [class*='parallax'] {
  animation: none !important;
  transition: none !important;
}

body[data-perf-mode='on'] *,
body[data-perf-mode='on'] *::before,
body[data-perf-mode='on'] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* Tiny floating toggle pill, bottom-right.
   Not in any tab — outside the 3-tab scope by design. */
.perf-mode-toggle {
  position: fixed;
  bottom: var(--space-21);
  right: var(--space-21);
  z-index: 9999;
  padding: var(--space-8) var(--space-13);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(184, 146, 78, 0.32);
  border-radius: 21px;
  color: var(--text-sec);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(13px);
  transition: opacity var(--t-transition) var(--ease-golden);
  opacity: 0.4;
}

.perf-mode-toggle:hover {
  opacity: 1;
}

body[data-perf-mode='on'] .perf-mode-toggle {
  color: var(--accent-500);
  border-color: var(--accent-500);
}

/* Respect prefers-reduced-motion regardless of toggle state */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 6. Waivers (logged inline per design system §waivers) ---------- */
/* WAIVER: existing inline base.html styles use Montserrat/Poppins font stack
   and non-Fibonacci spacing throughout. Round 1+2 retrofit overrides
   typography globally + spacing/colors per-section. Full inline-style purge
   is out of round 1/2 scope and would force visual regression on the other
   6 tabs which are deliberately untouched.

   ROUND 2 NOTE (Workflow / Booking System / Comms): two of these sections
   (Workflow, Comms) host iframes (ClickUp + Slack respectively). Iframe
   content is sandboxed and cannot inherit our typography or color tokens.
   Pillar 3 retrofit applies to the CHROME around the iframe (section header,
   toolbar buttons, surrounding panels) — the iframe content itself remains
   provider-styled. This is correct behavior, not a gap. */
