/* Chinese Econ JMC — statistics page. Shares tokens and layout with style.css.
   Report style: numbered figures with notes underneath, serif titles and figures, hairline rules. */
:root {
  /* placement categories: validated as a set (adjacent CVD and normal-vision separation, 3:1 vs surface) */
  --s-fac: #31609a;   /* navy */
  --s-pd: #c4892d;    /* ochre */
  --s-ind: #b04a3a;   /* brick */
  --s-def: #a8a29e;
  --s-unk: #e7e5e4;
  --on-fac: #ffffff; --on-pd: #1c1917; --on-ind: #ffffff;
  --rule: #d6d3d1;
  --serif: "Source Serif 4", "Source Serif Pro", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-fac: #5b8ac4; --s-pd: #bb8a28; --s-ind: #b14735; --s-def: #78716c; --s-unk: #3a332e;
    --on-fac: #0b0b0b; --on-pd: #0b0b0b; --on-ind: #ffffff;
    --rule: #4a423c;
  }
}
:root[data-theme="dark"] {
    --s-fac: #5b8ac4; --s-pd: #bb8a28; --s-ind: #b14735; --s-def: #78716c; --s-unk: #3a332e;
    --on-fac: #0b0b0b; --on-pd: #0b0b0b; --on-ind: #ffffff;
    --rule: #4a423c;
  }

