/* Mental Health Risk Indicators — additions on top of the portfolio design system (site.css + project.css).
 * Uses only the shared design tokens, so light/dark themes work automatically. */
.two-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.two-panel > *, .explorer { min-width: 0; }
@media (max-width: 899.98px) { .two-panel { grid-template-columns: 1fr; } }
.panel-title { font-size: 1rem; margin-bottom: .75rem; }
.chart-box.tall { height: clamp(320px, 50vh, 440px); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; counter-reset: rk; }
.rank-list li { counter-increment: rk; display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.rank-list li::before { content: counter(rk); color: var(--ink-3); font-size: .8rem; font-weight: 700; text-align: right; }
.rank-list .bar-wrap { position: relative; padding: .35rem .6rem; border-radius: 8px; overflow: hidden; min-width: 0; }
.rank-list .bar-wrap::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--brand-soft); border-radius: inherit; }
.rank-list .bar-wrap span { position: relative; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-list b { font-variant-numeric: tabular-nums; }
.rank-list.low .bar-wrap::before { background: color-mix(in srgb, var(--accent) 14%, transparent); }

.support { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.2rem; border-left: 4px solid var(--success); font-size: .92rem; color: var(--ink-2); }
.support i { color: var(--success); font-size: 1.2rem; margin-top: .15rem; }
.support strong { color: var(--ink); }

.team-list { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.team-list a { display: inline-flex; gap: .45rem; align-items: center; padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2); font-weight: 500; font-size: .9rem; }
.team-list a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.team-list small { color: var(--ink-3); }

.viz-frame { position: relative; aspect-ratio: 16 / 10; width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; }
.viz-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.viz-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .25; }
.viz-frame .btn { position: relative; }
.viz-frame .viz-loading { margin: 0; color: var(--ink-3); }
.viz-link { margin-top: .5rem; }
.viz-frame p { position: relative; color: var(--ink-2); margin: .75rem 0 0; font-size: .9rem; }
@media (max-width: 767.98px) { .viz-frame { aspect-ratio: 3 / 4; } }

/* Real world map (Natural Earth shapes, Equal Earth projection) */
.map-box { position: relative; }
.worldmap { width: 100%; height: auto; display: block; }
.worldmap .ct { stroke: var(--surface-2); stroke-width: .5; cursor: pointer; outline: none; }
.worldmap .ct:hover, .worldmap .ct:focus-visible { stroke: var(--ink); stroke-width: 1.2; }
.worldmap .ct.on { stroke: var(--ink); stroke-width: 1.8; }
.worldmap .ct.nodata { cursor: default; }
.worldmap .hatch-bg { fill: var(--surface); }
.worldmap .hatch-line { stroke: var(--border); stroke-width: 2; }
.map-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 8px; padding: .35rem .6rem; font-size: .82rem; font-weight: 600; max-width: 220px; }
.map-scale { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; font-size: .8rem; color: var(--ink-3); }
.map-scale .scale-bar { flex: 1; height: 10px; border-radius: 999px; }
.map-scale .scale-bar.red { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 8%, var(--surface)), var(--danger)); }
.map-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 1.5rem; align-items: start; }
.map-layout > * { min-width: 0; }
@media (max-width: 899.98px) { .map-layout { grid-template-columns: 1fr; } }
.country-card h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.country-card p { color: var(--ink-2); font-size: .92rem; }
.country-card dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: .5rem 0 0; font-size: .9rem; }
.country-card dt { color: var(--ink-3); }
.country-card dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.figure-wide { margin: 0; padding: .75rem; background: #fff; }
.figure-wide img { width: 100%; height: auto; border-radius: 8px; }
.figure-wide figcaption { color: #334155; font-size: .85rem; padding-top: .5rem; }
.refs { color: var(--ink-2); font-size: .9rem; padding-left: 1.1rem; }
.refs li { margin: .35rem 0; }
.checklist { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.checklist li { margin: .35rem 0; }

/* API endpoints */
.endpoints { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.endpoints > * { min-width: 0; }
.endpoint { padding: 1.1rem 1.2rem; }
.endpoint-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; font-size: .85rem; }
.endpoint-head code { font-weight: 600; color: var(--ink); word-break: break-all; }
.method { font-size: .72rem; font-weight: 800; letter-spacing: .05em; color: #fff; background: var(--success); padding: .15rem .5rem; border-radius: 6px; }
.legacy { color: var(--ink-3); font-size: .78rem; }
.endpoint h3 { font-size: 1rem; margin-bottom: .25rem; }
.endpoint p { font-size: .88rem; color: var(--ink-2); margin-bottom: .75rem; }
.endpoint-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.endpoint-out, .code { margin: .75rem 0 0; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: .78rem; max-height: 260px; overflow: auto; white-space: pre; color: var(--ink-2); }

/* Findings: fixed-width icon column so every row's text starts at the same position */
.findings li > i { flex: 0 0 1.75rem; text-align: center; font-size: 1.05rem; margin-top: .2rem; }
.findings li > div { min-width: 0; }
.findings strong { display: block; margin-bottom: .15rem; }

.map-scale .scale-bar.div { background: linear-gradient(90deg, var(--brand), var(--surface) 50%, var(--danger)); }
.spark { margin: .25rem 0 .6rem; }
.spark svg { display: block; background: var(--surface); border-radius: 6px; }
.spark small { color: var(--ink-3); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* Data-table filters: long options (e.g. region names) must not widen the page on phones */
.dt-toolbar select.input { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
@media (max-width: 575.98px) { .dt-toolbar select.input { flex: 1 1 100%; } }

/* ---- Plain-language layer: plain summary first, statistics second ---- */
.findings .stat-line { font-size: .8rem; color: var(--ink-3); margin: .4rem 0 0; }
.plain { padding: .85rem 1.1rem; border-left: 4px solid var(--brand); font-size: .95rem; color: var(--ink-2); margin: 0 0 1.25rem; }
.plain > strong:first-child { color: var(--ink); }
.glossary { margin-top: 1.5rem; padding: 0; }
.glossary > summary { cursor: pointer; padding: 1rem 1.2rem; font-weight: 600; color: var(--ink); list-style: none; display: flex; gap: .6rem; align-items: center; }
.glossary > summary::-webkit-details-marker { display: none; }
.glossary > summary::after { content: '+'; margin-left: auto; font-size: 1.25rem; line-height: 1; color: var(--ink-3); }
.glossary[open] > summary::after { content: '\2212'; }
.glossary dl { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: .65rem 1.25rem; margin: 0; padding: 0 1.2rem 1.2rem; font-size: .92rem; }
.glossary dt { font-weight: 600; color: var(--ink); }
.glossary dd { margin: 0; color: var(--ink-2); }
@media (max-width: 640px) { .glossary dl { grid-template-columns: 1fr; gap: .1rem; } .glossary dd { margin-bottom: .65rem; } }
