/* What's in a Name? — sidebar on the left, the chart fills the rest. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: var(--blue); }
button, select, input { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.side { padding: 22px 20px 28px; border-right: 1px solid var(--rule-soft); min-height: calc(100vh - var(--appnav-h, 0px)); }
.stage { position: sticky; top: var(--appnav-h, 0px); height: calc(100vh - var(--appnav-h, 0px)); overflow: hidden; }

h1 { font-size: 26px; line-height: 1.1; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.lede { margin: 0 0 18px; }
.reading strong { font-variant-numeric: tabular-nums; }

.field { margin: 0 0 14px; }
.field[hidden] { display: none; }
.lab { display: block; font-size: 12px; color: var(--ink-2); margin: 0 0 5px; }
.lab .dim { color: var(--ink-3); }
.lab output { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 4px; }
select, input[type="search"] { width: 100%; padding: 6px 8px; border: 1px solid #bbb; border-radius: 3px; background: var(--paper); }
input[type="range"] { width: 100%; accent-color: var(--ink); }
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.views { display: grid; gap: 4px; }
.views button, .seg button { border: 1px solid #bbb; background: var(--paper); padding: 6px 10px; border-radius: 3px; text-align: left; cursor: pointer; }
.views button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.views button:hover:not([aria-pressed="true"]), .seg button:hover:not([aria-pressed="true"]) { background: var(--wash); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg button { text-align: center; }

.search { position: relative; }
#matches { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: var(--paper); border: 1px solid #bbb; border-radius: 3px; max-height: 300px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
#matches li { padding: 6px 8px; cursor: pointer; font-size: 14px; }
#matches li small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
#matches li[aria-selected="true"], #matches li:hover { background: var(--wash); }
#matches li.none { color: var(--ink-2); cursor: default; }

.chips { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.chips li { display: flex; align-items: center; gap: 7px; font-size: 14px; padding: 4px 6px 4px 8px; border: 1px solid var(--rule-soft); border-radius: 3px; }
.chips li i { flex: none; width: 12px; height: 3px; border-radius: 1px; }
.chips li span { flex: 1; min-width: 0; }
.chips li small { color: var(--ink-2); }
.chips li button { border: 0; background: none; cursor: pointer; color: var(--ink-2); font-size: 17px; line-height: 1; padding: 0 2px; }
.chips li button:hover { color: var(--ink); }

.reading { border-top: 1px solid var(--rule-soft); padding: 12px 0 2px; margin: 4px 0 14px; }
.reading p { margin: 0 0 10px; }
.reading .note { color: var(--ink-2); font-size: 13px; }
.reading table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13.5px; margin: 0 0 12px; }
.reading td { padding: 3px 0; border-top: 1px solid var(--rule-soft); vertical-align: top; }
.reading td:last-child { text-align: right; padding-left: 8px; }
.reading h3 { font-size: 14px; margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.reading h3 i { width: 12px; height: 3px; border-radius: 1px; }
.reading .pick { border: 1px solid #bbb; background: var(--paper); border-radius: 3px; padding: 2px 7px; margin: 0 4px 4px 0; cursor: pointer; font-size: 13px; }
.reading .pick[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.more { font-size: 13px; margin: 18px 0 0; }

#chart { display: block; width: 100%; height: 100%; font-family: var(--sans); }
#chart text { fill: var(--ink); font-size: 12px; }
#chart .axis text { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
#chart .axis path, #chart .axis line { stroke: #c8c8c8; }
#chart .gridline { stroke: #ececec; }
#chart .title { font-size: 15px; font-weight: 700; }
#chart .subtitle { fill: var(--ink-2); font-size: 12.5px; }
#chart .line { fill: none; stroke-width: 2; }
#chart .line.faint { stroke: #d4d4d4; stroke-width: 1; }
#chart .end { font-weight: 700; }
#chart .rule { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
#chart .state { stroke: #fff; stroke-width: 0.8; cursor: default; }
#chart .row-name { cursor: pointer; }
#chart .row-name:hover { text-decoration: underline; }
#chart .num { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
#chart .mid { stroke: var(--ink-3); stroke-dasharray: 3 3; }
#chart .hit { fill: transparent; cursor: pointer; }
#chart .hit:hover { fill: var(--wash); }

.tip { position: absolute; z-index: 10; pointer-events: none; background: var(--ink); color: var(--paper); padding: 7px 9px; border-radius: 3px; font-size: 13px; line-height: 1.35; max-width: 300px; font-variant-numeric: tabular-nums; }
.tip b { font-weight: 700; }
.tip .dim { color: #bbb; }
.tip i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 5px; }

.loading[hidden] { display: none; }
.loading button { pointer-events: auto; }
.loading { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--ink-2); pointer-events: none; }

.sources { max-width: 760px; padding: 32px 20px 60px; margin: 0 auto; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.sources h2 { font-size: 18px; margin: 0 0 12px; }
.sources dt { font-weight: 700; margin: 14px 0 3px; }
.sources dd { margin: 0; color: #333; }
.sources code { font-family: var(--mono); font-size: 12.5px; }
.built { color: var(--ink-3); font-size: 12px; margin-top: 24px; }

/* Phones: title and view buttons, then the chart, then everything else. */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { display: contents; }
  .side .top, .side .rest { padding: 18px 16px 4px; }
  .side .top { order: 0; }
  .stage { order: 1; position: relative; top: 0; height: 72vh; min-height: 440px; border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
  .side .rest { order: 2; }
  .views { grid-template-columns: 1fr 1fr; }
}
