/* Wishbone — car-deal surface (purchase-defense rail). Reuses tokens.css + styles.css
 * (.wrap .brandrow .mark .brandname .hero .lede .sample .btn .protected .gate .meter
 * .hidden .inline-error). Only the surface-specific pieces live here. */

/* ===== WISHBONE THEME — scoped to this surface ONLY. car.css loads only on /car, and the
 * .wishbone body class makes it bulletproof: Parca's shared /app and /money surfaces are untouched.
 * Overriding the Layer-1 primitives here cascades correctly through tokens.css's semantic aliases,
 * because var() resolves in each element's own context (the .wishbone ancestor wins). ===== */
.wishbone {
  /* warm neutral ramp — bone / ivory (the wishbone itself) */
  --color-neutral-0:#ffffff; --color-neutral-50:#fcf9f3; --color-neutral-100:#f4eee2;
  --color-neutral-200:#eae0cf; --color-neutral-300:#dacdb3; --color-neutral-400:#b1a383;
  --color-neutral-500:#7a6e54; --color-neutral-600:#685d46; --color-neutral-700:#4d4433;
  --color-neutral-800:#352e21; --color-neutral-900:#221c13; --color-neutral-950:#130e09;
  /* amber-gold brand — luck / the lucky break. brand-600 (#a85f00) clears AA 4.5:1 for white-on-brand. */
  --color-brand-50:#fdf4e3; --color-brand-100:#f9e4bf; --color-brand-300:#ecb558;
  --color-brand-500:#c77d16; --color-brand-600:#a85f00; --color-brand-700:#844a00; --color-brand-900:#4d2b00;
  /* loss accent — terracotta clay, deliberately DISTINCT from amber brand so the money you KEEP
   * (deal-green) and the money that EVAPORATES (depreciation) never read alike. */
  --color-warning-50:#fdf0ea; --color-warning-600:#c2410c; --color-warning-700:#9a3412;
  /* re-point the semantic aliases we change */
  --brand:var(--color-brand-600); --brand-hover:var(--color-brand-700); --brand-active:var(--color-brand-900); --brand-subtle:var(--color-brand-50);
  --focus-ring:var(--color-brand-500);
  --intent-warning:var(--color-warning-600); --intent-warning-bg:var(--color-warning-50); --intent-warning-text:var(--color-warning-700);
  --bg-canvas:var(--color-neutral-50); --bg-sunken:var(--color-neutral-100);
  --shadow-raised:0 1px 2px rgba(70,45,10,.07),0 4px 12px rgba(70,45,10,.09);
}
/* the signature: the wishbone-Y mark (the fork; later doubles as the spread viz) */
.wishbone .wbmark { width:30px; height:34px; }
.wishbone .brandname small { color:var(--text-muted); }

/* THE GASP — the wishbone fork in the verdict banner snaps to your side. Replaces the generic ring.
 * The winning prong is amber + thick + sparked; the other recedes. Text still states the verdict (a11y). */
.wishbone .protected .fork { width:66px; height:62px; flex:none; overflow:visible; }
.wishbone .fork .prong { fill:none; stroke-linecap:round; }
.wishbone .fork .prong.win { stroke:var(--brand); stroke-width:7; }
.wishbone .fork .prong.lose { stroke:var(--color-neutral-300); stroke-width:5; }
.wishbone .fork .hub { fill:var(--brand); }
.wishbone .fork .spark { fill:var(--brand); }
@media (prefers-reduced-motion:no-preference) {
  /* both prongs draw in; the winning prong then snaps (a width pulse); the spark pops at its tip */
  .wishbone .fork .prong { stroke-dasharray:120; stroke-dashoffset:120; animation:wbdraw .55s ease-out forwards; }
  .wishbone .fork .prong.win { animation:wbdraw .55s ease-out forwards, wbsnap .4s cubic-bezier(.2,0,0,1) .55s both; }
  .wishbone .fork .hub { transform-origin:50px 85px; animation:wbpop .3s ease-out both; }
  .wishbone .fork .spark { transform-box:fill-box; transform-origin:center; opacity:0; animation:wbspark .5s cubic-bezier(.2,0,0,1) .85s both; }
}
@keyframes wbdraw { to { stroke-dashoffset:0; } }
@keyframes wbsnap { 0%{stroke-width:5} 55%{stroke-width:9.5} 100%{stroke-width:7} }
@keyframes wbpop { from{transform:scale(0)} to{transform:scale(1)} }
@keyframes wbspark { 0%{opacity:0;transform:scale(0)} 60%{opacity:1;transform:scale(1.6)} 100%{opacity:1;transform:scale(1)} }

