/* The page of totals: on top of site.css */

/* the links back, as on the report pages (update.py, BACK_STYLE) */
.back-bar { max-width: 1100px; margin: 14px auto 0; padding: 0 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.back-to-main {
  display: inline-block; padding: 4px 12px; border: 1px solid var(--green); border-radius: 3px;
  background: #fff; color: var(--green); font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
.back-to-main:hover { background: var(--green); color: #fff; }

:root {
  /* the traffic lights, as on the report pages */
  --red: #9B2C1F;
  --yellow: #C08A1E;
  --fine: #59935B;
  --info: #2C5577;
  --na: #DAD8D3;
  /* categorical: the dataviz reference palette's first three, plus the site's green */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --grid: #DEDCD7;
  --surface: #FCFCFB;
}

main { max-width: 1100px; }
.updated { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.loading { color: var(--muted); }

.warning {
  margin: 24px 0 20px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: 3px;
}

/* the list of sections */
.contents { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 28px; }
.contents a {
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  font-size: 0.9rem; text-decoration: none;
}
.contents a:hover { border-color: var(--green); }

/* a section: its heading, then its cards in a grid */
.section { margin: 0 0 44px; scroll-margin-top: 12px; }
.section > h2 {
  margin: 0 0 4px; font-size: 1.6rem; color: var(--green-dark);
  border-bottom: 2px solid var(--green); padding-bottom: 4px;
}
.section > .lede { margin: 6px 0 14px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 16px 12px; min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 2px; font-size: 1.05rem; line-height: 1.3; }
.card .note { margin: 2px 0 8px; font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
.card .say { margin: 8px 0 0; font-size: 0.92rem; }
.card svg { display: block; width: 100%; height: auto; overflow: visible; }
.card svg text { font-family: inherit; fill: var(--text); }
.card svg .muted { fill: var(--muted); }
.card svg .axis line, .card svg .grid line { stroke: var(--grid); stroke-width: 1; }
.card svg .axis text { fill: var(--muted); font-size: 11px; }
.card svg .hit { fill: transparent; }
.card svg [data-tip] { cursor: default; }
.card svg a [data-tip] { cursor: pointer; }
.card svg .ref { stroke: var(--text); stroke-width: 1; }

/* the big numbers */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px;
  border-top: 3px solid var(--green-light);
}
.tile b { display: block; font-size: 1.75rem; line-height: 1.15; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.tile span { display: block; font-size: 0.86rem; color: var(--muted); line-height: 1.3; margin-top: 3px; }
.tile.red { border-top-color: var(--red); }
.tile.red b { color: var(--red); }
.tile.yellow { border-top-color: var(--yellow); }
.tile.yellow b { color: #7A4F00; }
.card .tiles { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); }
.card .tile { background: var(--surface); }
.card .tile b { font-size: 1.4rem; }

/* legends and buttons */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 6px; font-size: 0.85rem; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend i.dot { border-radius: 50%; }
.buttons { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.buttons button, .controls select, .controls label {
  font: inherit; font-size: 0.85rem; padding: 2px 10px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--surface); color: var(--green); cursor: pointer;
}
.buttons button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.controls { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 8px; font-size: 0.88rem; }
.controls select { color: var(--text); max-width: 100%; }
.controls label { color: var(--text); display: inline-flex; gap: 4px; align-items: center; }

/* lists of words and of works */
.words { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; line-height: 1.25; margin-top: 6px; }
.words span { color: var(--green-dark); }
.works { margin: 6px 0 0; padding-left: 22px; font-size: 0.9rem; }
.works li { margin: 0 0 6px; overflow-wrap: anywhere; }
.works .n { font-weight: 600; color: var(--green-dark); }
.works .where { color: var(--muted); }
.messages { margin: 6px 0 0; padding: 0; list-style: none; font-size: 0.85rem; }
.messages li { display: flex; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.messages b { min-width: 2.2em; text-align: right; color: var(--red); font-variant-numeric: tabular-nums; }
.messages code { overflow-wrap: anywhere; }
.records { margin: 6px 0 0; padding: 0; list-style: none; }
.records li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 0.93rem; overflow-wrap: anywhere; }
.records b { color: var(--green-dark); }

/* the table view under a chart */
details.table-view { margin-top: 8px; font-size: 0.85rem; }
details.table-view summary { cursor: pointer; color: var(--green); }
details.table-view table { border-collapse: collapse; margin-top: 4px; width: 100%; }
details.table-view th, details.table-view td { text-align: left; padding: 2px 8px 2px 0; border-bottom: 1px solid var(--line); }
details.table-view td.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

/* the box that names what the pointer is on */
.tip {
  position: fixed; z-index: 10; max-width: 320px; pointer-events: none;
  background: #262624; color: #fff; padding: 6px 9px; border-radius: 4px;
  font-size: 0.82rem; line-height: 1.4; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.tip b { color: #fff; }

@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile b { font-size: 1.4rem; }
}
