/* Type and paper borrowed from Route Sculptor; route in Stanford cardinal. */
:root { --route: #8c1515; --warm: #c9a24a; --paper: #fafafa; --map-paper: #f1f2ec;
  --ink: #343b35; --quiet: #677062; --line: #d9dad5;
  --serif: 'EB Garamond', Georgia, serif; --mono: 'JetBrains Mono', monospace; color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 19px/1.45 var(--serif); }
/* Paper grain over the page, outside the interaction layer. */
body::before { content: ""; position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: .3; mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E") 0 0 / 160px; }
.page { max-width: 1180px; margin: auto; padding: 22px 24px 32px; box-sizing: border-box; }
.site-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 20px;
  border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.wordmark { font: 400 30px/36px var(--serif); letter-spacing: -.6px; }
nav { display: flex; align-items: center; justify-content: flex-end; gap: 20px; margin-bottom: 4px; font: 12px var(--mono); }
/* Handwritten headings (?handwriting): each phrase image is sized in x-heights. */
.is-hw { --xh: .26em; white-space: nowrap; }
.label.is-hw, .label .is-hw { --xh: 4.5px; display: inline-block; }
.is-hw img { height: calc(var(--h) * var(--xh)); width: calc(var(--w) * var(--xh));
  vertical-align: calc(var(--b) * var(--xh) * -1); margin-right: calc(var(--xh) * .9); }
.is-hw img:last-child { margin-right: 0; }
a { color: var(--quiet); text-decoration: none; }
.label { display: flex; justify-content: space-between; align-items: center; font: 11px var(--mono); color: var(--quiet); text-transform: lowercase; margin: 0 0 6px; font-weight: 400; }
/* A small "i" across from each box's title opens a note on how to read the box. */
.info { width: 17px; height: 17px; padding: 0; border-radius: 50%; font: italic 500 12px/15px var(--serif); text-transform: none; flex-shrink: 0; }
#note { border: 1px solid var(--line); padding: 20px 44px 20px 22px; max-width: min(520px, 90vw); background: var(--paper); color: var(--ink); }
#note p { margin: 0 0 10px; font-size: 17px; line-height: 1.45; }
#note p:last-child { margin-bottom: 0; }
#note a { color: var(--route); }
#note .close { position: absolute; top: 8px; right: 8px; border: 0; padding: 4px 8px; font: 18px/1 var(--serif); }
#note::backdrop { background: rgb(52 59 53 / .35); }
.layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; }
.layout section > .panel + .label { margin-top: 20px; }
.panel { border: 1px solid #d7dad2; background: var(--paper); }
.pad { padding: 12px; }
.quiet, label, .bottom, .eyebrow, .legend, #update-note { font: 11px/1.6 var(--mono); color: var(--quiet); }
.quiet { margin: 0 0 8px; }
.eyebrow, .bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; }
.eyebrow { border-bottom: 1px solid #dde0d8; }
.bottom { border-top: 1px solid #dde0d8; min-height: 18px; }
.eyebrow input { vertical-align: middle; width: 120px; accent-color: var(--route); }
.map-wrap { position: relative; overflow: hidden; background: var(--map-paper); }
/* Drawn a quarter of a view larger on every side; main.js positions it with a transform. */
#streets { position: absolute; left: 0; top: 0; width: 150%; height: 150%; transform-origin: 0 0; pointer-events: none; will-change: transform; }
#progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--route); transition: width .2s; }
#map { position: relative; display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; user-select: none; }
#map.is-traffic { cursor: cell; }
.bottom .buttons { margin: 0; gap: 4px; flex-shrink: 0; }
.bottom button { padding: 4px 10px; }
button.is-on { border-color: var(--warm); color: var(--ink); background: color-mix(in srgb, var(--warm) 18%, transparent); }

.cell { fill: none; stroke: var(--route); stroke-opacity: .45; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.cell.is-fetched { fill: var(--route); fill-opacity: .13; stroke: none; }
.cell-label { font-family: var(--mono); fill: #9aa394; pointer-events: none; }
.jam, .oracle, .ride { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
  vector-effect: non-scaling-stroke; }
.jam { stroke: var(--warm); stroke-width: 2.4; }
.oracle { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: .55; }
.ride { stroke: var(--route); stroke-width: 3.2; }
.origin, .destination, .car { stroke: var(--ink); stroke-width: 1.8; vector-effect: non-scaling-stroke; pointer-events: none; }
.car { fill: var(--warm); }
.ride.flash { animation: flash .6s; }
@keyframes flash { from { stroke: var(--warm); stroke-width: 7; } }
.origin { fill: var(--ink); }
.destination { fill: var(--paper); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; }
.key { display: inline-block; vertical-align: middle; width: 18px; height: 0; border-top: 3px solid; margin-right: 6px; }
.key.ride { border-color: var(--route); }
.key.oracle { border-top: 2px dashed var(--ink); opacity: .6; }
.key.fetched { height: 10px; border: 0; background: var(--route); opacity: .25; }
.key.jam { border-color: var(--warm); }

/* One row of pixels per PIR query: the server sees noise and nothing else. */
.strips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-bottom: 10px; }
.strips figure { margin: 0; min-width: 0; }
.strips figcaption, #driving p { font: 10px var(--mono); color: var(--quiet); margin: 0 0 3px; }
.noise { display: block; width: 100%; height: 72px; image-rendering: pixelated; }
#totals, #schedule { margin-bottom: 4px; min-height: 1.6em; }
#driving { margin-bottom: 10px; }
#ticks { display: block; width: 100%; }

button { border: 1px solid #c8cfc2; background: transparent; color: var(--quiet); font: 11px var(--mono); padding: 8px 12px; cursor: pointer; }
button:hover { border-color: var(--route); color: var(--route); }
.buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.partition-controls { flex-wrap: wrap; }
button:disabled { opacity: .55; cursor: default; }
.meter { display: grid; grid-template-columns: 104px 1fr 56px; align-items: center; gap: 8px; font: 11px var(--mono); color: var(--quiet); margin-bottom: 6px; }
.meter div { height: 10px; background: #eceee8; }
.meter i { display: block; height: 100%; width: 0; background: var(--route); transition: width .3s; }
.meter i.full { background: var(--warm); }
.meter i.ink { background: var(--quiet); }
.cost .meter:last-child { margin-bottom: 0; }
.key.car { width: 8px; height: 8px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--warm); }

.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.figures button { display: grid; gap: 6px; padding: 8px; background: #fff; text-align: left; }
.figures img { width: 100%; height: 110px; object-fit: contain; }
#results { margin-top: 24px; }
#figure { border: 1px solid var(--line); padding: 16px; max-width: min(980px, 94vw); cursor: zoom-out; }
#figure figure { margin: 0; }
#figure img { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto; }
#figure figcaption { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 4px; font-size: 16px; line-height: 1.4; }
#figure figcaption p { margin: 8px 0 0; }

#figure::backdrop { background: rgb(52 59 53 / .45); }
.meter b { font-weight: 400; text-align: right; }
#update-note { margin: 10px 0 0; color: var(--ink); }

/* Laid out like a paper's summary: a run-in label per item, the protocol as numbered steps. */
.how p, .how ol { margin: 0 0 7px; font-size: 16px; line-height: 1.4; }
.how ol { padding-left: 20px; display: grid; gap: 4px; }
.how b { font-weight: 500; }
.how a, .refs a { color: var(--route); text-decoration: none; }
.traffic b { font-weight: 400; color: var(--ink); }
.notes { margin-top: 12px; border-top: 1px solid #dde0d8; padding-top: 8px; }
.notes summary { font: 10.5px var(--mono); color: var(--quiet); cursor: pointer; }
.notes summary:hover { color: var(--route); }
.notes p { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--quiet); }
.refs li:target { background: color-mix(in srgb, var(--warm) 22%, transparent); }
.refs { margin: 0; padding: 12px 12px 12px 32px; display: grid; gap: 4px; font-size: 14px; line-height: 1.35; }
.refs a { text-decoration: none; }
.places circle { fill: var(--ink); }
.places text { font-family: var(--mono); fill: var(--ink); paint-order: stroke; stroke: #f3f4ef; stroke-width: 3.5px; stroke-linejoin: round; }
.key.place { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--ink); }
.eyebrow .buttons { margin: 0; gap: 4px; }
.eyebrow button { padding: 4px 10px; }
.credits { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 32px;
  padding-top: 16px; border-top: 1px solid var(--line); font: 11px var(--mono); color: var(--quiet); }

@media (min-width: 821px) {
  .layout > section:first-child { position: sticky; top: 12px; align-self: start; }
  .layout > section:first-child > .panel { max-width: calc(100vh - 150px); }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}
/* Phones: 16px gutters, and let the header and the map toolbar wrap instead of overflowing. */
@media (max-width: 560px) {
  .page { padding: 16px 16px 24px; }
  .site-header { grid-template-columns: 1fr; gap: 8px; }
  nav { justify-content: flex-start; }
  nav { flex-wrap: wrap; gap: 6px 16px; }
  .eyebrow, .bottom { flex-wrap: wrap; }
  .eyebrow .buttons, .bottom .buttons { flex-wrap: wrap; }
}

/* Map switch in the middle of the header, and the from / to landmark search. */
.maps { display: inline-flex; gap: 14px; margin-bottom: 4px; font: 12px var(--mono); }
.maps a.is-on { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.search { gap: 12px; flex-wrap: wrap; font: 11px var(--mono); color: var(--quiet); }
.search label { display: flex; align-items: center; gap: 6px; flex: 1 1 200px; }
.search input { flex: 1; min-width: 0; font: 12px var(--mono); padding: 3px 6px; border: 1px solid #c9cdc2; border-radius: 3px; background: #fbfbf8; color: var(--ink); }

/* usa.html: a replay of recorded country-scale results (usa.js). */
#usa { display: block; width: 100%; cursor: pointer; }
.blocks { display: block; width: 100%; height: 72px; }
.key.dot { width: 7px; height: 7px; border: 0; border-radius: 50%; background: var(--ink); opacity: .6; }
.key.dot.bad { background: var(--route); opacity: 1; }
#count { white-space: nowrap; }
.cost .partition-controls { margin-bottom: 10px; }
.eyebrow.wrap { flex-wrap: wrap; }
.eyebrow.wrap .buttons { flex-wrap: wrap; }
.eyebrow.wrap button, .partition-controls button { white-space: nowrap; }