/* THE HANDOFF — the wedge→destination card (Wishbone → the guardian). A warm offer, not a hard sell. */
.wishbone .handoff { background:var(--brand-subtle); border:1px solid var(--color-brand-300); border-radius:var(--radius-lg); padding:var(--space-6); margin-bottom:var(--space-6); }
.wishbone .handoff .eyebrow { display:block; font-size:var(--fs-12); font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--brand); }
.wishbone .handoff h3 { margin:var(--space-2) 0 var(--space-3); font-size:var(--fs-24); color:var(--text-primary); }
.wishbone .handoff > p { color:var(--text-secondary); font-size:var(--fs-16); line-height:1.6; margin:0 0 var(--space-4); max-width:62ch; }
.wishbone .handoff .hnote { font-size:var(--fs-12); color:var(--text-muted); line-height:1.5; margin:var(--space-3) 0 0; }
.wishbone .handoff .btn-primary { display:inline-block; text-decoration:none; }

/* verdict banner: brand (calm) variant for "stay local" — not a failure, a good honest outcome */
.protected.local { background:var(--brand-subtle); border-color:var(--color-brand-300); }
.protected.local .ring { background:var(--brand); }
.protected.local h2 { color:var(--brand); }
.protected .amt { white-space:nowrap; }
.protected .vsub { font-size:var(--fs-14); color:var(--text-secondary); margin-top:4px; }

/* sample grid (reused idiom) + no-card reassurance */
.cargrid { display:flex; gap:var(--space-4); flex-wrap:wrap; }
.cargrid > div { flex:1; min-width:150px; }
.cargrid select { width:100%; padding:10px 12px; border:1px solid var(--border-default); border-radius:var(--radius-sm); font:inherit; font-size:var(--fs-16); background:var(--bg-surface); color:var(--text-primary); min-height:44px; }
.reassure { font-size:var(--fs-12); color:var(--text-muted); margin-top:var(--space-1); }
.chips { display:flex; gap:var(--space-2); flex-wrap:wrap; margin:var(--space-2) 0 var(--space-3); }
.chip { font-size:var(--fs-14); padding:6px 12px; border:1px solid var(--border-default); border-radius:var(--radius-full); background:var(--bg-surface); cursor:pointer; color:var(--text-secondary); }
.chip:hover { border-color:var(--brand); color:var(--brand); }

/* protective flags (reuse .gate .flags idiom; car flags are cautions, not stops) */
.gate .flags.car { color:var(--intent-warning-text); }
.gate .flags.car li { display:flex; gap:var(--space-2); }
.gate .flags.car li b { color:var(--text-primary); }

/* card wrapper for the detail sections */
.panel { background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:var(--radius-lg); padding:var(--space-6); margin-bottom:var(--space-6); box-shadow:var(--shadow-raised); }
.panel h3 { margin:0 0 var(--space-4); font-size:var(--fs-20); }

/* national spread bars */
.spread .row { display:grid; grid-template-columns:1fr auto; align-items:center; gap:var(--space-3); padding:5px 0; }
.spread .lab { font-size:var(--fs-14); color:var(--text-secondary); margin-bottom:5px; }
.spread .track { background:var(--bg-sunken); border-radius:var(--radius-full); height:13px; overflow:hidden; }
.spread .fill { height:100%; border-radius:var(--radius-full); background:var(--color-brand-300); transition:width .5s cubic-bezier(.2,0,0,1); }
.spread .fill.best { background:var(--intent-success); }
.spread .amt { font-variant-numeric:tabular-nums; font-weight:600; font-size:var(--fs-14); }

/* landed-cost build-up */
.buildup .line { display:grid; grid-template-columns:1fr auto; padding:8px 0; border-bottom:1px solid var(--border-subtle); opacity:0; transform:translateY(4px); }
.buildup .line.in { opacity:1; transform:none; transition:all .25s ease-out; }
.buildup .line .lbl { color:var(--text-secondary); font-size:var(--fs-14); }
.buildup .line .val { font-variant-numeric:tabular-nums; font-weight:500; }
.buildup .line.neg .val { color:var(--intent-success-text); }
.buildup .line.est .lbl::after { content:' · estimated'; color:var(--intent-warning-text); font-size:var(--fs-12); }
.buildup .line.total { border-bottom:none; margin-top:var(--space-2); padding-top:var(--space-3); border-top:2px solid var(--border-strong); }
.buildup .line.total .lbl { font-weight:700; color:var(--text-primary); font-size:var(--fs-16); }
.buildup .line.total .val { font-weight:700; font-size:var(--fs-24); }
/* Shows-work: each dollar's source, in human meaning, under its label. */
.buildup .line .lbl .src { display:block; font-size:var(--fs-12); color:var(--text-muted); margin-top:1px; font-weight:400; }
/* Coverage boundary: what the number covers — and honestly what it does not. */
.buildup .boundary { margin-top:var(--space-4); padding-top:var(--space-4); border-top:1px solid var(--border-subtle); display:flex; flex-direction:column; gap:var(--space-2); }
.buildup .boundary .bline { font-size:var(--fs-14); line-height:1.5; color:var(--text-secondary); }
.buildup .boundary .bk { font-weight:700; }
.buildup .boundary .bcov .bk { color:var(--intent-success-text); }
.buildup .boundary .bno .bk { color:var(--intent-warning-text); }

