/* Recession Explorer. The Lab's shared vocabulary (wrap, crumb, sub, hero, disclaim, ctl-row, seg, panel, tbl)
   plus this page's own: the control block and the slim bar that follows the reader, the tiles, the
   cards with their takeaways, the chart extras, the scorecard. Colors come from the site theme. */
:root {
  --ink: var(--mf-ink);
  --muted: var(--mf-muted);
  --accent: var(--mf-blue);
  --line: var(--mf-gridline);
  --panel: color-mix(in srgb, var(--mf-gridline) 18%, var(--mf-bg));
  --warn: color-mix(in srgb, var(--mf-gold) 14%, var(--mf-bg));
  --soft: color-mix(in srgb, var(--mf-blue) 9%, var(--mf-bg));
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mf-bg); color: var(--ink); font-family: var(--mf-font); }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 0; }
.wrap.last { padding-bottom: 80px; }
a { color: var(--accent); }
.crumb { font-size: 14px; margin: 0 0 22px; }
h1 { font-size: 32px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 26px 0 8px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 16px; max-width: 1040px; line-height: 1.5; }
.note { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0 0 14px; max-width: 900px; }
.note.small { font-size: 12.5px; }
.block { margin: 44px 0 0; }
/* a link to any part of the page lands clear of the bar that stays with the reader */
.wrap [id], .controls { scroll-margin-top: 76px; }

/* hero */
.hero { border: 1px solid var(--line); border-left: 5px solid var(--accent); background: var(--panel); border-radius: 6px; padding: 16px 22px; margin: 0 0 12px; }
.hero .kicker { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.hero .lede { font-size: 16.5px; line-height: 1.5; margin: 0 0 10px; max-width: 1040px; }
.hero .lede:last-child { margin-bottom: 0; }
.hero .lede b { color: var(--accent); }
.disclaim { font-size: 12.5px; color: var(--muted); background: var(--warn); border: 1px solid var(--line); border-radius: 5px; padding: 7px 12px; margin: 0 0 12px; }

/* the control block */
.controls { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px 4px; margin: 0 0 4px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-start; margin: 0 0 10px; }
.ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctl > label, .ctl > .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink); font-weight: 600; }
.seg { display: inline-flex; align-self: flex-start; flex-wrap: wrap; border: 1px solid var(--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(--line); background: var(--mf-bg); color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--mf-bg); }
.seg button:disabled { color: var(--muted); cursor: not-allowed; background: var(--panel); }
.seg.wide button { width: 164px; }
.seg.xwide button { width: 216px; }
.seg.narrow button { width: 92px; }
/* chips: one fixed size, wrapping into rows */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-family: inherit; font-size: 13px; width: 74px; height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--mf-bg); color: var(--ink); cursor: pointer; padding: 0; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--mf-bg); }
.chips button.today { border-style: dashed; border-color: var(--ink); }
.chips button.today[aria-pressed="true"] { border-style: solid; border-color: var(--accent); }
.chips button:disabled { color: var(--muted); cursor: not-allowed; background: var(--panel); }
.ctl > label.check, .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; height: 34px; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--mf-blue); }
.mnote { font-size: 13.5px; line-height: 1.5; color: var(--ink); margin: -2px 0 10px; max-width: 1040px; }
.mnote .warn, .warn { color: var(--mf-red); font-weight: 600; }
.btn { font-family: inherit; font-size: 13px; height: 34px; width: 176px; border: 1px solid var(--line); border-radius: 5px; background: var(--mf-bg); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--ink); }
select { font-family: inherit; font-size: 14px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--mf-bg); color: var(--ink); max-width: 100%; }

