/* The tool shell — the shared look of every tool on econvitals.org/tools/ (Jason, 2026-12-01: “Tools should
   look and work more alike: the Recession Explorer is the model”). The smallest set of shared pieces; a
   tool’s own style.css, loaded AFTER this file, keeps its personality and can override anything here.

     page          white background, Literata, the site’s ink (theme.css colors only, no hex)
     .tool-wrap    the content column (a tool may keep its own .wrap instead)
     .tool-top     the standard page top, in this order:
                     .tool-crumb  “← Tools”
                     h1           the tool’s name (no subtitle)
                     .mf-original-line  “ECONVITALS ORIGINAL · Methods” (house.js fills the pill)
                     .tool-desc   a plain one-to-three-sentence description
                     .tool-box    the ONE optional gray box with the blue left edge
                     .tool-asof   “Data through …”
                     .tool-related  “Related: A · B” (tool.js renderRelated)
                     .tool-warn   one light-red warning pill
     .ev-tabs      the blue-underline tabs (last tab always “About”)
     .seg / .chips the segmented buttons: fixed sizes, ONE selected style (house-blue fill)
     .ev-btn       the standard fixed-size plain button (“Copy link to this view”)
     .ev-panel     a control box; .tool-level (Simple | The Works) sits at its top right
     .works-only   shown only in The Works
     .ev-more      the “Detail ▸” expander, with a “(N changed)” count when closed
     .two-line     on a .seg or .chips: fixed width and a fixed 44px height, a long label wraps to two lines
     .tool-actions a control box’s footer row of fixed-size buttons, bottom right (“Copy link to this view”)
     .tool-answer  the answer box: .tool-kicker, .tool-lede, then .tool-tiles > .tile (.k / .v / .s)
     header/footer enough of site.css that shared.js mountChrome() works without site.css
                   (copied from site.css — change both together)

   How to use them: README.md, “The tool shell (tool.css / tool.js)”. */

:root {
  --ev-ink: var(--mf-ink);
  --ev-muted: var(--mf-muted);
  --ev-accent: var(--mf-blue);
  --ev-line: var(--mf-gridline);
  --ev-panel: color-mix(in srgb, var(--mf-gridline) 18%, var(--mf-bg));
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mf-bg); color: var(--ev-ink); font-family: var(--mf-font); line-height: 1.5; font-size: 16px; }
[hidden] { display: none !important; }
a { color: var(--ev-accent); }
.tool-wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }
#app [id] { scroll-margin-top: 76px; }

/* ---- the page top ------------------------------------------------------------------------------------- */
.tool-top { margin: 0 0 4px; }
.tool-crumb { font-size: 14px; margin: 0 0 22px; }
.tool-crumb a { text-decoration: none; }
.tool-crumb a:hover { text-decoration: underline; }
.tool-top h1 { font-size: 32px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
.tool-desc { color: var(--ev-muted); font-size: 15px; line-height: 1.5; margin: 0 0 16px; max-width: 1040px; }
.tool-box { border: 1px solid var(--ev-line); border-left: 5px solid var(--ev-accent); background: var(--ev-panel);
  border-radius: 6px; padding: 16px 22px; margin: 0 0 12px; }
.tool-box p { font-size: 16.5px; line-height: 1.5; margin: 0 0 10px; max-width: 1040px; }
.tool-box p:last-child { margin-bottom: 0; }
.tool-box b { color: var(--ev-accent); }
.tool-asof { font-size: 14px; color: var(--ev-muted); line-height: 1.55; margin: 0 0 10px; max-width: 900px; }
.tool-related { font-size: 13.5px; color: var(--ev-muted); margin: 0 0 10px; }
.tool-related:empty { display: none; }
.tool-warn { display: inline-block; font-size: 13.5px; line-height: 1.4; margin: 2px 0 12px; padding: 5px 14px; border-radius: 16px;
  background: color-mix(in srgb, var(--mf-red) 9%, var(--mf-bg)); border: 1px solid color-mix(in srgb, var(--mf-red) 38%, var(--mf-bg)); }

/* ---- tabs: one fixed size, blue underline on the one showing; two by two on a phone -------------------- */
.ev-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--ev-line); margin: 18px 0 14px;
  scroll-margin-top: 76px; }   /* a tab change that scrolls the row into view parks it clear of the sticky menu bar */
.ev-tabs button { font-family: inherit; font-size: 15px; width: 168px; height: 44px; flex-shrink: 0; padding: 0 8px; background: none;
  border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--ev-muted); cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.ev-tabs button:hover { color: var(--ev-ink); }
.ev-tabs button[aria-selected="true"] { color: var(--ev-accent); border-bottom-color: var(--ev-accent); font-weight: 600; }

