/* assets/styles.css — executive/ministerial presentation styling.
   Tablet-first: 48px+ touch targets, high contrast, CSS-variable theming. */

:root[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-card: #ffffff;
  --ink: #16213a;
  --ink-soft: #5a6478;
  --line: #e3e7f0;
  --accent: #7c3aed;
  --accent-2: #b45309;
  --gold: #b4881b;
  --good: #0e7a4a;
  --chart-grid: rgba(22, 33, 58, .08);
  --chip: #eef0f7;
  --shadow: 0 1px 2px rgba(22,33,58,.05), 0 8px 24px rgba(22,33,58,.07);
}
:root[data-theme="dark"] {
  --bg: #0d1220;
  --bg-card: #151d31;
  --ink: #e8ecf6;
  --ink-soft: #9aa5bd;
  --line: #263149;
  --accent: #a78bfa;
  --accent-2: #f0b429;
  --gold: #e9c25c;
  --good: #34c98e;
  --chart-grid: rgba(232, 236, 246, .09);
  --chip: #1f2941;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.45);
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  transition: background .25s, color .25s;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  min-height: 62px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand-title { font-weight: 800; font-size: 1.02rem; line-height: 1.15; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; color: var(--ink-soft); }
.brand-gem { font-size: 1.6rem; filter: saturate(1.2); }
.btn-nav {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .8rem;
  border-radius: 10px; color: var(--ink-soft); font-weight: 600; font-size: .86rem;
  text-decoration: none; transition: .15s;
}
.btn-nav:hover, .btn-nav.active { color: var(--ink); background: var(--chip); }
.btn-icon {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-card); font-size: 1.1rem; line-height: 1;
}
/* nav links: inline children of the topbar on desktop, dropdown under the
   hamburger below 992px (display:contents keeps desktop flex layout intact) */
.nav-links { display: contents; }
.nav-toggle { display: none; }
@media (max-width: 991.98px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
  }
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--bg-card); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); padding: .6rem .9rem .9rem;
  }
  .topbar.nav-open .nav-links { display: flex; }
  .nav-links .btn-nav { min-height: 48px; font-size: .95rem; padding: 0 .8rem; }
  .brand { min-width: 0; }
  .brand-title { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- modules ---------- */
.module { margin-bottom: 1.5rem; scroll-margin-top: 84px; }
.module-head { margin-bottom: .8rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.module-head > div:not(.seg), .module-head h2 { margin-bottom: 0; }
.module-head .module-sub { width: 100%; margin-bottom: 0; }
.module-head h2 { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.module-sub { color: var(--ink-soft); font-size: .88rem; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem 1.1rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--accent), var(--gold)); }
.kpi-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.kpi-value { font-size: 2.05rem; font-weight: 800; letter-spacing: -.03em; margin: .18rem 0; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: .74rem; color: var(--ink-soft); }
.kpi-alert { border-color: rgba(219,39,119,.35); background: color-mix(in srgb, #db2777 7%, var(--bg-card)); }
.kpi-alert::before { background: linear-gradient(180deg, #db2777, #9f1239); }
.kpi-alert .kpi-value { color: #db2777; }
:root[data-theme="dark"] .kpi-alert .kpi-value { color: #f472b6; }

/* ---------- panels ---------- */
.card-panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  padding: .9rem 1rem; box-shadow: var(--shadow);
}
.panel-title { font-weight: 800; font-size: .93rem; margin-bottom: .5rem; letter-spacing: -.01em; }
.panel-sub { font-size: .78rem; color: var(--ink-soft); margin: -.35rem 0 .5rem; }
.chart-box { position: relative; height: 250px; }
.chart-box.tall { height: 320px; }
.badge-est {
  display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  border-radius: 999px; padding: .12rem .5rem; vertical-align: middle; margin-left: .35rem;
}

/* ---------- points / context ---------- */
.points { margin: 0; padding-left: 1.1rem; display: grid; gap: .55rem; font-size: .92rem; }
.points li::marker { color: var(--gold); }
.ctx-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.ctx-row:last-child { border-bottom: 0; }
.ctx-row span { color: var(--ink-soft); }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 4px; gap: 4px; }
.seg-btn {
  border: 0; background: transparent; min-height: 44px; padding: 0 1rem; border-radius: 9px;
  font-weight: 700; font-size: .85rem; color: var(--ink-soft);
}
.seg-btn.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- preset buttons ---------- */
.preset-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.preset {
  min-height: 52px; padding: 0 1.2rem; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--bg-card); color: var(--ink); font-weight: 800; font-size: .95rem;
  box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.preset:active { transform: scale(.97); }
.preset.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-card)); }
.metric-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .8rem; }
.chip {
  min-height: 44px; padding: 0 .95rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink-soft); font-weight: 700; font-size: .82rem;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .chip.active { color: #0d1220; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .55rem .6rem; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.badge-g { display:inline-block; padding:.1rem .55rem; border-radius:999px; font-size:.72rem; font-weight:700; background: var(--chip); color: var(--ink-soft); }

/* ---------- calculator ---------- */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 991px) { .calc-grid { grid-template-columns: 1fr; } }
.calc-panel { text-align: center; }
.calc-q { font-size: .95rem; color: var(--ink-soft); }
.calc-big { font-size: 3.6rem; font-weight: 800; color: var(--accent); letter-spacing: -.03em; line-height: 1.1; }
.calc-big span { font-size: 1.8rem; }
.calc-slider { width: 100%; max-width: 420px; height: 44px; margin: .3rem auto; accent-color: var(--accent); }
.calc-minmax { display: flex; justify-content: space-between; max-width: 420px; margin: 0 auto; font-size: .78rem; color: var(--ink-soft); }
.calc-result { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--good); font-variant-numeric: tabular-nums; }
.calc-sub { font-size: .9rem; color: var(--ink-soft); }
.calc-sub2 { font-size: .8rem; color: var(--ink-soft); margin-top: .3rem; }
.calc-explain .cx-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.calc-explain .cx-row span { color: var(--ink-soft); }
.calc-explain .cx-row.hl b { color: var(--good); font-size: 1.05rem; }

