/* CARDS: one shell for every boxed card on the site, a pointer spotlight, and the ember underglow.
   Loads after styles.css and inner-hero.css and overrides them. Every colour is a token, so the light theme,
   the inverted .proof band and the .ledger sheet follow on their own. Nothing here uses !important.

   WHAT IS A CARD HERE
     .card (and .card.tool)   principle cards, tool cards
     .fit (.yes .no .practice) fit lists, the two home practice cards
     .offer                    finance offering rows
     .form-card                the contact form
     .side .book               the contact "Prefer to talk?" box
     .result-box               the result callouts (keeps a short ember tick on its left edge)
     .tool.soon                the "coming soon" tool: gets the radius only, stays dashed and unlit
   Left alone on purpose: hero stages (.boundary, .flow), the .proof band, the .ledger record, nav, footer,
   buttons, pills, form fields, the calculators.

   HOW THE LIGHT IS DRAWN
     No pseudo-element is used, so ::before and ::after stay free on every card, nothing can sit on top of a
     link or a field, and overflow:hidden on a card cannot clip the lit edge.
     The card has four background layers:
       1  the spotlight wash, a radial gradient at --mx / --my, clipped to the padding box
       2  the flat surface fill, clipped to the padding box
       3  the edge light, a radial gradient at the same point, clipped to the BORDER box
       4  the surface colour under the border
     The border itself stays a real 1 px --hair-2 line. It is translucent, so layer 3 shows through it and the
     border lights up near the pointer. If another stylesheet replaces `background`, the card still has its border.
     One registered number, --cs-on (0 at rest, 1 when lit), scales the wash, the edge and the underglow, so a
     single transition fades all three. Browsers without @property switch the light on without the fade.
     cards.js writes --mx / --my in px from the pointer. Without it the hover light sits in the centre of the card.

   FOR pictures.css (home practice cards)
     .has-underglow = the always-on underglow. Its exact value, both themes (tokens do the theming):
       box-shadow: var(--hi), var(--lift),
                   0 30px 46px -30px rgba(var(--ember-rgb), .75),
                   0 12px 22px -18px rgba(var(--ember-rgb), .55);
     A hovered card ends on the same two ember shadows, so the two glows match.
     The shell does not set overflow or padding; a picture card may set both. */

@property --cs-on{syntax:"<number>";inherits:false;initial-value:0}

/* strength of the light, per surface. Dark grounds take the full wash; paper grounds take half of it. */
:root{--cs-wash:.20;--cs-edge:1;--cs-glow-a:.75;--cs-glow-b:.55}
.proof,.ledger{--cs-wash:.10;--cs-edge:.85}
@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]){--cs-wash:.10;--cs-edge:.85;--cs-glow-a:.5;--cs-glow-b:.36}
  :root:not([data-theme="dark"]) .proof{--cs-wash:.20;--cs-edge:1}
}
:root[data-theme="light"]{--cs-wash:.10;--cs-edge:.85;--cs-glow-a:.5;--cs-glow-b:.36}
:root[data-theme="light"] .proof{--cs-wash:.20;--cs-edge:1}

/* ---------- the shell ---------- */
.card,.fit,.offer,.form-card,.side .book,.result-box{
  --cs-on:0;
  --cs-fill:var(--surface);
  --cs-accent:none;
  --cs-x:var(--mx,50%);
  --cs-y:var(--my,50%);
  border:1px solid var(--hair-2);
  border-radius:10px;
  background:
    var(--cs-accent),
    radial-gradient(360px circle at var(--cs-x) var(--cs-y),rgba(var(--ember-rgb),calc(var(--cs-wash)*var(--cs-on))),transparent 58%) padding-box,
    linear-gradient(var(--cs-fill),var(--cs-fill)) padding-box,
    radial-gradient(300px circle at var(--cs-x) var(--cs-y),rgba(var(--ember-rgb),calc(var(--cs-edge)*var(--cs-on))),transparent 66%) border-box,
    var(--cs-fill) border-box;
  box-shadow:var(--hi),var(--lift),
    0 30px 46px -30px rgba(var(--ember-rgb),calc(var(--cs-glow-a)*var(--cs-on))),
    0 12px 22px -18px rgba(var(--ember-rgb),calc(var(--cs-glow-b)*var(--cs-on)));
  transition:--cs-on .26s ease;
}
/* the ember top bar is gone: the heading colour and the + / - marks already tell the two fit lists apart */
.fit.yes,.fit.no,.fit.practice{border-top-color:var(--hair-2)}
/* the result callout keeps its accent: its left edge is ember, fading out before the corners */
.result-box{--cs-accent:linear-gradient(180deg,transparent,var(--ember) 24%,var(--ember) 76%,transparent) left center/2px 100% no-repeat border-box}
/* the old hover lifted the card, and stuck after a tap on phones: the card now stays put */
.card:hover{transform:none}
/* coming soon: the same corner, still a dashed outline with nothing in it, never lit */
.tool.soon{border-style:dashed;background:transparent;box-shadow:none}

/* ---------- lit: a pointer over the card, or keyboard focus inside it. Desktop pointers only, so a tap on a
   phone can never leave a card lit. :has() is in its own rule: a browser without it keeps the hover light and
   the site's normal focus outline. A keyboard user has no pointer position, so the focus light sits top right,
   where it reaches the border. ---------- */
@media (hover:hover) and (pointer:fine){
  .card:hover,.fit:hover,.offer:hover,.form-card:hover,.side .book:hover,.result-box:hover{--cs-on:1}
  .card:has(:focus-visible),.fit:has(:focus-visible),.offer:has(:focus-visible),.form-card:has(:focus-visible),
  .side .book:has(:focus-visible),.result-box:has(:focus-visible){--cs-on:1;--cs-x:var(--mx,76%);--cs-y:var(--my,14%)}
}

/* ---------- always-on underglow (home picture cards; see the note at the top) ---------- */
.has-underglow{
  box-shadow:var(--hi),var(--lift),
    0 30px 46px -30px rgba(var(--ember-rgb),.75),
    0 12px 22px -18px rgba(var(--ember-rgb),.55);
}

/* reduced motion: the light still answers hover and focus, it just does not fade or travel */
@media (prefers-reduced-motion:reduce){
  .card,.fit,.offer,.form-card,.side .book,.result-box{transition:none}
}