/* ---- buttons: fixed sizes, never sized to the label; ONE selected look --------------------------------- */
.seg { display: inline-flex; align-self: flex-start; flex-wrap: wrap; border: 1px solid var(--ev-line); border-radius: 5px; overflow: hidden; max-width: 100%; }
.seg button { font-family: inherit; font-size: 13px; height: 34px; width: 128px; flex-shrink: 0; border: 0; border-right: 1px solid var(--ev-line);
  background: var(--mf-bg); color: var(--ev-ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.seg button:last-child { border-right: 0; }
.seg.wide button { width: 164px; }
.seg.xwide button { width: 216px; }
.seg.narrow button { width: 92px; }
.seg button:disabled { color: var(--ev-muted); cursor: not-allowed; background: var(--ev-panel); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-family: inherit; font-size: 13px; height: 32px; width: 92px; flex-shrink: 0; border: 1px solid var(--ev-line); border-radius: 5px;
  background: var(--mf-bg); color: var(--ev-ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
/* the selected button, everywhere: house-blue fill, white words */
.seg button[aria-pressed="true"], .seg button.on,
.chips button[aria-pressed="true"], .chips button.on { background: var(--ev-accent); border-color: var(--ev-accent); color: var(--mf-bg); }
.ev-btn { font-family: inherit; font-size: 13px; height: 34px; width: 176px; flex-shrink: 0; border: 1px solid var(--ev-line); border-radius: 5px;
  background: var(--mf-bg); color: var(--ev-ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.ev-btn:hover { border-color: var(--ev-ink); }

/* ---- a control box, with Simple | The Works at its top right ------------------------------------------- */
.ev-panel { border: 1px solid var(--ev-line); border-radius: 6px; padding: 12px 16px 6px; margin: 0 0 10px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; }
.ev-panel > * { grid-column: 1; }
.ev-panel > .tool-level { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; margin: 0 0 10px; }
.tool-level button { width: 112px; }
body[data-level="simple"] .works-only { display: none !important; }
.ev-panel .ctl-row { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-start; margin: 0 0 10px; }
.ev-panel .ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ev-panel .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ev-ink); font-weight: 600; }

/* ---- “Detail ▸”: a native expander, its own arrow on the left of a plain label ------------------------- */
.ev-more { margin: 4px 0 10px; }
.ev-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: baseline; gap: 6px; font-size: 14px;
  color: var(--ev-ink); padding: 4px 0; user-select: none; }
.ev-more > summary::-webkit-details-marker { display: none; }
.ev-more > summary::marker { content: ''; }
.ev-more > summary::before { content: '▸'; display: inline-block; width: 1em; text-align: center; color: var(--ev-accent);
  transition: transform .15s ease; }
.ev-more[open] > summary::before { transform: rotate(90deg); }
.ev-more > summary:hover { color: var(--ev-accent); }
.ev-more-count { font-size: 12.5px; color: var(--ev-muted); }
.ev-more-count:empty, .ev-more[open] .ev-more-count { display: none; }
.ev-more-body { padding: 8px 0 2px 1.5em; }

/* ---- two-line buttons: the same fixed width AND a fixed taller height, so a long label wraps onto two
   centered lines instead of being cut off (.seg.two-line / .chips.two-line; combine with .wide / .xwide, and
   run warnCutOff() to catch a label that still needs three lines) ---------------------------------------- */
.chips.wide button { width: 128px; }
.chips.xwide button { width: 164px; }
.seg.two-line button, .chips.two-line button { height: 44px; white-space: normal; text-overflow: clip; line-height: 1.15;
  overflow-wrap: break-word; text-align: center; padding: 0 8px; }

/* ---- the control box’s footer: fixed-size buttons (“Copy link to this view”), bottom right ------------- */
.tool-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin: 2px 0 8px; }
.ev-panel > .tool-actions { grid-column: 1 / -1; border-top: 1px solid var(--ev-line); padding-top: 10px; margin-top: 4px; }

/* ---- the answer box: what the tool says right now — a kicker, one lede sentence, a row of number tiles --- */
.tool-answer { border: 1px solid var(--ev-line); border-left: 5px solid var(--ev-accent); background: var(--ev-panel); border-radius: 6px;
  padding: 18px 22px 16px; margin: 0 0 14px; min-width: 0; }
.tool-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ev-muted); font-weight: 600; margin: 0 0 8px; }
.tool-lede { font-size: 18px; line-height: 1.45; margin: 0 0 14px; max-width: 980px; }
.tool-lede:last-child, .tool-answer > :last-child { margin-bottom: 0; }
.tool-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 14px; }
.tool-tiles .tile { min-height: 108px; min-width: 0; padding: 10px 8px; border: 1px solid var(--ev-line); border-radius: 6px; background: var(--mf-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font: inherit; color: inherit; }
.tool-tiles .tile .k { font-size: 12.5px; color: var(--ev-muted); line-height: 1.3; }
.tool-tiles .tile .v { font-size: 30px; font-weight: 700; line-height: 1.15; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tool-tiles .tile .s { font-size: 12px; color: var(--ev-muted); line-height: 1.35; }
.tool-tiles .tile.lead { border: 2px solid var(--ev-accent); }
.tool-tiles .tile.lead .v { color: var(--ev-accent); }
.tool-tiles.small .tile { min-height: 88px; }
.tool-tiles.small .tile .v { font-size: 23px; }
.tool-tiles.big .tile { min-height: 124px; }
.tool-tiles.big .tile .v { font-size: 36px; }
/* a tile that is also a control (click to show that series) */
.tool-tiles button.tile { cursor: pointer; }
.tool-tiles button.tile:hover { border-color: var(--ev-accent); }
.tool-tiles button.tile[aria-pressed="true"] { border-color: var(--ev-accent); box-shadow: inset 0 0 0 1px var(--ev-accent); }

/* ---- a phone ------------------------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .tool-wrap { padding: 22px 16px 60px; }
  #app [id] { scroll-margin-top: 112px; }
  .tool-top h1 { font-size: 27px; }
  .tool-box { padding: 14px 16px; }
  .ev-tabs { scroll-margin-top: 72px; }
  .ev-tabs button { width: calc(50% - 1px); font-size: 14px; }
  .seg { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .seg button, .seg.wide button, .seg.xwide button, .seg.narrow button { width: 100%; border-right: 0; border-bottom: 1px solid var(--ev-line); margin-bottom: -1px; }
  .seg button:nth-child(odd) { border-right: 1px solid var(--ev-line); }
  .seg.xwide { grid-template-columns: 1fr; }
  .seg.xwide button:nth-child(odd) { border-right: 0; }
  .ev-panel { grid-template-columns: minmax(0, 1fr); }
  .ev-panel > .tool-level { grid-column: 1; justify-self: stretch; }
  .ev-panel .ctl { width: 100%; }
  .tool-actions { justify-content: center; }
  .tool-answer { padding: 14px 16px; }
  .tool-lede { font-size: 16.5px; }
  .tool-tiles, .tool-tiles.small, .tool-tiles.big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-tiles .tile .v, .tool-tiles.big .tile .v { font-size: 25px; }
  .tool-tiles.small .tile .v { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { .ev-more > summary::before { transition: none; } }

/* ==== the site header and footer (shared.js mountChrome) — copied from site.css; change both together ==== */
.mf-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.mf-header { border-bottom: 1px solid var(--mf-gridline); background: var(--mf-bg); position: sticky; top: 0; z-index: 50; line-height: 1.5; }
.mf-header a { text-decoration: none; }
.mf-header .mf-wrap { max-width: 1240px; }
.mf-header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.mf-brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.mf-brand a { color: var(--mf-ink); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.mf-brand-link { display: inline-flex; align-items: center; gap: 10px; }
.mf-brand-mark { width: 30px; height: 30px; border-radius: 7px; display: block; }
.mf-asof { font-size: 12px; font-weight: 400; color: var(--mf-muted); letter-spacing: .01em; }
.mf-nav { display: flex; gap: 14px; flex: 1 1 auto; flex-wrap: wrap; }
.mf-nav a { color: var(--mf-ink); font-size: 14px; padding: 4px 0; border-bottom: 2px solid transparent; }
.mf-nav a:hover { border-bottom-color: var(--mf-gridline); }
.mf-nav a.active { color: var(--mf-blue); border-bottom-color: var(--mf-blue); font-weight: 600; }
.mf-nav-div { align-self: center; width: 1px; height: 20px; background: var(--mf-gridline); }
.mf-nav-item { position: relative; display: inline-flex; }
.mf-nav-caret { font-size: 9px; color: var(--mf-muted); }
.mf-nav-drop { display: none; position: absolute; top: 100%; left: -12px; z-index: 60; min-width: 190px; width: max-content; padding: 6px 0;
  background: var(--mf-bg); border: 1px solid var(--mf-gridline); border-radius: 0 0 10px 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .12); }
.mf-nav-item:hover .mf-nav-drop, .mf-nav-item:focus-within .mf-nav-drop { display: block; }
.mf-nav-drop a { display: block; padding: 7px 16px; font-size: 13.5px; color: var(--mf-ink); border-bottom: 0; }
.mf-nav-drop a:hover { background: color-mix(in srgb, var(--mf-blue) 8%, var(--mf-bg)); color: var(--mf-blue); }
.mf-menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--mf-gridline); border-radius: 6px;
  width: 40px; height: 36px; cursor: pointer; color: var(--mf-ink); flex: 0 0 auto; }
