/* Historical spending graphs use their own layout inside the existing research panels. */
.historical-chart-card {
  --ink: #1c252b;
  --muted: #53616a;
  --line: #ded2bd;
  --gold: #936017;
  min-width: 0;
  scroll-margin-top: calc(var(--masthead-height, 0px) + 16px);
  margin-block: 24px;
  padding: clamp(10px, 2vw, 22px);
  border: 1px solid var(--line);
  border-top: 3px solid #a17a40;
  border-radius: 5px;
  background: #fffdf7;
  color: var(--ink);
}
.historical-chart-card > h2, .historical-chart-card > h3 {
  margin: 0 0 .4em;
  font: 700 clamp(1.45rem, 4vw, 2.15rem)/1.12 Georgia, serif;
}
#household-income-history-title { text-wrap: balance; }
.historical-chart-card > p { margin: 0 0 1em; }
.historical-chart-card .history-fallback { width: 100%; height: auto; display: block; }
.historical-chart-card .chart-sources { background: transparent; }
.historical-chart-card .series-navy { --series: #264e72; }
.historical-chart-card .series-teal { --series: #126568; }
.historical-chart-card .series-gold { --series: #936017; }
.historical-chart-card .history-series-text { color: var(--series); }
@media (max-width: 480px) {
  .historical-chart-card { padding-inline: 8px; }
}
.historical-chart-card .chart-controls,.historical-chart-card .chart-legend{display:flex;gap:10px;flex-wrap:wrap}
.historical-chart-card .downloads{margin-bottom:0;font-size:.88rem}
.historical-chart-card .chart-sources{border-top:1px solid var(--line);margin-top:16px;padding-top:12px}
.historical-chart-card .chart-sources h4{font-size:1.1rem;margin:0 0 8px}
.historical-chart-card .chart-sources ul{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:5px 18px;margin:0;padding:0;list-style:none;font-size:.85rem}
.historical-chart-card .chart-sources a{overflow-wrap:anywhere}
.historical-chart-card .interactive-chart{position:relative;margin:20px 0 16px}
.historical-chart-card .plot-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.historical-chart-card .chart-panel{position:relative;min-width:0;border:1px solid var(--line);padding:10px 8px 3px;border-radius:6px;background:#fffefa}
.historical-chart-card .chart-playback-edge{position:absolute;inset:auto auto 0 0;width:1px;height:1px;pointer-events:none}
.historical-chart-card .chart-panel.wide{grid-column:1/-1}
.historical-chart-card .chart-panel.has-share-meter{--meter-width:90px}
.historical-chart-card .chart-panel.has-share-meter h3,.historical-chart-card .chart-panel.has-share-meter .chart-legend{margin-right:calc(var(--meter-width) + 8px)}
.historical-chart-card .has-share-meter>.plot{overflow:visible}
.historical-chart-card .share-meter-help{position:absolute;right:9px;z-index:1;margin:0;border:0;border-radius:5px;background:transparent;padding:0;cursor:help}
.historical-chart-card .share-meter-help:hover,.historical-chart-card .share-meter-help:focus-visible{box-shadow:inset 0 0 0 1px #aa7b36}
.historical-chart-card .share-meter-help.inline-share-help{position:static;color:#704916;font:inherit;text-decoration:underline;text-underline-offset:2px;min-height:28px}
.historical-chart-card .chart-panel:not(.has-share-meter) .meter-inspector{right:8px;width:min(340px,calc(100% - 16px))}
.historical-chart-card .chart-panel h3{font-size:1rem;margin:3px 8px;color:#283338}
.historical-chart-card .chart-plot-heading{display:flex;align-items:center;gap:8px;margin:0 8px}
.historical-chart-card .chart-plot-heading h3{flex:1;min-width:0;margin:3px 0}
.historical-chart-card .chart-plot-heading:has(.chart-credit) h3{margin-inline:0}
.historical-chart-card .chart-credit{flex:none;align-self:center;margin-inline-start:auto;padding-inline:7px clamp(8px,1.3vw,16px);border-inline-start:2px solid #be934c;color:#523914;font:700 clamp(.69rem,1.6vw,.89rem)/1.25 Georgia,serif;white-space:nowrap}
.historical-chart-card .chart-panel .chart-legend{font-size:.84rem;margin:4px 8px;color:var(--muted);column-gap:14px}
.historical-chart-card .chart-key{display:inline-flex;align-items:center;gap:4px}
.historical-chart-card .chart-key i{width:12px;height:3px;display:inline-block;background:var(--series);border-radius:2px}
.historical-chart-card .plot{display:block;width:100%;height:auto;touch-action:pan-y;touch-action:pan-y pinch-zoom;user-select:none;outline-offset:1px}
.historical-chart-card .plot text{font:13px system-ui,sans-serif;fill:#53616a}
.historical-chart-card .plot .gdp-baseline-axis text{fill:var(--gold);font-weight:700}
.historical-chart-card .plot .gdp-baseline-axis .gdp-baseline-note{font-size:10px}
.historical-chart-card .share-meter-panel{fill:#fcf6e9;stroke:#e0cda7;stroke-width:1}
.historical-chart-card .share-meter-header{fill:#f3e6c9}
.historical-chart-card .share-meter-track{fill:#f0e5cc;stroke:#e1d1b2;stroke-width:1}
.historical-chart-card .share-meter-fill,.historical-chart-card .share-meter-marker{fill:var(--gold)}
.historical-chart-card .share-meter-marker{stroke:#fffdf7;stroke-width:1.3}
.historical-chart-card .share-meter-label{fill:#fffdf7;stroke:#aa7b36;stroke-width:.8}
.historical-chart-card .plot .share-meter text{fill:#6e460f;font-size:17px;font-weight:800;pointer-events:none}
.historical-chart-card .plot .share-meter .share-meter-heading{font-size:12px;font-weight:800}
.historical-chart-card .plot .share-meter .share-meter-status{font-size:11px;font-weight:700}
.historical-chart-card .plot .share-meter .share-meter-delta{font-size:14px}
.historical-chart-card .plot .tip-label{font-size:16px;font-weight:700;fill:var(--series)}
.historical-chart-card .chart-panel:not(.has-share-meter) .tip-label{font-size:14px}
.historical-chart-card .chart-readout{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:6px;overflow:hidden;margin-bottom:12px}
.historical-chart-card .chart-readout div{background:#f8f4ea;padding:8px 11px}
.historical-chart-card .chart-readout dt{font-size:.84rem;color:var(--muted)}
.historical-chart-card .chart-readout dd{margin:0;color:var(--series,var(--ink));font-size:1.4rem;font-weight:750;font-variant-numeric:tabular-nums}
.historical-chart-card .chart-readout small{font-size:.8rem;color:var(--muted)}
.historical-chart-card .chart-spending-formula{margin:-4px 0 12px;padding:7px 10px;border-inline-start:2px solid #be934c;background:#f8f4ea;font-size:.84rem;line-height:1.35}
.historical-chart-card .chart-spending-formula strong{display:block;color:var(--ink)}
.historical-chart-card .chart-spending-formula span{display:block;margin-top:2px;color:var(--muted)}
.historical-chart-card .chart-tooltip{position:absolute;z-index:5;width:max-content;max-width:min(340px,calc(100% - 16px));max-height:calc(100dvh - 16px);overflow:auto;padding:11px 13px;background:#fffdf8;color:var(--ink);border:1px solid #b49e78;border-radius:7px;box-shadow:0 6px 22px #2b261e38;font-size:.84rem;line-height:1.4}
.historical-chart-card .meter-inspector{position:absolute;right:calc(var(--meter-width) + 15px);z-index:6;width:min(340px,calc(100% - var(--meter-width) - 22px));padding:11px 13px;color:var(--ink);background:#fffdf8;border:1px solid #b49e78;border-radius:7px;box-shadow:0 6px 22px #2b261e38;font-size:.84rem;line-height:1.4}
.historical-chart-card .meter-inspector p{margin:5px 0 0}
.historical-chart-card .meter-formula{font-weight:700;color:#6e460f}
.historical-chart-card .chart-tooltip[hidden],.historical-chart-card .meter-inspector[hidden],.historical-chart-card .event-info[hidden]{display:none}
.historical-chart-card .chart-tooltip ul{margin:2px 0 0;padding:0;list-style:none}
.historical-chart-card .chart-tooltip li{border-top:1px solid var(--line);padding:3px 0}
.historical-chart-card .chart-tooltip small,.historical-chart-card .event-info small{display:block;color:var(--muted);margin-top:3px}
.historical-chart-card .president-timeline,.historical-chart-card .event-timeline{margin-top:15px;padding-top:10px;border-top:1px solid #cfc1a9}
.historical-chart-card .president-timeline h3,.historical-chart-card .event-timeline h3{font-size:1.04rem;margin:0 0 9px}
.historical-chart-card .president-method{font-size:.8rem;color:var(--muted);margin:0 0 10px}
.historical-chart-card .president-rate{width:fit-content;color:#684410;background:#f0e5cc;font-size:.69rem;font-weight:800;padding:2px 4px;margin-top:5px;border-radius:2px;white-space:nowrap;font-variant-numeric:tabular-nums}
.historical-chart-card .president-projected{font-size:.67rem;color:#715429;margin-top:2px}
.historical-chart-card .president-rail,.historical-chart-card .event-strip{display:grid;gap:8px}
.historical-chart-card .president-rail{grid-template-columns:repeat(auto-fit,minmax(83px,1fr))}
.historical-chart-card .event-strip{grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:3px 14px}
.historical-chart-card .president-rail button,.historical-chart-card .event-strip button{appearance:none;display:grid;align-content:start;min-width:0;background:transparent;border:none;border-radius:3px;padding:0;color:var(--ink);text-align:left;font:inherit;cursor:pointer}
.historical-chart-card .president-rail button{padding:3px}
.historical-chart-card .event-strip button{position:relative;min-height:44px;grid-template-columns:3.2em 1fr;align-items:baseline;gap:5px;padding:7px 5px;border-bottom:1px solid var(--line)}
.historical-chart-card .timeline-year{color:#68512d;font:700 .71rem/1.25 system-ui,sans-serif;font-variant-numeric:tabular-nums}
.historical-chart-card .timeline-title{font:700 .82rem/1.2 Georgia,serif;overflow-wrap:break-word}
.historical-chart-card .president-name-line{display:block;white-space:nowrap}
.historical-chart-card .president-image{display:block;width:100%;aspect-ratio:4/5;margin-bottom:4px;background:#eee8db;border-bottom:2px solid var(--party,#a38a55);border-radius:3px 3px 0 0;overflow:hidden}
.historical-chart-card .president-image img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 28%}
.historical-chart-card .president-rail button:not([data-landed]):not([data-entering]) img{visibility:hidden}
.historical-chart-card .president-rail button[data-entering] img{opacity:var(--portrait-entry);transform:translateX(calc((1 - var(--portrait-entry))*-8px))}
.historical-chart-card .president-rail button[data-entering]{opacity:1}
.historical-chart-card .president-rail button:not([data-landed]){--party:#a38a55}
.historical-chart-card .president-rail button:disabled:not([data-entering]),.historical-chart-card .event-strip button:disabled{opacity:.42;cursor:default}
.historical-chart-card [data-party="D"]{--party:#335f8a}
.historical-chart-card [data-party="R"]{--party:#984d41}
.historical-chart-card .president-rail button:enabled:hover,.historical-chart-card .event-strip button:enabled:hover{background:#f0e8d6}
.historical-chart-card .president-rail button[data-chart-highlight],.historical-chart-card .event-strip button[data-chart-highlight]{background:#f5daa0;box-shadow:inset 0 0 0 1px #bb8d42}
.historical-chart-card .president-stage{display:flex;align-items:center;gap:8px;margin:0 8px 8px;padding-bottom:7px;border-bottom:1px solid var(--line)}
.historical-chart-card .president-stage-avatar{position:relative;display:grid;place-items:center;flex:0 0 40px;height:46px;overflow:hidden;border-radius:4px;border-bottom:2px solid var(--party);background:#f3e7cc;color:#6d4c1c;font-size:.72rem;font-weight:800;font-variant-numeric:tabular-nums}
.historical-chart-card .president-stage-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 28%;opacity:0}
.historical-chart-card .president-stage-caption{color:var(--ink)}
.historical-chart-card .president-stage-caption>span{display:block;font-size:.65rem;font-weight:750;color:#604820}
.historical-chart-card .president-stage-caption strong{display:block;font:700 .84rem/1 Georgia,serif}
.historical-chart-card .chart-controls button{font:inherit;color:#513711;background:#faf3e2;border:1px solid #b9a682;border-radius:5px;cursor:pointer}
.historical-chart-card .event-info{font-size:.85rem;background:#f8f4ea;border-left:3px solid var(--gold);margin:6px 0 10px;padding:8px 10px}
.historical-chart-card .event-info p{margin:2px 0 0}
.historical-chart-card .chart-controls{align-items:start;margin-top:12px}
.historical-chart-card .chart-controls button{font-size:.85rem;font-weight:700;min-height:38px;padding:6px 14px}
.historical-chart-card .chart-media-action{display:grid;align-content:start;justify-items:stretch;gap:3px;min-width:0}
.historical-chart-card .chart-controls .chart-share{min-height:44px}
.historical-chart-card .chart-download{justify-self:center;padding:3px 6px;font-size:.78rem;text-underline-offset:.15em}
.historical-chart-card .chart-share-url{flex-basis:100%;width:100%;min-width:0;padding:7px;font:inherit}
.historical-chart-card .chart-share-status{flex-basis:100%}
.historical-chart-card .chart-share-status:empty{display:none}
.historical-chart-card .chart-controls span{font-size:.78rem;color:var(--muted)}
.historical-chart-card .chart-controls button:hover{background:#f0e2c5}
.historical-chart-card .chart-panel :focus-visible,.historical-chart-card .president-rail button:focus-visible,.historical-chart-card .event-strip button:focus-visible,.historical-chart-card .chart-controls button:focus-visible,.historical-chart-card .chart-controls a:focus-visible{outline:2px solid #126568;outline-offset:2px}
.historical-chart-card .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(max-width:720px){
  .historical-chart-card .chart-panel .chart-legend{row-gap:3px;column-gap:9px}
  .historical-chart-card .plot-grid{grid-template-columns:minmax(0,1fr)}
  .historical-chart-card .chart-readout{grid-template-columns:repeat(2,minmax(0,1fr))}
  .historical-chart-card .chart-readout>div:last-child:nth-child(odd){grid-column:1/-1}
  .historical-chart-card .chart-readout dd{font-size:1.2rem}
  .historical-chart-card .chart-readout small{display:block;margin-top:3px;line-height:1.35}
  .historical-chart-card .president-rail{grid-template-columns:repeat(auto-fit,minmax(68px,1fr))}
  .historical-chart-card .president-name{font-size:.74rem}
}
@media(max-width:640px), (pointer:coarse) and (max-width:950px){
  .historical-chart-card .president-stage-caption>span{white-space:nowrap}
  .historical-chart-card .president-office-label{display:none}
}
@media(max-width:480px){
  .historical-chart-card .chart-panel{padding-inline:4px}
  .historical-chart-card .chart-panel h3,.historical-chart-card .chart-panel .chart-legend{margin-left:5px}
  .historical-chart-card .share-meter-help{right:5px}
  .historical-chart-card .chart-controls{gap:8px}
  .historical-chart-card .chart-controls button{min-height:44px;padding-inline:10px}
  .historical-chart-card .chart-share-status{flex-basis:100%}
}
@media(max-width:360px){
  .historical-chart-card .chart-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .historical-chart-card .chart-controls .chart-replay{justify-self:start}
  .historical-chart-card .chart-share-status,.historical-chart-card .chart-share-url{grid-column:1/-1}
}

.historical-chart-card .chart-help{margin:0 0 8px;color:var(--muted);font-size:.79rem}


/* Public destinations for chart and video links. */
.history-share-page { width: min(100%, 1050px); margin: 0 auto; padding: clamp(18px, 4vw, 50px); }
.history-share-page h1 { margin: .45em 0 .2em; font: 700 clamp(2rem, 5vw, 3.65rem)/1.12 Georgia, serif; }
.history-share-page figure { margin: 20px 0; }
.history-share-page video, .history-share-page img {
  display: block; width: 100%; height: auto; border: 1px solid #ded2bd; border-radius: 5px; background: #fffdf7;
}
.history-share-page video { max-height: 78svh; }
.history-share-page .history-share-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