/* ---------- misc ---------- */
.agg-note { font-size: .78rem; color: var(--ink-soft); margin-top: .55rem; }
.mini-note { font-size: .82rem; color: var(--ink-soft); line-height: 1.55; margin: 0; }
.mini-note b { color: var(--ink); }
.badge-good {
  display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--good);
  border: 1px solid color-mix(in srgb, var(--good) 45%, transparent);
  border-radius: 999px; padding: .12rem .5rem; vertical-align: middle; margin-left: .35rem;
}
.kpi-xb {
  font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  border-radius: 6px; padding: .06rem .32rem; vertical-align: middle; margin-left: .28rem;
}
.fit-pill { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.fit-pu { background: rgba(14,122,74,.14); color: var(--good); }
.fit-p  { background: rgba(37,99,235,.12); color: #2563eb; }
.fit-w  { background: rgba(219,39,119,.12); color: #db2777; }
.fit-n  { background: rgba(154,165,189,.2); color: var(--ink-soft); }
.footnote-line { font-size: .74rem; color: var(--ink-soft); margin: .35rem 0 0; }
/* comparables as table cells */
.hs-tbl { display: table; width: 100%; border-collapse: collapse; }
.hs-tr { display: table-row; }
.hs-tr:nth-child(1) .hs-td { border-top: 1px solid var(--line); }
.hs-td { display: table-cell; padding: .55rem .6rem .35rem 0; vertical-align: baseline; font-size: .88rem; border-bottom: 1px solid var(--line); }
.hs-td:first-child { font-weight: 700; white-space: nowrap; }
.hs-num { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-src { color: var(--ink-soft); font-size: .72rem; text-align: right; }
.hs-tsc2 { font-size: .78rem; color: var(--ink-soft); padding-top: 0; }
.hs-tsc2 b { color: var(--accent-2); font-size: .92rem; }
.hs-tr:last-child .hs-td { border-bottom: 0; }

/* full-width brief CTA */
.brief-cta {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 58px; margin: 0 0 1.5rem; padding: 0 1rem;
  background: linear-gradient(135deg, var(--accent), #4c1d95);
  color: #fff; font-weight: 800; font-size: 1.02rem; text-decoration: none;
  border-radius: 16px; box-shadow: var(--shadow); transition: transform .12s;
}
.brief-cta:hover { color: #fff; transform: translateY(-1px); }

/* info icon + tooltip (no layout shift; tooltip floats, clamped to card) */
.ii {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; margin-left: .3rem;
  background: var(--chip); color: var(--ink-soft); font: 700 .68rem/1 'Manrope', sans-serif;
  cursor: help; position: relative; vertical-align: middle; user-select: none;
}
.ii::before { content: none; }
.ii .tip, .ii[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: 240px; max-width: 60vw; padding: .55rem .7rem; border-radius: 10px;
  background: var(--ink); color: var(--bg-card); font: 400 .74rem/1.45 'Manrope', sans-serif;
  text-align: left; box-shadow: var(--shadow); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.ii[data-tip]::before {
  content: ''; position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink); z-index: 40;
  opacity: 0; transition: opacity .15s;
}
.ii:hover::after, .ii:focus::after, .ii:hover::before, .ii:focus::before { opacity: 1; }
@media (hover: none) { .ii[data-tip]::after { width: 200px; } }
/* phones: right-anchor tooltips so they never push past the viewport edge */
@media (max-width: 768px) {
  .ii[data-tip]::after { left: auto; right: -6px; transform: none; width: 200px; max-width: 60vw; }
  .ii[data-tip]::before { left: auto; right: 11px; transform: none; }
}
/* any residual wide chart/table clips instead of panning the page */
main.container-xxl { overflow-x: clip; }

/* need-vs-framework example rows */
.need-grid { display: grid; gap: .5rem; }
.need-row { display: grid; grid-template-columns: 1fr 22px 1fr; gap: .5rem; align-items: stretch; font-size: .82rem; }
.need-row .n { background: rgba(124,58,237,.08); border: 1px solid rgba(124,58,237,.22); border-radius: 10px; padding: .45rem .6rem; }
.need-row .f { background: rgba(234,88,12,.07); border: 1px solid rgba(234,88,12,.22); border-radius: 10px; padding: .45rem .6rem; color: var(--ink-soft); }
.need-row .arrow { align-self: center; text-align: center; color: var(--ink-soft); font-weight: 800; }
.need-row b { color: var(--ink); }

/* the twenty proposed skills */
.proposed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .5rem; }
.proposed-track {
  grid-column: 1 / -1; font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent-2); margin-top: .55rem;
}
.proposed-track:first-child { margin-top: 0; }
.proposed-skill {
  background: var(--chip); border: 1px solid var(--line); border-radius: 10px;
  padding: .55rem .7rem; font-size: .78rem; color: var(--ink-soft); line-height: 1.45;
}
.proposed-skill b { display: block; color: var(--ink); font-size: .8rem; margin-bottom: .15rem; padding-right: 3.4rem; }
.proposed-skill .pl { float: right; font-size: .66rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.foot { padding: 1.2rem 1rem 2rem; text-align: center; color: var(--ink-soft); font-size: .78rem; }
.foot a { color: var(--accent); }
.src-block { margin-bottom: .9rem; }
.src-block h4 { font-size: .88rem; font-weight: 800; }
.src-block p { font-size: .8rem; color: var(--ink-soft); margin: 0; }
.loading { opacity: .45; transition: .3s; pointer-events: none; }

/* tablet tweaks */
@media (max-width: 768px) {
  .kpi-value { font-size: 1.7rem; }
  .chart-box, .chart-box.tall { height: 260px; }
  .brand-sub { display: none; }
  .calc-big { font-size: 2.6rem; }
  .calc-result { font-size: 1.7rem; }
}
/* phones: comparable-scale rows stack so nothing overflows the viewport */
@media (max-width: 576px) {
  .hs-tr { display: block; }
  .hs-td { display: block; width: 100%; border-bottom: 0 !important; padding: .12rem 0; }
  .hs-td:first-child { font-size: .95rem; margin-top: .35rem; }
  .hs-num { font-size: 1.05rem; }
  .hs-src { text-align: left; }
}
@media print {
  .topbar, .preset-row, .foot { display: none; }
  .card-panel { box-shadow: none; }
}