.mf-search-btn { background: none; border: 1px solid var(--mf-gridline); border-radius: 6px; width: 34px; height: 32px; cursor: pointer;
  color: var(--mf-ink); font-size: 17px; line-height: 1; flex: 0 0 auto; }
.mf-search-btn:hover { border-color: var(--mf-blue); color: var(--mf-blue); }
.mf-search-overlay[hidden] { display: none; }
.mf-search-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(38, 38, 38, .35); display: flex; justify-content: center;
  align-items: flex-start; padding-top: 12vh; }
.mf-search-box { background: var(--mf-bg); border-radius: 10px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); overflow: hidden; }
.mf-search-input { width: 100%; border: 0; border-bottom: 1px solid var(--mf-gridline); padding: 14px 18px; font: inherit; font-size: 16px;
  color: var(--mf-ink); background: var(--mf-bg); outline: none; }
.mf-search-results { max-height: 50vh; overflow-y: auto; }
.mf-search-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 18px; color: var(--mf-ink); text-decoration: none; }
.mf-search-item.active { background: color-mix(in srgb, var(--mf-blue) 9%, transparent); }
.mf-search-item .l { font-size: 15px; }
.mf-search-item .s { font-size: 12px; color: var(--mf-muted); white-space: nowrap; }
.mf-search-empty { padding: 14px 18px; font-size: 13.5px; color: var(--mf-muted); }
.mf-skip { position: absolute; left: 8px; top: -48px; z-index: 100; background: var(--mf-blue); color: var(--mf-bg); padding: 8px 14px;
  border-radius: 0 0 8px 8px; font-size: 14px; transition: top .15s ease; text-decoration: none; }