.viz { padding-top: 20px; max-width: 1160px; }
.viz h2, .fig-head h3 { font-family: var(--serif); font-variant-numeric: lining-nums; }
.empty-note { color: var(--muted); font-size: 14px; margin: 6px 0; }
.note.small { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.k-fac { background: var(--s-fac); }
/* non-tenure-track: same navy as faculty, hatched (texture, not a new hue) */
.k-ntt { background: repeating-linear-gradient(135deg, var(--s-fac) 0 2px, color-mix(in oklab, var(--s-fac) 28%, var(--panel)) 2px 6px); }
.k-pd { background: var(--s-pd); }
.k-ind { background: var(--s-ind); }
.k-def { background: var(--s-def); }
.k-unk { background: var(--s-unk); }
/* neutral bars for head counts that are not a placement category */
.k-neu { background: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* selection row */
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.lede { margin: 0; color: var(--muted); font-size: 14px; }
.lede b { color: var(--text); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 18px; padding: 2px; background: var(--panel); }
.seg button { font: inherit; font-size: 13px; border: none; background: none; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* key findings: a ruled band, not cards */
.findings { border-top: 2px solid var(--text); border-bottom: 1px solid var(--rule); padding: 12px 0 16px; margin-bottom: 24px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; font-family: inherit !important; }
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fact { padding: 2px 20px; border-left: 1px solid var(--rule); }
.fact:first-child { border-left: none; padding-left: 0; }
.fact .big { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.fact .what { font-size: 14px; margin-top: 6px; }
.fact .how { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* figures: report layout, no cards */
.fig { margin: 0; padding: 26px 0 8px; border-top: 1px solid var(--line); min-width: 0; }
.part-head + .fig, .part-head + .two-col > .fig { border-top: none; padding-top: 18px; }
.fig-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.fig-no { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; }
.fig-head h3 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.45; }
.fig-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; max-width: 62em; }

/* fig 1: 100% stacked bars with direct labels */
.mix-row { display: grid; grid-template-columns: 7em 1fr; gap: 14px; align-items: center; margin-bottom: 10px; }
.mix-label b { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mix-label span { color: var(--muted); font-size: 12px; }
.stack { display: flex; gap: 2px; height: 26px; border-radius: 4px; overflow: hidden; }
.stack > span { min-width: 2px; flex-basis: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; font-size: 12px; }
.stack > span b { font-weight: 600; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stack > .k-fac b { color: var(--on-fac); }
.stack > .k-pd b { color: var(--on-pd); }
.stack > .k-ind b { color: var(--on-ind); }
.stack > .k-def b, .stack > .k-unk b { color: var(--text); }
.stack > .k-ntt b { display: none; }
.stack > span:hover { filter: brightness(1.08); }

/* bar lists: rate charts get a percent axis, count charts are direct-labeled */
.bars { display: grid; gap: 0; }
.b-row { display: grid; grid-template-columns: 9.5em 1fr 4.8em; gap: 12px; align-items: center; padding: 3px 4px; border-radius: 3px; font-size: 13px; }
.bars.wide .b-row { grid-template-columns: 13.5em 1fr 4.8em; }
.b-row:not(.b-key):not(.b-axis):hover { background: var(--tag); }
.b-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-label em { font-style: normal; color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.b-track { position: relative; height: 18px; display: flex; align-items: center; }
.fill { position: relative; z-index: 1; display: block; height: 10px; min-width: 2px; border-radius: 0 4px 4px 0; }
.b-track .g { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.b-track .g:first-child { background: var(--rule); }
.b-row.thin .fill { opacity: .45; }
.b-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-val em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 5px; }
.ref { position: absolute; top: -3px; bottom: -3px; z-index: 2; border-left: 1.5px dashed var(--text); opacity: .55; }
.b-key, .b-axis { padding-top: 0; padding-bottom: 0; }
.b-key .b-track, .b-axis .b-track { height: 16px; }
.ref-label { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--text); opacity: .75; white-space: nowrap; }
.b-axis .tick { top: 2px; }
.b-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.b-group:first-child { border-top: none; margin-top: 0; padding-top: 0; }

/* fig 2: dumbbell, one row per region, one dot per cycle */
.db-row { display: grid; grid-template-columns: 7.5em 1fr 3em; gap: 12px; align-items: center; padding: 4px; border-radius: 3px; font-size: 13px; }
.db-row:not(.axis):hover { background: var(--tag); }
.db-track { position: relative; height: 18px; }
.db-track .grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.db-track .grid:first-child { background: var(--rule); }
.db-track .span { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--s-def); }
.db-track .dot, .legend .dot { width: 11px; height: 11px; border-radius: 50%; }
.db-track .dot { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.dot.now { background: var(--s-fac); box-shadow: 0 0 0 2px var(--panel); }
.dot.then { background: var(--panel); border: 2px solid var(--s-def); }
.legend .dot { display: inline-block; margin-right: 6px; vertical-align: -1px; }
.db-row .b-val { font-variant-numeric: tabular-nums; }
.db-row.axis { padding-top: 0; }
.db-row.axis .db-track { height: 14px; }
.tick { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.split { display: grid; grid-template-columns: 1fr; gap: 18px; }
.split.two { grid-template-columns: 1fr 1.3fr; gap: 36px; }

/* fig 5: common field pairs */
.combo-row { display: grid; grid-template-columns: 15em 1fr 4.8em; gap: 12px; align-items: center; padding: 4px; border-radius: 3px; font-size: 13px; }
.combo-row:hover { background: var(--tag); }
.stack.thin-stack { height: 14px; }
.combo-row .none { color: var(--muted); font-size: 12px; }
.sub-col h3 { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; border-top: 1px solid var(--line); }
.part-head + .two-col { border-top: none; }
.two-col > .fig { border-top: none; display: flex; flex-direction: column; position: relative; }
.two-col > .fig .fig-note { margin-top: auto; padding-top: 14px; }
.two-col > .fig + .fig::before { content: ""; position: absolute; left: -32px; top: 26px; bottom: 8px; width: 1px; background: var(--line); }

/* methods */
.method { border-top: 2px solid var(--text); margin-top: 30px; padding-top: 12px; }
.method h2 { font-size: 17.5px; font-weight: 600; margin: 0 0 12px; }
.method dl { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px 18px; margin: 0; font-size: 13.5px; line-height: 1.7; }
.method dt { font-weight: 600; }
.method dd { margin: 0; color: var(--text); }
.method code { font-size: 12px; background: var(--tag); padding: 1px 4px; border-radius: 3px; }

.tip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.5; padding: 7px 10px; border-radius: 5px; max-width: 280px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .two-col, .split, .split.two { grid-template-columns: 1fr; }
  .combo-row { grid-template-columns: 11em 1fr 4.4em; }
  .mix-row { grid-template-columns: 5.5em 1fr; }
  .b-row, .bars.wide .b-row { grid-template-columns: 9.5em 1fr 4.4em; }
  .two-col > .fig + .fig::before { display: none; }
  .two-col > .fig + .fig { border-top: 1px solid var(--line); }
  .part-head h2 { font-size: 20px; }
  .fact { border-left: none; padding: 8px 0; border-top: 1px solid var(--rule); }
  .fact:first-child { border-top: none; }
  .fact .big { font-size: 28px; }
  .method dl { grid-template-columns: 1fr; gap: 2px; }
  .method dd { margin-bottom: 8px; }
}

/* ---- SVG charts (fig 2 sankey, fig 5 funnel) ---- */
svg.chart { display: block; width: 100%; height: auto; min-width: 640px; font-family: inherit; }
svg.chart text { font-family: inherit; }
svg .ax { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
svg .ax-title { font-size: 12.5px; }
svg .ax-cy { fill: var(--text); font-weight: 600; font-size: 13px; }
svg .gl { stroke: var(--line); stroke-width: 1; }

/* sankey */
.sk-link { opacity: .32; transition: opacity .15s; }
.sk-link:hover { opacity: .62; }
.sk-fac { fill: var(--s-fac); }
.sk-ntt { fill: url(#hatch-ntt); }
.sk-pd { fill: var(--s-pd); }
.sk-ind { fill: var(--s-ind); }
.sk-node.sk-ntt { opacity: 1; }
.sk-right { fill: var(--s-def); }
.hatch-bg { fill: color-mix(in oklab, var(--s-fac) 28%, var(--panel)); }
.hatch-fg { fill: var(--s-fac); }
.sk-label { fill: var(--text); font-size: 13px; }
.sk-n { fill: var(--muted); font-variant-numeric: tabular-nums; }
.sk-head { fill: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }

/* funnel */
.fn-band { fill: var(--s-fac); opacity: .08; }
.fn-edge { fill: none; stroke: var(--s-fac); stroke-width: 1; opacity: .35; }
.fn-mean { stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .55; }
.fn-mean-l { fill: var(--text); opacity: .7; font-size: 12px; }
.fn-pt { fill: var(--panel); stroke: var(--s-fac); stroke-width: 1.8; }
.fn-pt.sig { fill: var(--s-fac); }
.fn-pt:hover { stroke-width: 3; }
.fn-label { fill: var(--text); font-size: 12.5px; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.fn-label.sig { font-weight: 600; }
.legend .dot.fn-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.8px solid var(--s-fac); background: var(--panel); margin-right: 6px; vertical-align: -1px; }
.legend .dot.fn-key.sig { background: var(--s-fac); }
.sw.fn-key-band { background: color-mix(in oklab, var(--s-fac) 14%, var(--panel)); border: 1px solid color-mix(in oklab, var(--s-fac) 40%, var(--panel)); }

/* fig 6: co-occurrence matrix */
table.cooc th, table.cooc td { border: none; padding: 0; vertical-align: middle; background: none; }
table.cooc { width: auto; border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; margin: 0 auto; }
table.cooc th.rh { text-align: right; font-weight: 500; padding: 0 8px 0 0; white-space: nowrap; color: var(--text); }
table.cooc th.ch { height: 64px; vertical-align: bottom; padding: 0 0 4px; font-weight: 500; color: var(--muted); }
table.cooc th.ch span { display: inline-block; transform: rotate(-50deg); transform-origin: left bottom; white-space: nowrap; margin-left: 14px; }
table.cooc td { width: 38px; height: 28px; text-align: center; border-radius: 3px; }
table.cooc td.cell { background: color-mix(in oklab, var(--s-fac) var(--a), var(--panel)); color: var(--text); }
table.cooc td.cell.hot { color: #fff; }
table.cooc td.cell:hover { outline: 2px solid var(--text); }
table.cooc td.diag { background: var(--tag); color: var(--muted); font-weight: 600; }
table.cooc td.z { background: color-mix(in oklab, var(--line) 35%, var(--panel)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) table.cooc td.cell.hot { color: #0b0b0b; }
}
:root[data-theme="dark"] table.cooc td.cell.hot { color: #0b0b0b; }


/* ---- report page shell ---- */
/* stats.css is only loaded on the report page, so the whole canvas can be white */
html, body.report-page { background: var(--panel); }
.viz.report { max-width: 1100px; padding-bottom: 20px; }
.toc { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 10px 0; margin: 0 0 8px;
  background: color-mix(in oklab, var(--panel) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: 13px; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a b { font-family: var(--serif); font-weight: 600; color: var(--text); margin-right: 6px; }
.part { margin-top: 40px; scroll-margin-top: 52px; }
.part-head { display: flex; align-items: baseline; gap: 18px; border-top: 2px solid var(--text); padding-top: 14px; }
.part-no { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; color: var(--s-fac); min-width: 1.2em; }
.part-head h2 { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: .01em; }
.part-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.method { scroll-margin-top: 52px; margin-top: 48px; }
.findings { margin-bottom: 18px; }

/* industry-toned funnel (fig 7) */
svg.funnel.tone-ind .fn-band { fill: var(--s-ind); }
svg.funnel.tone-ind .fn-edge { stroke: var(--s-ind); }
svg.funnel.tone-ind .fn-pt { stroke: var(--s-ind); }
svg.funnel.tone-ind .fn-pt.sig { fill: var(--s-ind); }
.legend .dot.fn-key.tone-ind { border-color: var(--s-ind); }
.legend .dot.fn-key.sig.tone-ind { background: var(--s-ind); }
.sw.fn-key-band.tone-ind { background: color-mix(in oklab, var(--s-ind) 14%, var(--panel)); border-color: color-mix(in oklab, var(--s-ind) 40%, var(--panel)); }

.fn-lead { stroke: var(--muted); stroke-width: .8; opacity: .55; }

/* academia / industry toggle in figure headers */
.fig-head h3 { flex: 1 1 auto; min-width: 0; }
.fig-toggle { margin-left: 12px; align-self: flex-start; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; flex: none; }
.fig-toggle button { font: inherit; font-size: 12.5px; border: none; background: none; color: var(--muted); padding: 3px 12px; border-radius: 999px; cursor: pointer; }
.fig-toggle button:hover { color: var(--text); }
.fig-toggle button.active { color: #fff; font-weight: 600; }
.fig-toggle button.active.acad { background: var(--s-fac); }
.fig-toggle button.active.ind { background: var(--s-ind); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fig-toggle button.active.acad { color: #0b0b0b; }
}
:root[data-theme="dark"] .fig-toggle button.active.acad { color: #0b0b0b; }
.tone-ind .dot.now { background: var(--s-ind); }
