/* Chart Explorer styles. Colors and sizes come from tokens.css, copied from df1-io (PRD R5.5). */
@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("/fonts/poppins-700.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url("/fonts/poppins-800.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--surface); }
h1, h2, h3 { color: var(--heading); line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 1.1rem; font-weight: 700; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 0; top: -48px; background: var(--brand-fill); color: var(--on-accent); padding: 10px 16px; z-index: 50; }
.skip-link:focus { top: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem 20px 7rem; }

.hd { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.hd-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--heading); font-weight: 800; letter-spacing: -.02em; }
.hd-back { font-size: .875rem; font-weight: 600; text-decoration: none; }

.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin: 1.5rem 0 .75rem; }
.lead { font-size: 1.08rem; max-width: 760px; }
.facts { display: grid; gap: 1rem; margin: 2rem 0; }
@media (min-width: 860px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.facts > div { background: var(--bg); border-radius: var(--radius); padding: 1.25rem; }
.facts p { margin: 0; font-size: .95rem; }
.list-h { margin-top: 2rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { display: block; padding: 1.1rem 1.2rem; border: 1.5px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.pcard:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.pcard-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.pcard-name { font-weight: 700; color: var(--heading); }
.pcard p { margin: .2rem 0 .5rem; }
.pcard-probs { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; color: var(--brand); background: var(--brand-tint); border: 1px solid var(--brand-border); white-space: nowrap; }

.chart-wrap { display: grid; gap: 1.5rem; }
@media (min-width: 992px) { .chart-wrap { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } .ask-col { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; } }
.back { font-size: .9rem; font-weight: 600; }
.chart-name { margin-top: .25rem; }
.allergy { font-weight: 600; color: var(--heading); margin: .25rem 0 .5rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1.25rem 0 .75rem; }
.tab { font: inherit; font-size: .85rem; font-weight: 600; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-accent); }
.entries { list-style: none; margin: 0; padding: 0; border: 1.5px solid var(--border); border-radius: var(--radius); }
.entry { display: grid; grid-template-columns: 82px 92px 1fr; gap: .6rem; padding: .55rem .9rem; border-top: 1px solid var(--border); font-size: .92rem; transition: background .4s; }
.entry:first-child { border-top: 0; }
.entry.hl { background: var(--brand-tint); box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 600px) { .entry { grid-template-columns: 1fr; gap: 0; } }
.eid { font-family: var(--font-mono); font-size: .8rem; color: var(--brand); }
.edate { color: var(--muted); font-size: .85rem; }
.timeline .entry { position: relative; }

.ask { background: var(--bg); border-radius: var(--radius); padding: 1rem; }
.ask label { display: block; font-weight: 700; color: var(--heading); margin-bottom: .4rem; }
.ask textarea { width: 100%; font: inherit; padding: .6rem .75rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; }
.ask textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.ask-row { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.ask-row .muted { margin-right: auto; }
.examples { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.chip-q { font: inherit; font-size: .8rem; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.chip-q:hover { border-color: var(--brand); color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; }
.btn-sm { padding: .45rem .9rem; font-size: .875rem; }
.btn-primary { background: var(--brand-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--brand-fill-hover); }
.btn-secondary { background: transparent; color: var(--heading); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn[disabled] { opacity: .6; cursor: progress; }

.answer { margin-top: 1rem; }
.answer-q { font-weight: 700; color: var(--heading); }
.claim { margin: 0 0 .6rem; }
.cite { font: inherit; font-size: .72rem; font-weight: 700; min-width: 1.5rem; height: 1.35rem; padding: 0 .35rem; margin-left: .2rem; border-radius: 6px; border: 1px solid var(--brand-border); background: var(--brand-tint); color: var(--brand); cursor: pointer; vertical-align: .1em; }
.cite:hover { background: var(--brand-fill); color: var(--on-accent); }
.flag { font-size: .85rem; color: var(--gold); font-weight: 600; }
.sources-h { font-size: .9rem; margin-top: 1rem; }
.sources { padding-left: 1.3rem; font-size: .85rem; }
.srclink { font: inherit; text-align: left; vertical-align: top; background: none; border: 0; padding: .1rem 0; color: var(--text); cursor: pointer; }
.srclink:hover { color: var(--brand); text-decoration: underline; }
.refusal { border: 1.5px solid var(--gold); background: var(--gold-soft); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.refusal strong { color: var(--heading); }
.refusal p { margin: .3rem 0 0; }
.error { color: var(--red); font-weight: 600; }
.audit { margin-top: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: .85rem; }
.audit summary { font-weight: 700; cursor: pointer; color: var(--heading); }
.audit dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; margin: .6rem 0 0; }
.audit dt { color: var(--muted); }
.audit dd { margin: 0; overflow-wrap: anywhere; }

/* Phones: the question box stays pinned at the bottom of the chart view (PRD R8.3 b). */
@media (max-width: 991px) {
  .ask-col .ask { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; border-radius: 0; border-top: 1px solid var(--border); padding: .75rem 16px calc(.75rem + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
  .ask-col .ask .examples { display: none; }
  .ask-col .ask textarea { min-height: 2.8rem; }
  .ask-col .answer { margin-top: 0; }
}

.ft { position: relative; z-index: 1; background: var(--footer-bg); color: var(--footer-text); text-align: center; font-size: .85rem; padding: 1rem 20px calc(1rem + env(safe-area-inset-bottom)); }
.ft a { color: var(--footer-link); }
@media (max-width: 991px) { .ft { padding-bottom: 9rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