.mf-skip:focus { top: 0; }
.mf-foot { border-top: 1px solid var(--mf-gridline); margin-top: 40px; padding: 20px 0 50px; color: var(--mf-muted); font-size: 13px; }
.mf-foot a { color: var(--mf-muted); text-decoration: underline; }
.mf-follow { margin: 0; }
.mf-original { display: inline-block; position: relative; max-width: 100%; font-size: 10px; line-height: 16px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; font-style: normal; color: var(--mf-blue); border: 1px solid var(--mf-blue); border-radius: 999px; padding: 0 8px;
  text-decoration: none; white-space: nowrap; vertical-align: middle; }
.mf-original::after { content: ''; position: absolute; inset: -10px -6px; }
.mf-original:hover { background: color-mix(in srgb, var(--mf-blue) 10%, var(--mf-bg)); }
.mf-original-line { font-size: 13px; color: var(--mf-muted); margin: -6px 0 16px; }
.mf-original-line a:not(.mf-original) { color: var(--mf-muted); text-decoration: underline; }
.mf-original-line a:not(.mf-original):hover { color: var(--mf-blue); }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--mf-blue); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 1100px) {
  .mf-menu-btn { display: block; }
  .mf-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--mf-bg); border-bottom: 1px solid var(--mf-gridline); padding: 6px 24px 14px; }
  .mf-nav.open { display: flex; }
  .mf-nav a { padding: 10px 0; border-bottom: 1px solid var(--mf-gridline); }
  .mf-nav a.active { border-bottom-color: var(--mf-gridline); }
  .mf-nav-div, .mf-nav-drop, .mf-nav-caret { display: none !important; }
  .mf-nav-item { display: block; }
  .mf-nav-item > a { display: block; padding: 10px 0; border-bottom: 1px solid var(--mf-gridline); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .mf-nav { left: auto; right: 24px; width: 280px; padding: 4px 18px 10px; border: 1px solid var(--mf-gridline); border-top: 0;
    border-radius: 0 0 10px 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .12); }
}
@media (min-width: 1101px) and (max-width: 1219px) {
  .mf-header-inner { gap: 14px; }
  .mf-nav { gap: 10px; }
  .mf-nav > a, .mf-nav-item > a { font-size: 13.5px; }
}
@media (max-width: 560px) { .mf-original { font-size: 9px; letter-spacing: .02em; padding: 0 6px; } }
@media (max-width: 440px) {
  .mf-header-inner { gap: 12px; }
  .mf-brand { flex-direction: column; align-items: flex-start; gap: 0; }
  .mf-asof { font-size: 11px; line-height: 1.2; padding-left: 40px; margin-top: -3px; }
  .mf-asof:empty { display: none; }
}
