/* ============================================================================
   sj-premium.css — elevated visual layer, shared by the Cosmos and
   Trafalgar clusters
   Loads AFTER traf-enhance.css and sj-enhance.css and only sharpens what
   they already establish. Namespaced .cpx-* for anything new; existing classes
   are extended, never redefined wholesale.
   Every motion rule is disabled under prefers-reduced-motion (section 12).
   ========================================================================== */

/* ---------- 1. Typographic refinement -------------------------------------
   The body face is Newsreader, an optical-size variable serif. Turning on
   opsz plus real ligatures and old-style figures inside running prose is the
   single biggest perceived-quality change on a text-heavy page. */
.prose p, main > section > p, .lede, .card p, .callout p, .profile-note{
  font-variant-numeric: oldstyle-num proportional-nums;
  font-kerning: normal;
  font-feature-settings: "liga" 1, "clig" 1, "kern" 1;
  text-rendering: optimizeLegibility;
}
/* Figures inside tables, stats and tools stay lining + tabular so columns align. */
.tbl, .stat-num, .sjx-out-big, .cchart, .sjx-tool, .gauge-val, .mono{
  font-variant-numeric: lining-nums tabular-nums;
}
/* Slightly tighter measure and a touch more leading for long-form reading. */
.prose p, main > section > p{ max-width: 66ch; line-height: 1.62; }
.prose p + p, main > section > p + p{ margin-top: 2px; }

/* The voice pass produced many deliberate one-line paragraphs. Give the short
   ones a little more air so they read as the beats they are, without inventing
   a new component the author has to remember to apply. */
.prose p.cpx-beat, main > section > p.cpx-beat{
  font-size: 1.06em;
  line-height: 1.45;
  color: var(--ink);
  margin: 20px 0 20px;
  padding-left: 18px;
  border-left: 2px solid var(--brass);
  max-width: 58ch;
}

/* ---------- 2. Section rhythm ---------------------------------------------
   A hairline that fades out from the left, so sections separate without the
   heaviness of a full rule. */
main > section + section{ position: relative; padding-top: 8px; }
main > section + section::before{
  content:""; position:absolute; top:-26px; left:0; right:0; height:1px;
  background: linear-gradient(90deg, var(--brass) 0%, rgba(184,134,59,.28) 12%, var(--paper-2) 42%, transparent 78%);
}
.section-head{ align-items: center; }
.section-head .num{
  font-weight: 700;
  padding: 3px 9px;
  border: 1px solid rgba(184,134,59,.34);
  border-radius: 4px;
  background: rgba(184,134,59,.07);
  line-height: 1;
}

/* ---------- 3. Table craft ------------------------------------------------ */
.tbl-wrap{ border-radius: 10px; border: 1px solid var(--paper-2); background: #fff; }
.tbl{ margin-top: 0; }
/* NOTE: no sticky column header here, deliberately. The site header is already
   154px of sticky chrome on desktop and the section navbar sticks under it; a
   pinned <thead> either hides behind that chrome or floats over the rows. The
   scroll affordance from sj-enhance.css covers the wide-table case instead. */
.tbl thead th{
  background: #fbfaf6;
  box-shadow: inset 0 -1px 0 var(--deep);
}
.tbl tbody tr:first-child td{ padding-top: 15px; }
.tbl tbody tr{ transition: background .16s ease; }
.tbl tbody tr:hover td{ background: rgba(184,134,59,.06); }
.tbl td, .tbl th{ transition: background .16s ease; }
/* Numeric columns get tabular figures and right alignment for scanability. */
.tbl .n{ font-variant-numeric: lining-nums tabular-nums; }
/* A cell the author bolded is the row's point — let it read that way. */
.tbl td b{ color: var(--deep); }

/* ---------- 4. Cards and callouts -----------------------------------------
   CONTRAST FIX. .card and .tbl-wrap paint their own white surface but never
   set a text colour, so they inherited it. Inside .profile — which is dark
   and sets color:var(--paper) for its own text — that produced near-white
   text on a white card at a 1.14 contrast ratio: invisible. A block that
   paints its own light surface must own its foreground too. */
.card, .tbl-wrap, .tbl{ color: var(--ink); }
.card b, .card strong, .tbl b, .tbl strong{ color: var(--deep); }

.card{
  transition: transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s ease, border-color .22s ease;
  will-change: transform;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: 0 2px 0 rgba(11,49,56,.04), 0 18px 40px -28px rgba(11,49,56,.55);
  border-color: rgba(184,134,59,.42);
}
.callout{ position: relative; overflow: hidden; }
.callout::after{
  content:""; position:absolute; inset:0 auto 0 0; width:3px;
  background: linear-gradient(180deg, var(--brass), rgba(184,134,59,.15));
}

/* ---------- 5. Hero depth --------------------------------------------------
   Adds atmosphere behind the existing hero-fx without touching its markup. */
.hero::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(70% 120% at 18% 0%, rgba(184,134,59,.13), transparent 58%),
    radial-gradient(50% 90% at 88% 10%, rgba(18,82,94,.42), transparent 62%);
}
.hero .governing{ text-wrap: pretty; }
.hero h1{ text-wrap: balance; }
h2, .card h3{ text-wrap: balance; }

