/* Work Sans (OFL-1.1, self-hosted — see OFL-WorkSans.txt). Chosen as a free,
   metric-friendly alternative to Proxima Nova (used by royalsocietypublishing.org).
   Variable weight 400-800 covers body copy through the boldest KPI numbers. */
@font-face{font-family:"Work Sans";font-style:normal;font-weight:400 800;font-display:swap;src:url("./work-sans-latin.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Work Sans";font-style:normal;font-weight:400 800;font-display:swap;src:url("./work-sans-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}

:root{color-scheme:light;--bg:#f6f7f7;--surface:#ffffff;--surface-alt:#eef3f3;--ink:#17282c;--muted:#58696e;--line:#d9e2e2;--primary:#00646e;--primary-soft:#e4f0f1;--accent:#0e7c88;--teal:#00646e;--teal-soft:#e4f0f1;--amber:#b88714;--amber-soft:#f6edd6;--red:#c2402a;--red-soft:#fae7e2;--blue:#0e7c88;--blue-soft:#e2f2f4;--shadow:0 1px 3px rgba(23,40,44,0.07),0 10px 24px rgba(23,40,44,0.05)}*{box-sizing:border-box}html{min-width:0}body{margin:0;background:var(--bg);color:var(--ink);font-family:Rubik,"Space Grotesk",Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,select,input{font:inherit}.app-header{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;padding:24px clamp(18px,4vw,48px) 18px;border-top:4px solid var(--primary);border-bottom:1px solid var(--line);background:var(--surface)}.app-header>div{min-width:0}.brand-block{display:flex;align-items:center;gap:14px;min-width:0}.brand-home{color:inherit;text-decoration:none}.brand-home:focus-visible{border-radius:8px;outline:3px solid rgba(194,64,42,0.18);outline-offset:4px}.brand-copy{min-width:0}.brand-mark{display:grid;flex:0 0 auto;place-items:center;width:108px;min-height:72px;border:1px solid rgba(0,100,110,0.18);border-radius:8px;background:linear-gradient(135deg,rgba(228,240,241,0.92),#ffffff 62%),var(--surface);box-shadow:inset 0 0 0 1px rgba(255,255,255,0.72),0 10px 24px rgba(0,100,110,0.12);color:var(--primary);padding:8px 10px 9px}.brand-mark-text{display:flex;align-items:baseline;gap:0;font-size:1rem;font-weight:800;letter-spacing:0;line-height:1}.brand-mark-text strong{color:var(--red);font-size:1em;line-height:1}.brand-beat{display:block;width:84px;height:34px;margin-bottom:5px;overflow:visible}.brand-headband,.brand-earcup,.brand-beat-wave{fill:none;stroke-linecap:round;stroke-linejoin:round}.brand-headband{stroke:var(--primary);stroke-width:2.8}.brand-earcup{fill:var(--primary);stroke:var(--primary);stroke-width:2.4}.brand-beat-wave{stroke:var(--red);stroke-width:2.3;opacity:0.94}.eyebrow{margin:0 0 6px;color:var(--primary);font-size:0.8rem;font-weight:700;letter-spacing:0;text-transform:uppercase}h1,h2{margin:0;letter-spacing:0}h1{color:var(--ink);font-size:1.45rem;font-weight:700;line-height:1.1}h2{font-size:1rem;line-height:1.25}.header-meta{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;color:var(--muted);font-size:0.9rem;min-width:0}.meta-pill{border:1px solid var(--line);border-radius:999px;padding:6px 10px;background:var(--primary-soft);color:var(--primary);font-weight:700;max-width:100%;overflow-wrap:anywhere}.header-action{min-height:32px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--primary);cursor:pointer;font-size:0.82rem;font-weight:800;padding:6px 10px}.header-action:hover,.header-action:focus-visible{border-color:var(--primary);background:var(--primary-soft);outline:none}.copy-status{align-self:center;color:var(--muted);font-size:0.82rem;font-weight:700;min-width:0}main{display:grid;gap:18px;padding:18px clamp(14px,4vw,48px) 36px}.readme-panel{border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:0 8px 20px rgba(23,40,44,0.06)}.readme-details{color:var(--ink)}.readme-details summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:46px;padding:12px 16px;color:var(--primary);font-weight:800;cursor:pointer;list-style:none}.readme-details summary::-webkit-details-marker{display:none}.readme-details summary::after{content:"+";display:grid;flex:0 0 auto;place-items:center;width:24px;height:24px;border:1px solid var(--line);border-radius:999px;background:var(--primary-soft);color:var(--primary);font-size:1rem;line-height:1}.readme-details[open] summary{border-bottom:1px solid var(--line)}.readme-details[open] summary::after{content:"-"}.readme-details summary:focus-visible{outline:3px solid rgba(194,64,42,0.18);outline-offset:3px}.readme-content{padding:14px 16px 16px;color:var(--muted);line-height:1.55}.readme-content p{max-width:78ch;margin:0}.readme-content p+p{margin-top:10px}.control-band{display:grid;grid-template-columns:repeat(3,minmax(180px,1fr));gap:12px;align-items:end;padding:14px;border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:0 8px 20px rgba(23,40,44,0.06)}.field{display:grid;gap:6px;min-width:0}.field.compact{min-width:128px}label{color:var(--muted);font-size:0.76rem;font-weight:700;letter-spacing:0;text-transform:uppercase}select,input{width:100%;min-height:38px;border:1px solid var(--line);border-radius:6px;background:#fafcfc;color:var(--ink);padding:8px 10px}select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(14,124,136,0.12);outline:none}input{font-weight:700}.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}.kpi-card,.panel{border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:var(--shadow)}.kpi-card{display:grid;gap:6px;padding:16px}.kpi-label,.kpi-sub,.panel-heading span{color:var(--muted);font-size:0.82rem}.kpi-card strong{font-size:1.75rem;line-height:1}.threshold-card{align-content:start}.threshold-card input{max-width:120px}.tabs{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}.tab{min-height:38px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--primary);padding:8px 14px;font-weight:700;cursor:pointer}.tab.is-active{border-color:var(--primary);background:var(--primary);color:#ffffff}.tab-panel{display:none}.tab-panel.is-active{display:grid;gap:18px}.panel-grid{display:grid;gap:18px}.panel-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.panel{min-width:0;padding:16px}.panel.wide{width:100%}.panel-heading{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin-bottom:12px}.chart{min-height:320px;width:100%}.chart.tall{min-height:390px}svg{display:block;width:100%;height:auto}.axis text,.chart-label,.small-label{fill:var(--muted);font-size:12px}.chart-title{fill:var(--ink);font-size:13px;font-weight:700}.zero-line{stroke:#7d8c8f;stroke-dasharray:4 4}.table-wrap{width:100%;overflow-x:auto}table{width:100%;min-width:720px;border-collapse:collapse;font-size:0.9rem}th,td{border-bottom:1px solid var(--line);padding:10px 9px;text-align:right;white-space:nowrap}th:first-child,td:first-child{text-align:left}thead th{color:var(--muted);font-size:0.76rem;letter-spacing:0;text-transform:uppercase}tbody tr:hover{background:#f2f7f7}.effect-profile-details{display:grid;gap:14px}.effect-profile-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.effect-profile-card{display:grid;align-content:start;gap:14px;border:1px solid var(--line);border-top:4px solid var(--primary);border-radius:8px;padding:14px;background:#fafcfc}.effect-profile-card--reverse{border-top-color:var(--red)}.effect-profile-card--noEffect{border-top-color:var(--muted)}.effect-profile-card--positive{border-top-color:var(--primary)}.effect-profile-card header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.effect-profile-card header div{display:grid;gap:2px}.effect-profile-card header span,.effect-profile-card header small{color:var(--muted);font-size:0.78rem;font-weight:700}.effect-profile-card header strong{color:var(--ink);font-size:1.2rem}.effect-profile-section{display:grid;gap:7px}.effect-profile-section h3{margin:0;color:var(--ink);font-size:0.86rem}.effect-profile-mini-table{min-width:0}.effect-profile-mini-table td{padding:7px 0;vertical-align:top;white-space:normal}.effect-profile-mini-table td:first-child{width:42%}.effect-profile-mini-table td span{display:block;color:var(--muted);font-size:0.78rem;margin-top:2px}.effect-category-list{display:flex;flex-wrap:wrap;gap:5px}.effect-category-list span{display:inline-flex;margin:0;padding:3px 7px;border-radius:999px;background:var(--surface-alt);color:var(--ink);font-size:0.76rem;line-height:1.3}.heatmap{overflow-x:auto}.heatmap-grid{display:grid;gap:6px;min-width:420px}.heatmap-row{display:grid;grid-template-columns:minmax(190px,1.4fr) repeat(3,minmax(92px,1fr));gap:6px;align-items:stretch}.heatmap-head,.heatmap-label,.heatmap-cell{border-radius:6px;padding:9px}.heatmap-head{color:var(--muted);font-size:0.78rem;font-weight:700;text-align:center;text-transform:uppercase}.heatmap-label{display:flex;align-items:center;background:var(--surface-alt);font-size:0.86rem;font-weight:700;min-height:58px;white-space:normal}.heatmap-cell{display:grid;align-content:center;gap:2px;min-height:58px;border:1px solid rgba(23,40,44,0.08);text-align:center}.heatmap-value{font-size:1rem;font-weight:800}.heatmap-n{color:rgba(23,40,44,0.68);font-size:0.72rem}.profile-list{display:grid;gap:10px}.panel-note{margin:-6px 0 10px;color:var(--muted);font-size:0.84rem;line-height:1.45}.profile-card{display:grid;gap:5px;border:1px solid var(--line);border-left:5px solid var(--primary);border-radius:8px;padding:11px 12px;background:#fafcfc}.profile-card.negative{border-left-color:var(--red)}.profile-card.positive{border-left-color:var(--primary)}.profile-card strong{font-size:0.96rem}.profile-card span{color:var(--muted);font-size:0.82rem}.note{color:var(--muted);line-height:1.55}.note h2{color:var(--ink);margin-bottom:8px}.note p{margin:0}.latent-profiles-panel{display:grid;gap:14px}.latent-intro,.latent-method-note,.latent-classification-note{margin:0;color:var(--muted);line-height:1.55}.latent-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.latent-summary-card{display:grid;gap:5px;border:1px solid var(--line);border-left:4px solid var(--primary);border-radius:8px;background:#fafcfc;padding:12px 13px}.latent-summary-card span,.latent-summary-card small{color:var(--muted);font-size:0.78rem;font-weight:700}.latent-summary-card strong{color:var(--ink);font-size:1.2rem}.latent-shape{overflow-x:auto}.latent-shape-grid{display:grid;gap:6px;min-width:520px}.latent-shape-row{display:grid;grid-template-columns:minmax(170px,1.25fr) repeat(3,minmax(92px,1fr));gap:6px}.latent-shape-head{appearance:none;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--muted);cursor:pointer;font-size:0.78rem;font-weight:700;min-height:36px;padding:7px 6px;text-align:center;text-transform:uppercase}.latent-shape-head:hover,.latent-shape-head:focus-visible,.latent-shape-head.is-selected{border-color:rgba(0,100,110,0.18);background:var(--primary-soft);color:var(--primary);outline:none}.latent-shape-label,.latent-shape-cell{border-radius:6px;padding:9px}.latent-shape-label{display:flex;align-items:center;min-height:58px;background:var(--surface-alt);font-size:0.86rem;font-weight:700}.latent-shape-cell{appearance:none;display:grid;align-content:center;gap:2px;min-height:58px;border:1px solid rgba(23,40,44,0.08);color:var(--ink);cursor:pointer;text-align:center;width:100%}.latent-shape-cell:hover,.latent-shape-cell:focus-visible,.latent-shape-cell.is-selected{border-color:rgba(194,64,42,0.36);box-shadow:inset 0 0 0 2px rgba(194,64,42,0.18);outline:none}.latent-shape-cell strong{font-size:1rem}.latent-shape-cell span{color:rgba(23,40,44,0.68);font-size:0.72rem}.latent-profile-selector{display:grid;gap:12px}.latent-profile-selector-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.latent-profile-option{appearance:none;display:grid;gap:7px;border:1px solid var(--line);border-left:4px solid var(--profile-color,var(--primary));border-radius:8px;background:#fafcfc;color:var(--ink);cursor:pointer;padding:14px;text-align:left;transition:border-color 0.16s ease,box-shadow 0.16s ease,transform 0.16s ease}.latent-profile-option:hover,.latent-profile-option:focus-visible,.latent-profile-option.is-selected{border-color:rgba(0,100,110,0.34);box-shadow:0 10px 24px rgba(23,40,44,0.1);outline:none}.latent-profile-option.is-selected{background:var(--primary-soft)}.latent-profile-option span,.latent-profile-option small{color:var(--muted);font-size:0.78rem;font-weight:700}.latent-profile-option strong{color:var(--ink);font-size:1.04rem;line-height:1.3}.latent-delta-point{cursor:pointer;outline:none}.latent-delta-ring{fill:rgba(255,255,255,0);stroke:rgba(255,255,255,0);stroke-width:3}.latent-delta-point:hover .latent-delta-ring,.latent-delta-point:focus-visible .latent-delta-ring,.latent-delta-point.is-selected .latent-delta-ring{fill:rgba(194,64,42,0.08);stroke:rgba(194,64,42,0.6)}.latent-selected-profile{display:grid;gap:14px}.latent-selected-hero{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,0.85fr);gap:16px;border:1px solid var(--line);border-left:4px solid var(--profile-color,var(--primary));border-radius:8px;background:#fafcfc;padding:16px}.latent-selected-hero>div:first-child{display:grid;align-content:start;gap:5px}.latent-selected-hero span,.latent-selected-hero small,.latent-outcome-grid span,.latent-outcome-grid small{color:var(--muted);font-size:0.78rem;font-weight:700}.latent-selected-hero h3{margin:0;color:var(--ink);font-size:1.28rem}.latent-selected-hero p{margin:0;color:var(--muted);line-height:1.45}.latent-selected-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.latent-selected-stats div,.latent-outcome-grid div{display:grid;gap:3px;border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:11px}.latent-selected-stats strong,.latent-outcome-grid strong{color:var(--ink);font-size:1.18rem}.latent-selected-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(280px,0.85fr);gap:14px}.latent-selected-grid section{display:grid;align-content:start;gap:10px;border:1px solid var(--line);border-radius:8px;background:#fafcfc;padding:14px}.latent-selected-grid h3{margin:0;color:var(--ink);font-size:0.9rem}.latent-outcome-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.latent-mini-table th,.latent-mini-table td{padding:7px 8px;vertical-align:top;white-space:normal}.latent-mini-table th{color:var(--muted);font-size:0.75rem;text-align:left}.latent-mini-table td span{display:block;color:var(--muted);font-size:0.76rem;margin-top:2px}.latent-chip-list{display:flex;flex-wrap:wrap;gap:6px}.latent-chip-list span{display:inline-flex;border-radius:999px;background:var(--surface-alt);color:var(--ink);font-size:0.78rem;line-height:1.3;padding:4px 8px}.latent-model-table .selected-row{background:var(--primary-soft)}.latent-classification-note{border-top:1px solid var(--line);margin-top:10px;padding-top:10px;font-size:0.86rem}.empty-state{display:grid;place-items:center;min-height:160px;border:1px dashed var(--line);border-radius:8px;color:var(--muted);text-align:center}.cluster-profiles-panel{display:grid;gap:12px}.cluster-intro,.cluster-helper{margin:0;color:var(--muted);line-height:1.55}.cluster-controls{grid-template-columns:minmax(180px,1fr) minmax(150px,0.7fr);box-shadow:none}.cluster-workspace{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,0.85fr);gap:18px;align-items:stretch}.cluster-graph-panel,.cluster-detail-panel{display:grid;align-content:start}.cluster-graph-wrap{min-height:470px;overflow:hidden;border:1px solid var(--line);border-radius:8px;background-color:#fafcfc}.cluster-graph{display:block;width:100%;height:auto}.cluster-link{fill:none;stroke:rgba(0,100,110,0.56);stroke-linecap:round;stroke-linejoin:round}.cluster-label-line{stroke:rgba(88,105,110,0.38);stroke-dasharray:3 4;stroke-linecap:round}.cluster-node,.cluster-label-target{cursor:pointer;outline:none}.cluster-node circle:first-of-type{stroke:rgba(0,100,110,0.42);stroke-width:2;transition:stroke-width 0.15s ease,filter 0.15s ease,opacity 0.15s ease}.cluster-node:hover circle:first-of-type,.cluster-node:focus circle:first-of-type,.cluster-node--selected circle:first-of-type{filter:url(#cluster-glow);stroke:var(--primary);stroke-width:4}.cluster-node--suppressed circle:first-of-type{opacity:0.88}.cluster-label-box{fill:rgba(255,255,255,0.94);stroke:rgba(0,100,110,0.18);stroke-width:1}.cluster-label-target:hover .cluster-label-box,.cluster-label-target:focus .cluster-label-box,.cluster-label-target--selected .cluster-label-box{stroke:var(--primary);stroke-width:2}.cluster-node-initial{fill:#ffffff;font-size:15px;font-weight:800;pointer-events:none}.cluster-node-label{fill:var(--ink);font-size:13px;font-weight:800;pointer-events:none}.cluster-node-meta{fill:var(--muted);font-size:11px;pointer-events:none}.cluster-legend{display:flex;flex-wrap:wrap;gap:12px 18px;margin-top:12px;color:var(--muted);font-size:0.82rem}.cluster-legend span{display:inline-flex;align-items:center;gap:7px}.legend-dot{display:inline-block;width:12px;height:12px;border-radius:999px;border:1px solid rgba(23,40,44,0.24)}.legend-dot-negative{background:#c2402a}.legend-dot-positive{background:var(--primary)}.legend-dot-suppressed{border-style:dashed;background:#ffffff;box-shadow:inset 0 0 0 3px rgba(0,100,110,0.14)}.legend-line{display:inline-block;width:28px;height:3px;border-radius:99px;background:#93b8bd}.cluster-detail-summary{display:grid;gap:10px}.cluster-detail-summary>div,.cluster-detail-block{display:grid;gap:5px;border-bottom:1px solid var(--line);padding:0 0 12px}.cluster-detail-summary span,.cluster-detail-block span{color:var(--muted);font-size:0.82rem}.cluster-detail-summary strong{font-size:1.2rem}.cluster-detail-block{margin-top:14px}.cluster-detail-block h3{margin:0;color:var(--ink);font-size:0.9rem}.compact-table{min-width:0;font-size:0.84rem}.compact-table td{text-align:left;white-space:normal}.compact-table td:first-child{width:38%;color:var(--muted);font-weight:700}.cluster-warning{border:1px solid var(--amber-soft);border-left:4px solid var(--amber);border-radius:8px;margin-top:12px;padding:10px 12px;background:#fff9ed;color:#6b4e12;line-height:1.45}@media (max-width:980px){.app-header{align-items:flex-start;flex-direction:column}.header-meta{justify-content:flex-start}.control-band,.panel-grid.two{grid-template-columns:1fr 1fr}.effect-profile-card-grid{grid-template-columns:1fr}.latent-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.latent-profile-selector-grid,.latent-selected-hero,.latent-selected-grid{grid-template-columns:1fr}.cluster-controls,.cluster-workspace{grid-template-columns:1fr}.kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:640px){main{padding-inline:12px}.control-band,.panel-grid.two{grid-template-columns:1fr}.cluster-graph-wrap{min-height:340px}.kpi-grid{grid-template-columns:1fr}.latent-summary-grid{grid-template-columns:1fr}.latent-profile-selector-grid,.latent-selected-stats,.latent-outcome-grid{grid-template-columns:1fr}.panel-heading{align-items:flex-start;flex-direction:column}.chart,.chart.tall{min-height:280px}.heatmap-row{grid-template-columns:minmax(160px,1fr) repeat(3,minmax(82px,1fr))}.app-header{padding-inline:14px}.brand-block{align-items:flex-start;gap:10px}.brand-mark{width:92px;min-height:64px;padding-inline:8px}.brand-mark-text{font-size:0.9rem}.brand-beat{width:74px;height:30px}}


/* === Editorial refresh (2026-07): journal-style chrome, footer, typography === */
body{font-family:"Work Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
.skip-link{position:absolute;left:-9999px;top:0;z-index:50;background:var(--ink);color:#fff;padding:10px 16px;border-radius:0 0 6px 0;font-weight:700}
.skip-link:focus{left:0}
.top-strip{display:flex;flex-wrap:wrap;justify-content:space-between;gap:6px 18px;background:var(--ink);color:rgba(255,255,255,0.82);font-size:0.72rem;font-weight:700;letter-spacing:0.09em;text-transform:uppercase;padding:9px clamp(18px,4vw,48px)}
.top-strip a{color:rgba(255,255,255,0.82);text-decoration:none}
.top-strip a:hover,.top-strip a:focus-visible{color:#ffffff;text-decoration:underline;outline:none}
.app-header{border-top:4px solid var(--primary)}
.eyebrow{letter-spacing:0.08em;font-size:0.74rem;font-weight:800}
h1{font-size:1.45rem;letter-spacing:0}
@media (min-width:980px){h1{font-size:1.85rem}}
label,thead th,.heatmap-head,.latent-shape-head{letter-spacing:0.06em}
.kpi-label{font-size:0.72rem;font-weight:700;letter-spacing:0.06em;text-transform:uppercase}
.kpi-card strong,.heatmap-value,table,.latent-selected-stats strong,.latent-outcome-grid strong,.cluster-detail-summary strong{font-variant-numeric:tabular-nums}
.tabs{gap:2px;border-bottom:2px solid var(--line);padding-bottom:0}
.tab{border:0;border-bottom:3px solid transparent;border-radius:0;background:transparent;color:var(--muted);margin-bottom:-2px;padding:10px 15px;white-space:nowrap}
.tab:hover,.tab:focus-visible{color:var(--primary);border-bottom-color:var(--line);background:transparent;outline:none}
.tab.is-active{border-color:transparent;border-bottom-color:var(--primary);background:transparent;color:var(--primary)}
.readme-panel,.control-band{box-shadow:var(--shadow)}
/* Footer */
.site-footer{margin-top:6px;border-top:4px solid var(--primary);background:var(--surface)}
.footer-inner{display:grid;grid-template-columns:minmax(250px,330px) minmax(0,1fr);gap:30px clamp(24px,4vw,56px);padding:32px clamp(18px,4vw,48px) 28px;align-items:start}
.footer-brand{display:grid;gap:12px}
.footer-logo-link{display:inline-block;max-width:320px}
.footer-logo-link:focus-visible{outline:3px solid rgba(0,100,110,0.3);outline-offset:4px;border-radius:4px}
.footer-logo{display:block;width:100%;height:auto}
.footer-brand p{margin:0;color:var(--muted);font-size:0.85rem;line-height:1.55}
.footer-cols{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px clamp(18px,2.5vw,36px)}
.footer-cols section{display:grid;gap:8px;align-content:start}
.footer-cols h3{margin:0;color:var(--primary);font-size:0.74rem;font-weight:800;letter-spacing:0.08em;text-transform:uppercase}
.footer-cols p,.footer-cols li{margin:0;color:var(--muted);font-size:0.86rem;line-height:1.55}
.footer-cols ul{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.footer-cols a{color:var(--primary);font-weight:700;text-decoration:none}
.footer-cols a:hover,.footer-cols a:focus-visible{text-decoration:underline;outline:none}
.footer-bottom{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px 24px;padding:14px clamp(18px,4vw,48px);background:var(--ink);color:rgba(255,255,255,0.75);font-size:0.79rem}
.footer-bottom a{color:rgba(255,255,255,0.9);text-decoration:none}
.footer-bottom a:hover{text-decoration:underline}
.footer-analytics-settings{appearance:none;border:0;background:transparent;color:rgba(255,255,255,0.9);cursor:pointer;font:inherit;font-weight:700;padding:0;text-align:left}
.footer-analytics-settings:hover,.footer-analytics-settings:focus-visible{text-decoration:underline;outline:2px solid rgba(255,255,255,0.5);outline-offset:3px}
@media (max-width:980px){.footer-inner{grid-template-columns:1fr}.footer-cols{grid-template-columns:1fr 1fr}}
@media (max-width:640px){.footer-cols{grid-template-columns:1fr}.top-strip{font-size:0.66rem}}
/* Panel export tools (2026-07) */
.panel-tools{display:inline-flex;gap:6px;align-items:center;flex:0 0 auto}
.tool-btn{border:1px solid var(--line);border-radius:5px;background:var(--surface);color:var(--muted);cursor:pointer;font-size:0.68rem;font-weight:800;letter-spacing:0.06em;line-height:1.4;padding:3px 8px;text-transform:uppercase}
.tool-btn:hover,.tool-btn:focus-visible{border-color:var(--primary);background:var(--primary-soft);color:var(--primary);outline:none}
.tool-btn[disabled]{opacity:0.55;cursor:default}
.panel-heading.has-tools{justify-content:flex-start;flex-wrap:wrap}
.panel-heading.has-tools h2{margin-right:auto}
@media (max-width:640px){.panel-heading.has-tools h2{margin-right:0}}
/* === Cite & download dialog, footer citation, tour (2026-07) === */
.header-action--icon{min-width:32px;padding:6px 0;width:32px;text-align:center;font-size:0.95rem;line-height:1}
/* Footer "How to cite" */
.footer-citation{font-size:0.82rem;line-height:1.5;color:var(--muted)}
.footer-cite-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.footer-center-link{display:inline-block;margin-top:4px;color:var(--primary);font-weight:700;font-size:0.84rem;text-decoration:none}
.footer-center-link:hover,.footer-center-link:focus-visible{text-decoration:underline;outline:none}
/* Modal */
body.hx-modal-open{overflow:hidden}
.hx-backdrop{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(23,40,44,0.55)}
.hx-backdrop[hidden]{display:none}
.hx-dialog{width:min(560px,100%);max-height:90vh;overflow-y:auto;background:var(--surface);border:1px solid var(--line);border-top:4px solid var(--primary);border-radius:10px;box-shadow:0 24px 60px rgba(23,40,44,0.28);padding:20px 22px 22px}
.hx-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}
.hx-dialog-head h2{font-size:1.15rem;color:var(--ink)}
.hx-dialog-close{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:1.7rem;line-height:1;padding:0 4px}
.hx-dialog-close:hover,.hx-dialog-close:focus-visible{color:var(--ink);outline:none}
.hx-dialog-section{padding:14px 0;border-top:1px solid var(--line)}
.hx-dialog-section h3{margin:0 0 10px;color:var(--primary);font-size:0.78rem;font-weight:800;letter-spacing:0.07em;text-transform:uppercase}
.hx-cite-text{margin:0 0 12px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:var(--surface-alt);color:var(--ink);font-size:0.86rem;line-height:1.55}
.hx-btn-row{display:flex;flex-wrap:wrap;gap:8px}
.hx-note{margin:10px 0 0;color:var(--muted);font-size:0.8rem;line-height:1.45}
.hx-status{min-height:1.2em;margin:12px 0 0;color:var(--primary);font-size:0.82rem;font-weight:700}
/* Guided tour */
body.tour-active{overflow:hidden}
.tour-blocker{position:fixed;inset:0;z-index:1100;background:transparent;transition:background 0.2s ease}
.tour-blocker--dim{background:rgba(23,40,44,0.62)}
.tour-spotlight{position:fixed;z-index:1101;border-radius:10px;pointer-events:none;box-shadow:0 0 0 9999px rgba(23,40,44,0.62),0 0 0 2px var(--primary);transition:top 0.25s ease,left 0.25s ease,width 0.25s ease,height 0.25s ease}
.tour-card{position:fixed;z-index:1102;width:min(360px,calc(100vw - 24px));background:var(--surface);border:1px solid var(--line);border-top:4px solid var(--primary);border-radius:10px;box-shadow:0 20px 50px rgba(23,40,44,0.3);padding:16px 18px 14px}
.tour-progress{margin:0 0 6px;color:var(--muted);font-size:0.72rem;font-weight:800;letter-spacing:0.08em}
.tour-card h2{font-size:1.02rem;color:var(--ink);margin:0 0 6px;line-height:1.25}
.tour-card #tour-body{margin:0;color:var(--muted);font-size:0.88rem;line-height:1.55}
.tour-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px}
.tour-nav{display:flex;gap:8px}
.tour-skip{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:0.82rem;font-weight:700;padding:6px 2px}
.tour-skip:hover,.tour-skip:focus-visible{color:var(--ink);text-decoration:underline;outline:none}
.tour-primary{background:var(--primary);border-color:var(--primary);color:#fff}
.tour-primary:hover,.tour-primary:focus-visible{background:#00545d;border-color:#00545d;color:#fff}
.tour-back[disabled]{opacity:0.5;cursor:default}
@media (prefers-reduced-motion:reduce){.tour-spotlight{transition:none}}
@media (max-width:640px){.hx-btn-row .header-action{flex:1 1 auto}}
/* === Delta Distribution hover readout (2026-07) === */
.dd-guide{position:fixed;z-index:60;width:1px;background:rgba(23,40,44,0.32);pointer-events:none}
.dd-marker{position:fixed;z-index:61;width:11px;height:11px;margin:-6px 0 0 -6px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px rgba(23,40,44,0.28),0 1px 3px rgba(23,40,44,0.25);pointer-events:none}
.dd-tip{position:fixed;z-index:62;min-width:130px;max-width:230px;background:var(--surface);border:1px solid var(--line);border-radius:8px;box-shadow:0 12px 30px rgba(23,40,44,0.2);padding:9px 11px;pointer-events:none;font-size:0.82rem;color:var(--ink)}
.dd-tip-head{font-weight:800;font-size:0.8rem;letter-spacing:0.02em;margin-bottom:7px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.dd-tip-row{display:flex;align-items:center;gap:9px;line-height:1.7}
.dd-tip-row .sw{flex:0 0 auto;width:10px;height:10px;border-radius:2px}
.dd-tip-row .lb{color:var(--muted);margin-right:auto}
.dd-tip-row .ct{font-weight:800;font-variant-numeric:tabular-nums}
.dd-live,.dd-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
#distribution-chart{border-radius:8px;touch-action:pan-y}
#distribution-chart:focus{outline:none}
#distribution-chart:focus-visible{outline:3px solid rgba(0,100,110,0.35);outline-offset:4px}
/* === Audit fixes (2026-07): focus visibility, clip-safe tab indicator, tablet grid === */
/* Tabs: draw the active marker and focus ring INSIDE the box (overflow-x:auto forces
   overflow-y:auto, which would clip anything drawn below the padding box). */
.tab{margin-bottom:0}
.tab.is-active{border-bottom-color:transparent;box-shadow:inset 0 -3px 0 var(--primary)}
.tab:hover{color:var(--primary)}
.tab:focus-visible{outline:3px solid rgba(0,100,110,0.5);outline-offset:-3px;color:var(--primary)}
/* Distinct keyboard focus ring for actions/tools/close, not identical to hover. */
.header-action:focus-visible,.tool-btn:focus-visible,.hx-dialog-close:focus-visible,.footer-cite-copy:focus-visible,.footer-center-link:focus-visible{outline:3px solid rgba(0,100,110,0.5);outline-offset:2px}
.hx-dialog-close:focus-visible{border-radius:6px}
/* Tablet: keep effect-profile cards 2-up instead of collapsing straight to 1-up. */
@media (max-width:980px){.effect-profile-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.effect-profile-card-grid{grid-template-columns:1fr}}

/* === WCAG dark mode (2026-07): system preference + persisted manual toggle === */
:root{
  --chrome-bg:#17282c;
  --input-bg:#fafcfc;
  --surface-raised:#fafcfc;
  --row-hover:#f2f7f7;
  --chart-bg:#fafcfc;
  --chart-grid:#e6efef;
  --chart-axis:#bfced0;
  --focus-ring:rgba(0,100,110,0.5);
  --focus-warm:rgba(194,64,42,0.18);
  --overlay-bg:rgba(23,40,44,0.62);
  --dialog-overlay:rgba(23,40,44,0.55);
  --heatmap-text:#17282c;
  --heatmap-subtle:rgba(23,40,44,0.68);
}

:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0f1719;
  --surface:#172124;
  --surface-alt:#223236;
  --surface-raised:#1c292d;
  --ink:#f3f8f8;
  --muted:#b4c6ca;
  --line:#3a5157;
  --primary:#7bdce6;
  --primary-soft:#12373d;
  --accent:#9be7ef;
  --teal:#7bdce6;
  --teal-soft:#12373d;
  --amber:#f0c76a;
  --amber-soft:#4a3715;
  --red:#ff9b85;
  --red-soft:#4b211a;
  --blue:#9be7ef;
  --blue-soft:#12373d;
  --chrome-bg:#071012;
  --input-bg:#101b1e;
  --row-hover:#203238;
  --chart-bg:#132023;
  --chart-grid:#2c4248;
  --chart-axis:#5e747a;
  --focus-ring:rgba(123,220,230,0.72);
  --focus-warm:rgba(255,155,133,0.36);
  --overlay-bg:rgba(5,11,13,0.72);
  --dialog-overlay:rgba(5,11,13,0.7);
  --heatmap-text:#17282c;
  --heatmap-subtle:rgba(23,40,44,0.72);
  --shadow:0 1px 3px rgba(0,0,0,0.32),0 14px 30px rgba(0,0,0,0.28);
}

@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --bg:#0f1719;
    --surface:#172124;
    --surface-alt:#223236;
    --surface-raised:#1c292d;
    --ink:#f3f8f8;
    --muted:#b4c6ca;
    --line:#3a5157;
    --primary:#7bdce6;
    --primary-soft:#12373d;
    --accent:#9be7ef;
    --teal:#7bdce6;
    --teal-soft:#12373d;
    --amber:#f0c76a;
    --amber-soft:#4a3715;
    --red:#ff9b85;
    --red-soft:#4b211a;
    --blue:#9be7ef;
    --blue-soft:#12373d;
    --chrome-bg:#071012;
    --input-bg:#101b1e;
    --row-hover:#203238;
    --chart-bg:#132023;
    --chart-grid:#2c4248;
    --chart-axis:#5e747a;
    --focus-ring:rgba(123,220,230,0.72);
    --focus-warm:rgba(255,155,133,0.36);
    --overlay-bg:rgba(5,11,13,0.72);
    --dialog-overlay:rgba(5,11,13,0.7);
    --heatmap-text:#17282c;
    --heatmap-subtle:rgba(23,40,44,0.72);
    --shadow:0 1px 3px rgba(0,0,0,0.32),0 14px 30px rgba(0,0,0,0.28);
  }
}

:root.theme-transition,
:root.theme-transition *,
:root.theme-transition *::before,
:root.theme-transition *::after{
  transition-property:background-color,border-color,box-shadow,color,fill,outline-color,stroke;
  transition-duration:0.28s;
  transition-timing-function:ease;
}

@media (prefers-reduced-motion:reduce){
  :root.theme-transition,
  :root.theme-transition *,
  :root.theme-transition *::before,
  :root.theme-transition *::after{
    transition:none;
  }
}

.top-strip,.footer-bottom,.skip-link{background:var(--chrome-bg)}
.top-strip,.top-strip a{color:rgba(255,255,255,0.86)}
.footer-bottom{color:rgba(255,255,255,0.78)}
select,input{background:var(--input-bg)}
tbody tr:hover{background:var(--row-hover)}
.effect-profile-card,.profile-card,.latent-summary-card,.latent-profile-option,.latent-selected-hero,.latent-selected-grid section,.cluster-graph-wrap{background:var(--surface-raised)}
.legend-dot-suppressed{background:var(--surface)}
.hx-backdrop{background:var(--dialog-overlay)}
.tour-blocker--dim{background:var(--overlay-bg)}
.tour-spotlight{box-shadow:0 0 0 9999px var(--overlay-bg),0 0 0 2px var(--primary)}
.brand-mark{
  background:linear-gradient(135deg,var(--primary-soft),var(--surface) 62%),var(--surface);
  border-color:var(--line);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,0.06),var(--shadow);
}
.header-action[aria-pressed="true"]{border-color:var(--primary);background:var(--primary-soft);color:var(--primary)}
.footer-logo{background:#ffffff;border-radius:6px;padding:8px 12px}
.hx-cite-text{background:var(--surface-alt)}
.dd-guide{background:var(--chart-axis)}
.dd-marker{border-color:var(--surface)}
.heatmap-cell,.latent-shape-cell{color:var(--heatmap-text)}
.heatmap-n,.latent-shape-cell span{color:var(--heatmap-subtle)}
.small-label,.axis text,.chart-label{fill:var(--muted)}
.chart-title{fill:var(--ink)}
.zero-line{stroke:var(--chart-axis)}

:root[data-theme="dark"] svg [stroke="#00646e"]{stroke:#7bdce6}
:root[data-theme="dark"] svg [fill="#00646e"]{fill:#7bdce6}
:root[data-theme="dark"] svg [stroke="#3f97a1"]{stroke:#9bd4d9}
:root[data-theme="dark"] svg [fill="#3f97a1"]{fill:#9bd4d9}
:root[data-theme="dark"] svg [stroke="#c2402a"]{stroke:#ff9b85}
:root[data-theme="dark"] svg [fill="#c2402a"]{fill:#ff9b85}
:root[data-theme="dark"] svg [stroke="#7f8a8d"]{stroke:#c1cdd0}
:root[data-theme="dark"] svg [fill="#7f8a8d"]{fill:#c1cdd0}
:root[data-theme="dark"] svg [stroke="#bfced0"]{stroke:var(--chart-axis)}
:root[data-theme="dark"] svg [stroke="#e6efef"]{stroke:var(--chart-grid)}
:root[data-theme="dark"] svg rect[fill="#fafcfc"]{fill:var(--chart-bg)}
:root[data-theme="dark"] .cluster-label-box{fill:rgba(23,33,36,0.96);stroke:var(--line)}

@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) svg [stroke="#00646e"]{stroke:#7bdce6}
  :root:not([data-theme="light"]) svg [fill="#00646e"]{fill:#7bdce6}
  :root:not([data-theme="light"]) svg [stroke="#3f97a1"]{stroke:#9bd4d9}
  :root:not([data-theme="light"]) svg [fill="#3f97a1"]{fill:#9bd4d9}
  :root:not([data-theme="light"]) svg [stroke="#c2402a"]{stroke:#ff9b85}
  :root:not([data-theme="light"]) svg [fill="#c2402a"]{fill:#ff9b85}
  :root:not([data-theme="light"]) svg [stroke="#7f8a8d"]{stroke:#c1cdd0}
  :root:not([data-theme="light"]) svg [fill="#7f8a8d"]{fill:#c1cdd0}
  :root:not([data-theme="light"]) svg [stroke="#bfced0"]{stroke:var(--chart-axis)}
  :root:not([data-theme="light"]) svg [stroke="#e6efef"]{stroke:var(--chart-grid)}
  :root:not([data-theme="light"]) svg rect[fill="#fafcfc"]{fill:var(--chart-bg)}
  :root:not([data-theme="light"]) .cluster-label-box{fill:rgba(23,33,36,0.96);stroke:var(--line)}
}

.brand-home:focus-visible,.readme-details summary:focus-visible{outline-color:var(--focus-warm)}
.header-action:focus-visible,.tool-btn:focus-visible,.hx-dialog-close:focus-visible,.footer-cite-copy:focus-visible,.footer-center-link:focus-visible,.tab:focus-visible,#distribution-chart:focus-visible{outline-color:var(--focus-ring)}
/* === Theme icon toggle + footer funding (2026-07) === */
.header-action--icon svg{display:block;margin:0 auto;width:15px;height:15px}
#theme-toggle .icon-sun{display:none}
#theme-toggle.is-dark .icon-sun{display:block}
#theme-toggle.is-dark .icon-moon{display:none}
/* === Insights, loading & transitions (2026-07) === */
/* Key result callout */
.key-result{display:flex;gap:14px;align-items:center;border:1px solid var(--line);border-left:4px solid var(--primary);border-radius:8px;background:var(--primary-soft);padding:14px 18px;box-shadow:var(--shadow)}
.key-result-tag{flex:0 0 auto;align-self:flex-start;margin-top:2px;font-size:0.68rem;font-weight:800;letter-spacing:0.09em;text-transform:uppercase;color:#fff;background:var(--primary);border-radius:999px;padding:4px 10px}
.key-result p{margin:0;color:var(--ink);font-size:0.95rem;line-height:1.55}
.key-result-note{color:var(--muted);font-size:0.85rem}
@media (max-width:640px){.key-result{flex-direction:column;gap:10px}}
/* Heatmap colour legend */
.heatmap-legend{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px;color:var(--muted);font-size:0.78rem}
.heatmap-legend:empty{display:none}
.hl-label{font-weight:700}
.hl-bar{height:12px;width:150px;max-width:40vw;border-radius:3px;border:1px solid var(--line)}
.hl-diverging{background:linear-gradient(90deg,#c2402a,#ffffff,#00646e)}
.hl-sequential{background:linear-gradient(90deg,#ffffff,#0e7c88)}
.hl-na{display:inline-flex;align-items:center;gap:6px;margin-left:auto}
.hl-na i{width:12px;height:12px;border-radius:3px;background:#f0f2f1;border:1px solid var(--line)}
/* Loading overlay */
.app-loading{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;background:var(--bg);transition:opacity 0.4s ease}
.app-loading.is-hidden{opacity:0;pointer-events:none}
.app-loading-inner{display:flex;flex-direction:column;align-items:center;gap:14px;color:var(--muted);font-size:0.9rem;font-weight:600}
.app-loading-spinner{width:34px;height:34px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--primary);animation:appSpin 0.8s linear infinite}
@keyframes appSpin{to{transform:rotate(360deg)}}
/* Google Analytics consent */
.ga-consent{position:fixed;right:clamp(12px,3vw,28px);bottom:clamp(12px,3vw,28px);z-index:1900;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center;width:min(620px,calc(100vw - 24px));border:1px solid var(--line);border-left:4px solid var(--primary);border-radius:8px;background:var(--surface);box-shadow:0 18px 46px rgba(23,40,44,0.18);padding:14px 16px;transition:opacity 0.2s ease,transform 0.2s ease}
.ga-consent.is-hidden{opacity:0;transform:translateY(8px);pointer-events:none}
.ga-consent-copy{display:grid;gap:4px;min-width:0}
.ga-consent h2{margin:0;color:var(--ink);font-size:0.94rem}
.ga-consent p{margin:0;color:var(--muted);font-size:0.82rem;line-height:1.45}
.ga-consent-note{font-size:0.78rem}
.ga-consent-link{color:var(--primary);font-weight:800;text-decoration:none}
.ga-consent-link:hover,.ga-consent-link:focus-visible{text-decoration:underline;outline:none}
.ga-consent-actions{display:flex;gap:8px;align-items:center}
.ga-consent-btn{min-height:34px;border:1px solid var(--line);border-radius:999px;cursor:pointer;font-size:0.78rem;font-weight:800;padding:7px 12px}
.ga-consent-btn--ghost{background:var(--surface);color:var(--muted)}
.ga-consent-btn--primary{border-color:var(--primary);background:var(--primary);color:#fff}
.ga-consent-btn:hover,.ga-consent-btn:focus-visible{outline:3px solid var(--focus-ring);outline-offset:2px}
.ga-consent-btn--ghost:hover,.ga-consent-btn--ghost:focus-visible{border-color:var(--primary);background:var(--primary-soft);color:var(--primary)}
.ga-consent-btn--primary:hover,.ga-consent-btn--primary:focus-visible{filter:brightness(0.94)}
@media (max-width:640px){.ga-consent{grid-template-columns:1fr;align-items:stretch}.ga-consent-actions{justify-content:flex-end}.ga-consent-btn{flex:1 1 auto}}
@media (prefers-reduced-motion:reduce){.ga-consent{transition:none}}
/* Gentle fade when a tab view becomes active */
.tab-panel.is-active{animation:tabFade 0.28s ease}
@keyframes tabFade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.tab-panel.is-active{animation:none}.app-loading-spinner{animation:none}.app-loading{transition:none}}
/* === Chart value-label halo (2026-07): stop CI lines showing through label text === */
/* .chart-title labels the mean-Delta value above each dot on the Mean Delta and
   Delta-by-Latent-Profile charts; the vertical CI line sits directly behind it at
   the same x. A surface-coloured stroke drawn behind the fill (paint-order:stroke)
   bridges the anti-aliased gaps between digits so the line no longer shows through. */
.chart-title{paint-order:stroke;stroke:var(--surface);stroke-width:5px;stroke-linejoin:round}
