/* ================================================================
   FPFX — brand theme
   Loaded AFTER fpfx.css and overrides its design tokens, so the
   whole platform rebrands from one file rather than page by page.

   The inherited stylesheets were authored around a purple/pink
   palette and hardcode some of it. Tokens are remapped first;
   the literals that could not be tokenised are corrected below.
   ================================================================ */
:root{
  /* --- surfaces: THE LADDER ------------------------------------------------
     Six rungs, every one of them warm (hue 27-34) and none of them crossing a
     neutral. The old ladder started on #050505, which measures hue 0 / sat 0 -
     a pure grey - so the first thing any warm overlay did was drag a neutral
     toward gold and read muddy on the way. Hue is now carried at every rung,
     which is what makes the ramps between them clean.

     Each rung has ONE job. They are not interchangeable, and the gap between
     --bg and --surface is the one that must never close: it is the only thing
     that makes a panel read as a surface lifted off the ground rather than as
     a hole punched in a lit field.

       --bg-void    vignette terminus, modal ground, scrollbar track.
                    NEVER a panel. Nothing is allowed to be darker.
       --bg         the page ground. Everything else is measured from here.
       --bg-2       section bands, header rail, recessed form controls -
                    felt as a change of level, not seen as an edge.
       --surface    the resting panel / card.
       --surface-2  hover, active nav, focused input, popover.
       --surface-3  featured plan, price plinth, certificate mount. ONE step
                    only - this is the top of the ladder, not a highlight.

     Measured separation, old ladder -> new (WCAG ratio, raw-luminance factor):
       bg -> surface          1.072 (x3.44)  ->  1.067 (x2.40)
       surface -> surface-2   1.028 (x1.30)  ->  1.073 (x1.68)   +4.4% ratio
       surface-2 -> surface-3 1.078 (x1.65)  ->  1.118 (x1.70)   +3.7% ratio
       bg -> surface-3        1.188 (x7.38)  ->  1.281 (x6.87)   +7.8% ratio

     Honesty about that table, because the numbers do not all move one way:
     no dark-on-dark ladder reaches the 3:1 UI threshold without a rung turning
     mid-grey, and it is not claimed here. The two rungs that were genuinely
     collapsed - surface/surface-2 at 1.028:1 was a 1.3x luminance step, an
     invisible hover - are the ones that gain. bg -> surface loses 0.005 of
     ratio because the old --bg was near-black; that is paid for many times
     over by the atmosphere ceiling documented in fpfx-aurora.css, which drops
     the RENDERED ground from 7.22x brighter than a resting panel to 2.38x. */
  --bg-void:  #050403;
  --bg:       #0A0806;
  --bg-2:     #100C08;
  /* --panel / --panel2 are --surface and --surface-2 at their historic alphas.
     They are kept in step deliberately: a translucent panel that does not
     resolve to its own rung reads as a different component. */
  --panel:    rgba(23,17,9,.74);
  --panel2:   rgba(33,24,16,.88);
  --surface:  #171109;
  --surface-2:#211810;
  --surface-3:#2E2116;

  /* --- lines and type --- */
  --line:     rgba(238,183,98,.16);
  --line-strong:rgba(238,183,98,.42);
  --text:     #F8F8F8;
  /* --- THE CONTRAST FLOOR MOVED, AND IT MOVED UP ---------------------------
     The old values were #8E8A82 (--muted) and #948C82 (--muted-2), and the
     comment here claimed 6.02:1 for the floor. That number was correct and is
     still correct AGAINST A TOKEN GROUND: #948C82 on --au-bg measures 6.024:1.

     It was the wrong backdrop to measure against. Text does not land on the
     token ground; it lands on whatever the atmosphere has painted there. With
     the aurora running at its old .42 opacity the rendered ground measured
     #4B3119, and against THAT:

         --muted   #8E8A82   3.49:1     FAIL AA
         --muted-2 #948C82   3.61:1     FAIL AA, and far below its own floor
         --gold-dim #8A6B3A  2.42:1     FAIL AA

     That is the #635E58 failure - small text vanishing - recurring by a
     different route: the floor passed against the token and failed against
     the pixel. So the atmosphere now has a computed ceiling (#261F12, see
     fpfx-aurora.css) and every type token is proven against THAT, not against
     --bg. Measured worst case for each, across all six rungs, the ceiling,
     and glass resolved over the ceiling:

         --muted   #C4BCB1   8.31:1
         --muted-2 #AEA8A1   6.63:1   <- the floor. Nothing below it, any size.
         --gold-meta #CAA265 6.59:1

     Raising the floor is the correct response to darkening the ground: the
     ground got darker, but it also became a DEFINED text backdrop for the
     first time, so the floor is now measured somewhere real. */
  --muted:    #C4BCB1;
  --muted-2:  #AEA8A1;

  /* --- accents ---
     --gold / --gold-hi / --gold-dim are the Aurora names. Use these
     in any new rule; nothing in this platform should reference a
     colour by a hue name it no longer holds. */
  --gold:     #EEB762;
  --gold-hi:  #F3DBB2;
  /* --gold-dim IS NOT A TEXT COLOUR. Measured against every rung of the
     ladder it fails WCAG AA outright - 4.04:1 on --bg, 3.79:1 on --surface,
     3.16:1 on --surface-3, 3.30:1 on the atmosphere ceiling. It survives here
     for BORDERS, ICON STROKES, SCROLLBAR THUMBS and gradient stops, where no
     contrast minimum applies. Anything that sets it as `color:` is a live
     accessibility defect and must move to --gold-meta. */
  --gold-dim: #8A6B3A;
  /* The readable gold for meta, labels and small print. Same hue family
     (h 37 vs --gold-dim's h 34), 6.59:1 at its worst. */
  --gold-meta:#CAA265;

  /* --- inherited hue names: STILL LOAD-BEARING, but only just ---
     These are not decoration. A surface further up the cascade can declare
     its own --pink/--violet with the ORIGINAL magenta/violet value, and this
     file loads last, so these two declarations are what force it gold.

     Remaining declarer, as of this pass:
       admin/admin.css   --pink: #e8c472   --violet: #e19b4a   (out of scope,
                         recolour-only surface, so it keeps the hue names)

     Cleared since the comment was written:
       portal/verify.php (/certificates) declared --pink: #ff5be0. It now uses
       --accent / --accent-hi and carries no magenta at all, so the
       [style*="#ff5be0"] override further down this file no longer matches
       anything on that route.
       help/assets/css/help.css no longer declares either name.

     Remove these two ONLY after admin/admin.css stops declaring them. */
  --pink:     #EEB762;
  --violet:   #F3DBB2;

  /* --- semantic ---
     Green on a winning figure and red on a loss are the only cool /
     non-gold values Aurora permits. There is deliberately no --info:
     the sky blue it used to hold was a standing invitation to put a
     cool accent on a warm platform. */
  --good:     #22C55E;
  --bad:      #EF4444;

  /* Tighter than the inherited 28px: large radii read as consumer
     software, and this is a financial product. */
  --radius:   18px;

  /* Aurora runs one easing curve everywhere. --motion-smooth is the
     inherited name that dozens of transitions already reference, so
     it is repointed at Aurora's curve rather than replaced. The
     fallback matters: this file also loads on surfaces that do not
     link fpfx-aurora.css (admin, portal/checkout.php). */
  --motion-smooth: var(--au-ease, cubic-bezier(.2,.8,.3,1));
}

