/* Eagle Health Analytics — additions on top of the portfolio design system (site.css + project.css).
 * Uses only the shared design tokens, so light/dark themes work automatically. */

/* Explorer controls */
.control-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.control-row .input { width: auto; padding: .55rem 2rem .55rem .9rem; font-size: .92rem; }
.control-row label { margin: 0; font-weight: 600; font-size: .85rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: .5rem; }
.explore-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.5rem; align-items: start; }
.explore-grid > *, .explorer { min-width: 0; } /* let wide content (heatmap, long names) scroll instead of widening the page */
@media (max-width: 999.98px) { .explore-grid { grid-template-columns: 1fr; } }
.panel-title { font-size: 1rem; margin-bottom: .75rem; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.panel-title small { font-family: var(--font-body); font-weight: 500; color: var(--ink-3); font-size: .82rem; }

/* US state tile map */
.tilemap { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.tile { aspect-ratio: 1; border-radius: 7px; border: 0; padding: 0; font: 700 clamp(.55rem, 1.4vw, .78rem)/1 var(--font-body); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink); background: var(--surface);
    transition: transform .15s var(--ease), box-shadow .15s; position: relative; }
.tile small { font-weight: 500; font-size: .85em; opacity: .85; }
.tile:hover, .tile:focus-visible, .tile[aria-pressed="true"] { transform: scale(1.08); box-shadow: var(--shadow); z-index: 1; }
.tile[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.tile.dark { color: #fff; }
.tile.nodata { background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 4px, var(--border) 4px, var(--border) 6px); color: var(--ink-3); cursor: default; }
.tile.nodata:hover { transform: none; box-shadow: none; }
.scale { display: flex; align-items: center; gap: .6rem; margin-top: .9rem; font-size: .8rem; color: var(--ink-3); }
.scale-bar { flex: 1; height: 10px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 8%, var(--surface)), var(--brand)); }
@media (max-width: 575.98px) { .tilemap { gap: 2px; } .tile { border-radius: 4px; } .tile small { display: none; } }

/* Ranked list */
.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; }

/* Correlation heatmap */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; margin: 0 auto; font-size: .8rem; }
.heat th { font-weight: 600; color: var(--ink-3); padding: .25rem .4rem; white-space: nowrap; }
.heat thead th { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; height: 6.5rem; }
.heat tbody th { text-align: right; }
.heat td { width: 2.9rem; height: 2.4rem; border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums; padding: 0; }
.heat td button { all: unset; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; cursor: pointer; border-radius: 6px; }
.heat td button:focus-visible { outline: 3px solid var(--ink); }
.heat td.self { background: var(--surface); color: var(--ink-3); }
.heat td.on button { outline: 2px solid var(--ink); }

/* Team */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.member { padding: 1.25rem; text-align: center; }
.member img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto .8rem; border: 3px solid var(--surface-2); box-shadow: var(--shadow-sm); }
.member h3 { font-size: 1rem; margin-bottom: .15rem; }
.member p { font-size: .85rem; color: var(--ink-3); margin: 0 0 .75rem; }
.member .social { justify-content: center; gap: .4rem; }
.member .icon-btn { width: 36px; height: 36px; font-size: .9rem; }

.fix-list { margin: .5rem 0 0; padding-left: 1.1rem; }
.fix-list li { margin: .35rem 0; }
.api-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; list-style: none; padding: 0; margin: 0; }
.api-list a { display: flex; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; font-size: .9rem; }
.api-list code { font-size: .82rem; color: var(--ink-3); }

/* Real US map (US Census shapes, Albers USA) */
.map-box { position: relative; }
.usmap { width: 100%; height: auto; display: block; }
.usmap .st { stroke: var(--surface-2); stroke-width: .8; transition: opacity .15s, stroke .15s; cursor: pointer; outline: none; }
.usmap .st:hover, .usmap .st:focus-visible { stroke: var(--ink); stroke-width: 1.6; }
.usmap .st.on { stroke: var(--ink); stroke-width: 2.2; }
.usmap .st.nodata { cursor: default; }
.usmap .hatch-bg { fill: var(--surface); }
.usmap .hatch-line { stroke: var(--border); stroke-width: 2; }
.usmap .metro { fill: rgba(234, 88, 12, .68); stroke: #fff; stroke-width: 1; cursor: pointer; }
.usmap .metro:hover { fill: #c2410c; }
.usmap .metro.on { fill: #dc2626; stroke: #fff; stroke-width: 2.5; }
:root[data-theme="dark"] .usmap .metro { stroke: #0b1020; }
.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; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--brand)); }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; color: var(--ink-3); margin: 0; cursor: pointer; }

/* Analytics sections */
.analysis-block { margin-top: 1.5rem; }
.analysis-block .lead { color: var(--ink-2); max-width: 75ch; }
.chart-box.xl { height: clamp(340px, 55vh, 500px); }
.kv-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1rem 0; }
@media (max-width: 767.98px) { .kv-row { grid-template-columns: repeat(2, 1fr); } }
.pair-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.pair-grid > * { min-width: 0; }
@media (max-width: 767.98px) { .pair-grid { grid-template-columns: 1fr; } }
.insights { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.insights li { margin: .4rem 0; }
.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; }

/* API endpoints */
.endpoints { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 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); }
.two-col-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.two-col-charts > * { min-width: 0; }
@media (max-width: 899.98px) { .two-col-charts { grid-template-columns: 1fr; } }
.control-row .seg label { margin: 0; }
.map-scale .scale-bar.div { background: linear-gradient(90deg, var(--brand), var(--surface) 50%, #ea580c); }
.usmap .metro.sim { fill: #1e3a8a; stroke: #fff; stroke-width: 1.5; }
.linklike { all: unset; color: var(--brand); cursor: pointer; font-weight: 600; }
.linklike:hover, .linklike:focus-visible { text-decoration: underline; }
.sim-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.sim-list small { color: var(--ink-3); margin-left: .35rem; }
.stats-table small { color: var(--ink-3); font-weight: 400; }
.stats-table td { vertical-align: top; }
.revisited td:first-child { color: var(--ink-3); font-style: italic; width: 38%; }
.big-stat { font-size: 1.05rem; color: var(--ink-2); }
.big-stat strong { color: var(--ink); font-family: var(--font-head); }
.legend-dots { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--ink-3); margin-top: .5rem; }
.legend-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }

/* 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; }

.bubble-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; margin-top: .6rem; font-size: .8rem; color: var(--ink-3); }
.bubble-legend .bl-item { display: inline-flex; align-items: center; gap: .35rem; font-variant-numeric: tabular-nums; }
.bubble-legend circle { fill: rgba(234, 88, 12, .68); stroke: #fff; stroke-width: 1; }


/* ---- 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; } }