/* Stats: a quiet lift on hover, and a brass hairline that draws in on reveal. */
.stat{ position: relative; transition: background .2s ease; }
.stat:hover{ background: #14606e; }
.stat::after{
  content:""; position:absolute; left:0; right:0; bottom:0; height:2px;
  background: var(--brass); transform: scaleX(0); transform-origin: left;
  transition: transform .7s cubic-bezier(.2,.7,.2,1);
}
.stats.cpx-in .stat::after{ transform: scaleX(1); }
.stats.cpx-in .stat:nth-child(2)::after{ transition-delay: .09s }
.stats.cpx-in .stat:nth-child(3)::after{ transition-delay: .18s }
.stats.cpx-in .stat:nth-child(4)::after{ transition-delay: .27s }

/* ---------- 6. Scroll reveal (refined) ------------------------------------ */
.cpx-r{ opacity: 0; transform: translateY(14px); }
.cpx-r.cpx-in{
  opacity: 1; transform: none;
  transition: opacity .62s cubic-bezier(.2,.7,.2,1), transform .62s cubic-bezier(.2,.7,.2,1);
}
.cpx-r-1.cpx-in{ transition-delay: .06s }
.cpx-r-2.cpx-in{ transition-delay: .12s }
.cpx-r-3.cpx-in{ transition-delay: .18s }

/* ---------- 7. Section rail (desktop mini-TOC) -----------------------------
   A slim progress rail pinned to the viewport edge. Pure navigation aid; it
   never covers content and is hidden below 1180px. */
.cpx-rail{
  position: fixed; left: 18px; top: 50%; transform: translateY(-50%);
  z-index: 40; display: none; flex-direction: column; gap: 10px;
}
@media (min-width: 1180px){ .cpx-rail{ display: flex; } }
.cpx-rail a{
  display: block; width: 22px; height: 3px; border-radius: 2px;
  background: rgba(11,49,56,.16); position: relative;
  transition: background .2s ease, width .2s ease;
}
.cpx-rail a:hover{ background: rgba(184,134,59,.75); width: 30px; }
.cpx-rail a.on{ background: var(--brass); width: 34px; }
.cpx-rail a span{
  position: absolute; left: 42px; top: 50%; transform: translateY(-50%) translateX(-6px);
  white-space: nowrap; font-family:"Space Mono",monospace; font-size: 11px;
  letter-spacing: .04em; color: var(--deep); background: rgba(255,255,255,.94);
  border: 1px solid var(--paper-2); border-radius: 5px; padding: 4px 9px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 22px -18px rgba(11,49,56,.7);
}
.cpx-rail a:hover span, .cpx-rail a:focus-visible span{ opacity: 1; transform: translateY(-50%) translateX(0); }

/* ---------- 8. Widget micro-interactions ---------------------------------- */
.sjx-seg button{ transition: background .18s ease, color .18s ease, transform .12s ease; }
.sjx-seg button:active{ transform: scale(.97); }
.sjx-out{ transition: box-shadow .3s ease; }
.sjx-out-big{ transition: opacity .25s ease; }
.sjx-out-big.cpx-swap{ opacity: 0; }
.sjx-verdict{ animation: cpx-rise .34s cubic-bezier(.2,.7,.2,1) both; }
@keyframes cpx-rise{ from{ opacity:0; transform: translateY(6px) } to{ opacity:1; transform:none } }

/* ---------- 9. Chart polish ----------------------------------------------- */
.cchart{ border-radius: 10px; }
.cchart-bar{ box-shadow: inset 0 -1px 0 rgba(0,0,0,.10); }
.cchart-row:hover .cchart-lbl{ color: var(--deep); }
.cchart-lbl{ transition: color .18s ease; }

/* ---------- 10. Links in prose -------------------------------------------- */
.prose a, main > section > p a, .lede a, .callout a, .card p a{
  background-image: linear-gradient(var(--brass), var(--brass));
  background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .2s ease, color .2s ease;
  text-decoration: none;
}
.prose a:hover, main > section > p a:hover, .lede a:hover, .callout a:hover, .card p a:hover{
  background-size: 100% 2px; color: var(--deep);
}

/* ---------- 11. Focus visibility (accessibility) -------------------------- */
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible{
  outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 3px;
}

/* ---------- 12. Reduced motion & print ------------------------------------ */
@media (prefers-reduced-motion: reduce){
  .cpx-r{ opacity: 1 !important; transform: none !important; transition: none !important; }
  .stats.cpx-in .stat::after{ transition: none; }
  .card, .card:hover{ transition: none; transform: none; }
  .sjx-verdict{ animation: none; }
  .cpx-rail a{ transition: none; }
}
@media print{
  .cpx-rail{ display: none !important; }
  .cpx-r{ opacity: 1 !important; transform: none !important; }
}