/* the slim bar that stays with the reader: fixed, so showing it moves nothing; it slides in once the control box is off the screen */
.pin { position: fixed; top: 0; left: 0; right: 0; z-index: 6; background: var(--mf-bg); border-bottom: 1px solid var(--line); transform: translateY(-110%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; }
.pin.on { transform: none; visibility: visible; transition: transform .18s ease; }
.pin .in { max-width: 1120px; margin: 0 auto; padding: 8px 20px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13.5px; }
.pin select { width: 236px; }
.pin select#pinM { width: 290px; }
.pin .what { color: var(--muted); flex: 1 1 240px; min-width: 0; line-height: 1.35; }
.pin a { font-size: 13px; white-space: nowrap; }

/* cards */
.card { margin: 34px 0 0; min-width: 0; }
.card h2 { font-size: 20px; margin: 0 0 4px; }
.take { font-size: 15.5px; line-height: 1.5; margin: 0 0 10px; max-width: 900px; }
.take b { color: var(--accent); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.pair > .card { margin-top: 34px; display: grid; grid-template-rows: subgrid; grid-row: span 3; }
.panel { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 6px; background: var(--mf-bg); min-width: 0; margin: 8px 0 0; }
.panel svg { max-width: 100%; height: auto; display: block; }
/* the shared download row, at a width that keeps its three buttons on one line under a half-width chart */
.wrap .ev-dlbar .ev-dl { width: 156px; }
.rx-fig { height: auto; }
.rx-fig .mf-fig-meta { margin-bottom: 4px; gap: 16px; }
.rx-fig .mf-fig-meta .datestamp { text-align: right; flex: 0 0 auto; max-width: 30%; }
.rx-fig .mf-fig-meta .units { font-size: 12px; line-height: 1.35; }
.rx-fig .mf-fig-foot .src, .rx-fig .mf-fig-foot .mark { font-size: 10.5px; }
.rx-fig .mf-fig-legend { font-size: 12px; gap: 6px 16px; }
.rx-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 6px 0 0; }
.rx-empty { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 170px; font-size: 13.5px; color: var(--muted); background: var(--panel); border-radius: 4px; padding: 14px; line-height: 1.5; }

/* tiles: content centered both ways */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 10px 0 0; }
.tile { border: 1px solid var(--line); border-radius: 6px; background: var(--mf-bg); padding: 12px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 164px; min-width: 0; }
.tile .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); line-height: 1.3; }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.1; margin: 7px 0 5px; white-space: nowrap; }
.tile .v.sm { font-size: 19px; white-space: normal; }
.tile .d { font-size: 12.5px; line-height: 1.35; }
.tile .o { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 3px; }

/* the hover tip */
.rx-tip { position: absolute; z-index: 50; display: none; pointer-events: none; background: var(--mf-bg); border: 1px solid var(--ink); border-radius: 4px; padding: 7px 9px; font-family: var(--mf-font); font-size: 12.5px; line-height: 1.4; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); max-width: 290px; }
.rx-tip .tt { font-weight: 700; }
.rx-tip .mu { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.rx-tip .row { display: flex; align-items: center; gap: 6px; }
.rx-tip .row .v { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rx-tip .row.tot { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; }
.rx-tip .sw { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.rx-tip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); flex: 0 0 auto; }

/* tables: every column centered (house rule) */
.tablewrap { overflow-x: auto; margin: 10px 0 0; }
/* a table wider than the page scrolls sideways; a styled scrollbar stays visible, so the reader can see there is more */
.tablewrap::-webkit-scrollbar { height: 9px; }
.tablewrap::-webkit-scrollbar-track { background: var(--line); border-radius: 5px; }
.tablewrap::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 5px; }
.tbl { border-collapse: collapse; font-size: 13.5px; min-width: 100%; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: center; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; line-height: 1.3; }
.tbl th[aria-sort] { color: var(--ink); }
/* a column heading that sorts: the heading's own words, reachable by keyboard */
.sortbtn { all: unset; cursor: pointer; display: block; padding: 8px 2px; margin: -8px -2px; }
.sortbtn:hover { color: var(--ink); }
.sortbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sortbtn .arr { font-size: 9px; }
.tbl.score { font-size: 13px; }
.tbl.score th, .tbl.score td { padding: 6px 6px; }
.tbl.score th { font-size: 10.5px; }
.tbl .dt { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.tbl.sticky th:first-child, .tbl.sticky td:first-child { position: sticky; left: 0; z-index: 1; background: var(--mf-bg); }
.tbl.sticky tr.pick td:first-child { background: var(--soft); }
/* side by side: one metric per row, so the row labels wrap rather than push the numbers off a phone */
.tbl.side td.nm { white-space: normal; max-width: 260px; }
.tbl tr.pick td { background: var(--soft); font-weight: 600; }
.tbl tr.avg td { font-weight: 700; border-top: 2px solid var(--ink); }
.tbl td.nm { font-weight: 600; white-space: nowrap; }
.tbl td.nw { white-space: nowrap; }
.tbl td.inv { color: var(--mf-bg); }
.tbl td.na { color: var(--muted); font-style: italic; white-space: nowrap; }
.tablecap { font-size: 15px; font-weight: 700; text-align: center; margin: 2px 0 2px; }
.rx-tablesrc { font-size: 10.5px; font-style: italic; color: var(--muted); margin: 8px 0 0; text-align: left; }
.rx-tablesrc a { color: inherit; text-underline-offset: 2px; }
.tablesub { font-size: 12px; text-align: center; margin: 0 0 6px; line-height: 1.4; }
.strip td svg { display: block; margin: 0 auto; width: 190px; height: auto; }
/* the Today strip: its long row names wrap, and the picture column keeps its width */
.tbl.strip td.nm { white-space: normal; text-align: center; min-width: 120px; }
.tbl.strip td:last-child, .tbl.strip th:last-child { min-width: 200px; }
@media (max-width: 600px) {
  /* a phone has room for the name, today’s number and the picture: the average and the range, which the picture
     shows as the diamond and the bar, give way */
  .tbl.strip th:nth-child(3), .tbl.strip td:nth-child(3), .tbl.strip th:nth-child(4), .tbl.strip td:nth-child(4) { display: none; }
  .tbl.strip { table-layout: fixed; width: 100%; min-width: 0; font-size: 12.5px; }
  .tbl.strip th, .tbl.strip td { padding: 6px 3px; }
  .tbl.strip th:first-child { width: 38%; }
  .tbl.strip th:nth-child(2) { width: 20%; }
  .tbl.strip td.nm { min-width: 0; font-size: 12px; }
  .tbl.strip td:last-child, .tbl.strip th:last-child { min-width: 0; }
  .strip td svg { width: 100%; max-width: 130px; }
}
.scale { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin: 6px 0; }
.scale i { width: 160px; height: 9px; border-radius: 2px; display: inline-block; }

/* prose in The Works */
.prose p { font-size: 15.5px; line-height: 1.6; margin: 0 0 12px; max-width: 900px; }
.prose ul { margin: 0 0 14px; padding-left: 1.2em; max-width: 900px; }
.prose li { font-size: 15.5px; line-height: 1.55; margin: 0 0 8px; }
.prose dl { max-width: 900px; margin: 0 0 14px; }
.prose dt { font-weight: 700; margin: 14px 0 3px; font-size: 15.5px; }
.prose dd { margin: 0; font-size: 15px; line-height: 1.55; }
.bottomline { border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 6px; padding: 14px 20px 4px; margin: 12px 0 8px; max-width: 940px; }
.bottomline h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 8px; }
.v { white-space: nowrap; }