/* ================================================================
   Literal overrides — inherited purple/pink that was not tokenised.
   ================================================================ */

/* accent text and links
   The guard on every .legal-body descendant rule below is load-bearing.
   .legal-body is the BODY element on the legal routes, so every piece of
   shared chrome renders inside it, and an unguarded `.legal-body a`
   (0,1,1) outranks each of those components' own single-class rules
   (0,1,0). :where() contributes 0 specificity, so the guard changes which
   elements match and nothing else.

   .plinth — the shared footer. Measured before that guard: 36 plinth
   elements were being claimed by these five rules, including
   .plinth-set-h whose designed .18em tracking was overridden to -.02em.

   .fh / .fh-sheet — the shared header and its mobile bottom sheet. THE
   SAME BUG, LEFT UNFIXED WHEN .plinth WAS ADDED. Measured on /terms and
   on every one of the sixteen help routes: .fh-cta computed
   color:rgb(238,183,98), which is EXACTLY the left stop of its own
   `linear-gradient(100deg,#EEB762,#F3DBB2)` background — a contrast ratio
   of 1.00:1, a "Get funded" button with an invisible label. It was not
   only the button: .fh-login, .fh-help, .fh-aff, .fh-site and .fh-logo
   all measured #EEB762 too, so the whole chrome hierarchy was flattened
   to one colour on those 23 routes while reading correctly on /,
   /affiliates and /certificates. Correct values, restored by this guard:
   .fh-cta rgb(18,14,6) and .fh-login / .fh-help rgb(142,138,130).

   .fpfx-announce — the operator announcement strip, which renders above
   the header on the same 7 legal routes and has the identical defect:
   .fpfx-announce-cta sets color:#120E06 (0,1,0) over a gold pill and was
   measured at rgb(238,183,98), 1.00:1 against its own background.

   RAISING SPECIFICITY ON .fh-cta WOULD HAVE BEEN THE WRONG FIX — it
   leaves the other five elements flattened. The defect is that this rule
   claims chrome it does not own; the guard is what says so. */