/* cost-to-own: depreciation made visible (the biggest hidden cost). Reuses .buildup line idiom;
 * the loss number uses warning-text (honest bad-news colour), consistent with the caution palette. */
.owncost .ownlede { font-size:var(--fs-14); color:var(--text-secondary); margin:-8px 0 var(--space-4); line-height:1.5; }
.owncost .depbig { font-size:var(--fs-36); font-weight:700; color:var(--intent-warning-text); font-variant-numeric:tabular-nums; letter-spacing:-.02em; margin-bottom:var(--space-4); }
.owncost .depbig small { display:block; font-size:var(--fs-14); color:var(--text-secondary); font-weight:500; letter-spacing:normal; margin-top:4px; }
.owncost .boundary .bcov .bk { color:var(--intent-success-text); }

/* temperature gauges (inside .meter) */
.gauge { flex:1; min-width:200px; }
.gauge .glabel { font-size:var(--fs-14); color:var(--text-secondary); margin-bottom:6px; display:flex; justify-content:space-between; }
.gauge .glabel b { color:var(--text-primary); }
.gbar { height:12px; border-radius:var(--radius-full); background:var(--bg-sunken); overflow:hidden; }
.gbar .gfill { height:100%; border-radius:var(--radius-full); width:0; transition:width .6s cubic-bezier(.2,0,0,1); }
.gfill.hot,.gfill.warm { background:var(--intent-success); }
.gfill.lukewarm { background:var(--brand); }
.gfill.cool,.gfill.cold { background:var(--intent-warning); }
.factors { list-style:none; padding:0; margin:var(--space-3) 0 0; }
.factors li { display:grid; grid-template-columns:auto 1fr; gap:var(--space-2); padding:6px 0; font-size:var(--fs-14); color:var(--text-secondary); border-top:1px solid var(--border-subtle); }
.factors .pts { font-variant-numeric:tabular-nums; font-weight:600; min-width:40px; }
.pts.up { color:var(--intent-success-text); } .pts.down { color:var(--intent-warning-text); }

/* financing + APR-vs-rebate */
.finbig { font-size:var(--fs-36); font-weight:700; color:var(--brand); font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.finbig small { font-size:var(--fs-16); color:var(--text-secondary); font-weight:500; }
.apr { margin-top:var(--space-4); padding:var(--space-4); background:var(--bg-sunken); border-radius:var(--radius); }
.apr .opt { display:grid; grid-template-columns:1fr auto; font-size:var(--fs-14); padding:4px 0; }
.apr .win { font-weight:600; color:var(--intent-success-text); }
.ratetiers { display:flex; gap:var(--space-2); flex-wrap:wrap; margin-top:var(--space-3); }
.ratetiers .rt { font-size:var(--fs-12); padding:4px 10px; border-radius:var(--radius-full); background:var(--bg-sunken); color:var(--text-secondary); }

/* dealer ranking (reuse .ladder idiom, defined locally to avoid money.css dep) */
.deals { list-style:none; margin:0; padding:0; display:grid; gap:var(--space-2); }
.deals li { display:grid; grid-template-columns:1fr auto; gap:var(--space-3); background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:var(--radius); padding:var(--space-3) var(--space-4); }
.deals .dn { font-weight:600; } .deals .dm { font-size:var(--fs-12); color:var(--text-muted); }
.deals .dt { font-variant-numeric:tabular-nums; font-weight:700; font-size:var(--fs-20); text-align:right; }
.deals .dd { font-size:var(--fs-12); color:var(--text-muted); text-align:right; }
.admflag { display:inline-block; font-size:var(--fs-12); padding:2px 8px; border-radius:var(--radius-full); background:var(--intent-warning-bg); color:var(--intent-warning-text); margin-left:var(--space-2); }

.receipt { font-size:var(--fs-12); color:var(--text-muted); border-top:1px solid var(--border-subtle); padding-top:var(--space-4); margin-top:var(--space-6); }
.disc { font-size:var(--fs-12); color:var(--text-muted); font-style:italic; margin-top:var(--space-3); }
.skel { background:linear-gradient(90deg,var(--bg-sunken) 25%,var(--color-neutral-100) 50%,var(--bg-sunken) 75%); background-size:200% 100%; animation:sh 1.3s infinite; border-radius:var(--radius); height:120px; margin-bottom:var(--space-3); }
@keyframes sh { to { background-position:-200% 0; } }
@media (prefers-reduced-motion:reduce){ .buildup .line,.spread .fill,.gbar .gfill,.skel { transition:none!important; animation:none!important; opacity:1; transform:none; } }