@media (max-width: 1100px) {
  .tbl.score th, .tbl.score td { padding: 6px 4px; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  /* the bar that follows the reader wraps to two or three lines here */
  .wrap [id], .controls { scroll-margin-top: 112px; }
}
@media (max-width: 420px) {
  .seg .opt { display: none; }
}
@media (max-width: 760px) {
  .pair { grid-template-columns: 1fr; }
  .tbl.side td.nm { max-width: 116px; font-size: 12.5px; }
  .tbl.side th, .tbl.side td { padding: 7px 6px; }
  h1 { font-size: 27px; }
  .hero { padding: 16px 16px; }
  .hero .lede { font-size: 17.5px; }
  /* on a phone a row of buttons becomes an even grid: equal widths, nothing cut off */
  .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(--line); margin-bottom: -1px; }
  .seg button:nth-child(odd) { border-right: 1px solid var(--line); }
  .seg.xwide { grid-template-columns: 1fr; }
  .seg.xwide button:nth-child(odd) { border-right: 0; }
  .seg.narrow { grid-template-columns: repeat(4, 1fr); }
  .seg.narrow button { border-right: 1px solid var(--line); font-size: 12px; padding: 0 2px; }
  .seg.narrow button:last-child { border-right: 0; }
  .ctl { width: 100%; }
  .chips button { width: calc(25% - 5px); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .pin select { width: calc(50% - 7px); }
  .pin .what { display: none; }
}

/* the four tabs: one fixed size; two by two on a phone */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; }
.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(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.page > .card:first-child, .page > .block:first-child, .page > .pair:first-child > .card { margin-top: 10px; }
/* the baseline list */
select.msel { width: 300px; }
@media (max-width: 600px) {
  .tabs button { width: calc(50% - 1px); font-size: 14px; }
  select.msel { width: 100%; }
}

/* the warning at the head of the Today tab: a light red box */
.caution { font-size: 14px; line-height: 1.5; margin: 10px 0 0; padding: 10px 14px; border-radius: 5px;
  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)); }
.caution + .card { margin-top: 22px; }

/* the Compare tab: its contents line, the ranker’s menu and one-line note, the four headline tiles, the
   scorecard’s shading and the head-to-head table */
.toc { font-size: 14px; line-height: 1.6; margin: 0; max-width: 900px; }
select.rsel { width: 480px; }
.rnote { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin: -2px 0 8px; max-width: 900px; }
.tiles.four { grid-template-columns: repeat(4, 1fr); max-width: 940px; }
.tiles.four .tile { min-height: 150px; }
#score-scale i { background: linear-gradient(90deg, var(--mf-bg), color-mix(in srgb, var(--mf-red) 40%, var(--mf-bg))); border: 1px solid var(--line); }
.tbl tr.sec td { text-align: center; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--panel); position: static; }
@media (max-width: 900px) {
  .tiles.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  select.rsel { width: 100%; }
  /* head to head with three picks is five columns: on a phone they must all fit the box without a sideways scroll */
  .tbl.side { font-size: 12px; table-layout: fixed; width: 100%; min-width: 0; }
  .tbl.side th, .tbl.side td { padding: 6px 2px; white-space: normal; overflow-wrap: break-word; }
  .tbl.side th:first-child { width: 31%; }                 /* a fixed layout takes its widths from the first row */
  .tbl.side td.nm { max-width: none; font-size: 11.5px; white-space: normal; }
  .tbl.side td.na { white-space: normal; }
  .tbl tr.sec td { white-space: normal; font-size: 10.5px; }
}