[style*="#ff5be0"],
.legal-body a:not(:where(.plinth *, .fh *, .fh-sheet *, .fpfx-announce *)),
.legal-side a:not(:where(.plinth *, .fh *, .fh-sheet *, .fpfx-announce *)){ color:var(--gold); }
.legal-body a:not(:where(.plinth *, .fh *, .fh-sheet *, .fpfx-announce *)):hover,
.legal-side a:not(:where(.plinth *, .fh *, .fh-sheet *, .fpfx-announce *)):hover{ color:var(--gold-hi); }

/* panels, cards and rails that hardcoded violet tints */
.legal-hero, .legal-card, .legal-notice, .legal-highlight,
.legal-section, .legal-toc, .legal-side{
  border-color:var(--line) !important;
}
.legal-hero{
  background:
    radial-gradient(760px 380px at 18% -30%, rgba(238,183,98,.15), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg)) !important;
}
.legal-notice{
  background:rgba(238,183,98,.07) !important;
  border-color:var(--line-strong) !important;
}
.legal-highlight b, .legal-highlight strong{ color:var(--gold) !important; }

/* the inherited green used for "verified" states stays semantic,
   but is aligned to the platform's green */
[style*="#2fe3a0"], [style*="#49e1aa"]{ color:var(--good) !important; }

/* selection + focus */
::selection{ background:rgba(238,183,98,.28); color:#fff; }
:focus-visible{ outline:2px solid var(--gold); outline-offset:3px; }

/* scrollbar, so even the chrome reads on-brand.
   The track is --bg-void, not --bg-2: a scrollbar gutter is a hole in the
   page, so it belongs on the rung below the ground rather than on the one
   used for section bands. --gold-dim as the thumb is correct - it is a
   graphic, not text, and carries no contrast minimum. */
*{ scrollbar-color:var(--gold-dim) transparent; }
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background:var(--bg-void); }
*::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,var(--gold-dim),#4A3819);
  border-radius:8px; border:2px solid var(--bg-void);
}
*::-webkit-scrollbar-thumb:hover{ background:var(--gold); }

/* ================================================================
   Legal pages: typography for long-form reading.
   These documents are dense and are read under pressure — usually
   right before someone spends money — so measure, rhythm and
   scannability matter more than decoration.
   ================================================================ */
.legal-body{ font-size:.95rem; line-height:1.78; }
/* .fh-sheet-note is a <p> inside the bottom sheet and was being given a
   76ch measure by this rule. Same guard, same reason as the links above:
   a prose measure is for the document, not for the chrome around it. */
.legal-body p:not(:where(.plinth *, .fh *, .fh-sheet *, .fpfx-announce *)){ max-width:76ch; }
.legal-body h2:not(:where(.plinth *)){ letter-spacing:-.02em; }
.legal-body h3:not(:where(.plinth *)){ color:var(--text); letter-spacing:-.015em; }
.legal-body li:not(:where(.plinth *)){ max-width:74ch; }
.legal-body strong:not(:where(.plinth *)),
.legal-body b:not(:where(.plinth *)){ color:var(--text); font-weight:600; }

/* section anchors get a quiet gold rule rather than a heavy header */
.legal-section{ scroll-margin-top:96px; }
.legal-section + .legal-section{ border-top:1px solid var(--line); }

/* the sticky contents rail */
.legal-toc a{
  border-left:2px solid transparent;
  transition:border-color .24s var(--motion-smooth), color .24s var(--motion-smooth),
             background .24s var(--motion-smooth);
}
.legal-toc a:hover{ background:var(--surface); color:var(--text); border-left-color:var(--gold); }
.legal-toc a.is-active{ border-left-color:var(--gold); color:var(--gold); background:var(--surface-2); }

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    transition-duration:.001ms !important;
  }
}

/* ================================================================
   legal.css literal overrides
   The inherited legal stylesheet hardcodes a purple palette on
   class selectors, which outranks the tokenised `body` rule.
   Each selector below mirrors one in legal.css.
   ================================================================ */
body:not(.au-host).legal-body{ background:var(--bg) !important; }

.legal-hero::before{
  background:radial-gradient(circle at 78% 24%, rgba(238,183,98,.16), transparent 62%) !important;
}

/* the two drifting accent dots */
.legal-orbit::before,.legal-orbit::after{
  background:var(--gold) !important;
  box-shadow:0 0 22px rgba(238,183,98,.7) !important;
}
.legal-orbit-two::after{
  background:var(--gold-hi) !important;
  box-shadow:0 0 22px rgba(243,219,178,.6) !important;
}

.legal-highlight{
  border-color:var(--line) !important;
  background:linear-gradient(150deg, rgba(238,183,98,.10), rgba(238,183,98,.02)) !important;
}

.legal-toc{ background:var(--surface) !important; }

.legal-help-card{
  background:linear-gradient(135deg, rgba(238,183,98,.13), rgba(238,183,98,.03)) !important;
  border:1px solid var(--line) !important;
}

.legal-callout{
  background:linear-gradient(140deg, var(--surface-3), var(--surface)) !important;
  border:1px solid var(--line-strong) !important;
}

.legal-section-number{
  border-color:var(--line-strong) !important;
  background:linear-gradient(150deg, rgba(238,183,98,.16), rgba(238,183,98,.04)) !important;
  color:var(--gold) !important;
}

.legal-policy-grid a:hover{
  border-color:var(--line-strong) !important;
  background:var(--surface-2) !important;
}

.rules-program-card{
  border-color:var(--line) !important;
  background:linear-gradient(145deg, var(--surface-2), var(--surface)) !important;
}
.rules-program-head > span{
  background:rgba(238,183,98,.12) !important;
  border-color:var(--line-strong) !important;
  color:var(--gold) !important;
}

/* operator / payment-entity disclosure block */
.legal-operator-note,.legal-entity-note{
  border:1px solid var(--line) !important;
  background:var(--surface) !important;
}
