/* Broadway Culvert 3D model. Barlow is OFL (fonts/OFL-Barlow.txt). */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/barlow-400-latin.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/barlow-500-latin.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/barlow-600-latin.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/barlow-condensed-500-latin.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/barlow-condensed-600-latin.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/barlow-condensed-700-latin.woff2') format('woff2'); }
/* The reset the artifact host used to supply. */
html { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
[hidden] { display: none !important; }
/* Layout: a full-bleed model with a drawing-style title block, a key-numbers panel, and a control rail along the bottom.
   Orange (--accent) means one thing: the selected control. Everything else is ink, muted ink or rule. */
:root {
  --paper: #e9eeed;      /* cool vellum */
  --sheet: #f6f8f7;
  --ink: #1b2830;
  --muted: #56666e;
  --rule: #b7c3c6;
  --accent: #c8691c;     /* survey / construction orange: selected state only */
  --accent-ink: #ffffff;
  --chip: #ffffffd9;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Lettering standard: four sizes only */
  --t-title: clamp(19px, 4.6vw, 27px);   /* sheet title */
  --t-ui: 15px;                          /* controls, headings, hint */
  --t-data: 13px;                        /* values, labels, notes */
  --t-caption: 10px;                     /* uppercase captions and sources */
  --scene-bg: #dfe6e6;
  --scene-ink: #26343c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10171b; --sheet: #172127; --ink: #e2eaec; --muted: #93a4ab; --rule: #31424a;
    --accent: #ee9a45; --accent-ink: #1a1208; --chip: #1a252bdd;
    --scene-bg: #141d22; --scene-ink: #0c1215;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10171b; --sheet: #172127; --ink: #e2eaec; --muted: #93a4ab; --rule: #31424a;
  --accent: #ee9a45; --accent-ink: #1a1208; --chip: #1a252bdd;
  --scene-bg: #141d22; --scene-ink: #0c1215;
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); overflow: hidden; }
#app { position: relative; height: 100%; }
#view { position: absolute; inset: 0; }
#view canvas { display: block; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 14px; gap: 10px; }
.hud > * { pointer-events: auto; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }
.top > * { pointer-events: auto; }

/* Title block, drawn like the sheet's own: flat, ruled, no shadow */
.tb { background: var(--sheet); border: 1.5px solid var(--ink); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 0 1 430px; max-width: 430px; min-width: 0; }
.tb h1 { grid-column: 1 / -1; margin: 0; padding: 8px 12px 6px; font-family: var(--font-display); font-weight: 700; font-size: var(--t-title); letter-spacing: 0.02em; line-height: 1.02; text-transform: uppercase; border-bottom: 1px solid var(--ink); text-wrap: balance; }
.tb h1 small { display: block; font-family: var(--font-body); font-weight: 500; text-transform: none; font-size: var(--t-data); letter-spacing: 0; color: var(--muted); margin-top: 3px; }
.tb .cell { padding: 5px 12px; border-right: 1px solid var(--rule); border-top: 1px solid var(--rule); min-width: 0; }
.tb .cell:nth-child(odd) { border-right: 0; }
.tb .k { display: block; font-size: var(--t-caption); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.tb .v { font-family: var(--font-data); font-size: var(--t-data); overflow-wrap: anywhere; }
.tb .v b { color: var(--ink); font-weight: 700; }

/* North arrow: a compass rose that also takes you to the north-up plan */
.north { appearance: none; margin: 0; padding: 0; cursor: pointer; width: 54px; height: 54px; flex: none; border-radius: 50%; background: var(--sheet); color: var(--ink); border: 1.5px solid var(--ink); display: grid; place-items: center; }
.north svg { width: 34px; height: 34px; transition: transform 60ms linear; }
.north:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Bottom rail */
.rail { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.row::-webkit-scrollbar { display: none; }
.group { display: flex; gap: 0; flex: none; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 0; overflow: hidden; }
.group .lab { align-self: center; padding: 0 8px 0 10px; font-size: var(--t-caption); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
button { font: inherit; color: inherit; }
.btn { appearance: none; border: 0; background: transparent; padding: 8px 11px; font-family: var(--font-display); font-weight: 600; font-size: var(--t-ui); letter-spacing: 0.03em; cursor: pointer; white-space: nowrap; border-left: 1px solid var(--rule); }
.group .btn:first-of-type { border-left: 0; }
.group .lab + .btn { border-left: 1px solid var(--rule); }
/* Full fill = the selected one of several (View, Fill, Water) */
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
/* On/off switches (Show group, Numbers, Layers): a filled check box only, never the full fill */
.btn[data-toggle]::before, #openPanel::before, #openLayers::before { content: "✓"; display: inline-block; box-sizing: border-box; width: 1.05em; height: 1.05em; margin-right: 6px; line-height: 0.95; text-align: center; vertical-align: -0.12em; border: 1.5px solid var(--muted); color: transparent; }
.btn[data-toggle][aria-pressed="true"], #openPanel[aria-pressed="true"], #openLayers[aria-pressed="true"] { background: transparent; color: var(--ink); }
.btn[data-toggle][aria-pressed="true"]::before, #openPanel[aria-pressed="true"]::before, #openLayers[aria-pressed="true"]::before { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
/* Old vs new sees through a Built fill for you: See-through shows it, dashed and marked auto, not as your own choice */
.btn.auto[aria-pressed="true"] { background: transparent; color: var(--ink); outline: 1.5px dashed var(--accent); outline-offset: -5px; }
.btn.auto::after { content: "auto"; margin-left: 5px; font-size: var(--t-caption); font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

/* Panel: a flat drawing sheet that ends above the rail, on a row boundary */
.panel { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 78px; width: 300px; max-height: calc(100% - var(--rail-top, 120px) - 92px); overflow: auto;
  background: var(--sheet); border: 1.5px solid var(--ink); pointer-events: auto; scrollbar-gutter: stable; }
.panel h2 { margin: 0; padding: 6px 6px 6px 12px; font-family: var(--font-display); font-weight: 700; font-size: var(--t-ui); letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; }
.panel h2 button { border: 0; background: none; cursor: pointer; font-size: var(--t-title); line-height: 1; min-width: 32px; min-height: 32px; padding: 0; color: var(--muted); display: grid; place-items: center; }
.panel h2 button:hover { color: var(--ink); }
.panel h2 button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.panel dl { margin: 0; }
.panel .kv { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--rule); }
.panel .sec + dl > .kv:first-child, .panel .pick[hidden] + .sec { border-top: 0; }
.panel dt, .panel dd { margin: 0; padding: 6px 12px; font-size: var(--t-data); }
.panel dt { color: var(--muted); }
.panel dd { font-family: var(--font-data); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel dd .src { display: block; font-family: var(--font-body); font-size: var(--t-caption); color: var(--muted); letter-spacing: 0.05em; }
.panel .sec { padding: 7px 12px 5px; font-size: var(--t-caption); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--rule); font-weight: 600; }
.panel p { margin: 0; padding: 9px 12px 11px; font-size: var(--t-data); line-height: 1.45; color: var(--muted); border-top: 1px solid var(--rule); }
/* Key numbers that drive the model: a cue under the label, a hover ground, and the accent bar when that view or layer is showing */
.panel .go { cursor: pointer; }
.panel .go dt { color: var(--ink); }
.panel .go .cue { display: block; margin-top: 2px; font-family: var(--font-display); font-weight: 600; font-size: var(--t-caption); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.panel .go:hover { background: var(--paper); }
.panel .go:hover .cue { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.panel .go:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.panel .go[aria-pressed="true"] { box-shadow: inset 4px 0 0 var(--accent); }
.panel .go[aria-pressed="true"] .cue { color: var(--ink); }
html:not(.js) .panel .cue { display: none; }
/* More below: a ruled footer row pinned to the bottom edge while the sources paragraph is out of sight */
.panel.more::after { content: "Sources below ↓"; position: sticky; bottom: 0; display: block; box-sizing: border-box; height: 28px; margin-top: -28px; padding: 0 12px; line-height: 27px; text-align: right;
  font-size: var(--t-caption); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); background: var(--sheet); border-top: 1.5px solid var(--ink); pointer-events: none; }
.pick { padding: 9px 12px; border-bottom: 1px solid var(--ink); font-size: var(--t-data); line-height: 1.4; }
.pick b { font-family: var(--font-display); font-weight: 700; font-size: var(--t-ui); letter-spacing: 0.03em; display: block; }
.pick span { color: var(--muted); }
#numbersGroup { display: none; }
/* A part picked while the key numbers are closed: the panel shows only that part, headed by its name */
.panel.pick-only > :not(h2):not(.pick) { display: none; }
.panel.pick-only::after { content: none; }
.panel.pick-only .pick { border-bottom: 0; }
.panel.pick-only .pick-h { display: none; }   /* the heading names the part and the × closes it */
/* Part note heading: the name, and a small Clear that deselects and folds the note away */
.pick-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pick .clear { flex: none; appearance: none; margin: -2px -4px 0 0; padding: 3px 7px; background: transparent; border: 1px solid var(--rule); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: var(--t-caption); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pick .clear:hover { color: var(--ink); border-color: var(--ink); }
.pick .clear:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
/* One control per state: beside a wide panel the Numbers switch closes it; the × stays where the panel sits over the rail or shows a part only */
@media (min-width: 761px) and (min-height: 501px) { .panel:not(.pick-only) #closePanel { display: none; } .panel:not(.pick-only) h2 { padding-block: 9px; } }

/* Labels in the scene: chips with a rule-coloured edge; anchored ones carry a leader down to the part */
.lbl { font-family: var(--font-display); font-weight: 600; font-size: var(--t-data); letter-spacing: 0.04em; color: var(--ink); background: var(--chip); border: 1px solid var(--rule); border-left: 3px solid var(--rule); padding: 2px 7px; white-space: nowrap; pointer-events: none; text-wrap: balance; }
/* Culled labels fade out and back (model.js sets opacity); they never take pointer events */
.lbl, .lead { transition: opacity 160ms ease; }
/* The dimension drawn for a clicked key number: ink, data face, no accent */
.lbl.dim { font-family: var(--font-data); font-weight: 400; border-left: 1px solid var(--ink); border-color: var(--ink); }
.lbl.small { font-weight: 500; border-left-width: 1px; }
.lbl .ln { display: block; }   /* explicit lines (the arch label on a phone) */
.lead { pointer-events: none; padding-bottom: 18px; position: relative; }
.lead::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1.5px; height: 18px; margin-left: -0.75px; background: var(--ink); }
.lead .lbl { border-left-color: var(--ink); }

.loading[hidden] { display: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: var(--t-ui); letter-spacing: 0.06em; color: var(--muted); pointer-events: none; }

@media (max-width: 760px) {
  .panel { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: auto; top: auto; bottom: 120px; max-height: 46%; }
  #numbersGroup { display: flex; }
  .tb .cell { padding: 4px 10px; }
  .north { width: 44px; height: 44px; }
  .north svg { width: 28px; height: 28px; }
}
@media (min-width: 761px) { .tb { max-width: 430px; } }
@media (prefers-reduced-motion: reduce) { .north svg, .hint, .lbl, .lead { transition: none; } }
/* ---- Phone pass ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; overscroll-behavior: none; }
#view { z-index: 0; }   /* own stacking context: CSS2D label z-indexes stay under the HUD and panel */
.hud, .panel { touch-action: manipulation; }
.panel { overscroll-behavior: contain; }
.panel h2 { position: sticky; top: 0; z-index: 1; background: var(--sheet); }
#numbersGroup { display: flex; }   /* always offer a way back to the panel after closing it */
#openLayers { display: none; }
.loading.fail { inset: auto 16px max(16px, env(safe-area-inset-bottom, 0px)) 16px; padding: 12px 14px; background: var(--sheet); border: 1.5px solid var(--ink); color: var(--ink); font-size: var(--t-ui); text-align: center; z-index: 5; }
/* The hint shows for every pointer (worded by model.js) and fades after the first gesture */
.hint { align-self: center; font-family: var(--font-display); font-weight: 600; font-size: var(--t-ui); letter-spacing: 0.03em; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--rule); padding: 4px 10px; text-align: center; transition: opacity 600ms ease; }
.hint.gone, .hint.wait { opacity: 0; }
.hint.quiet { font-weight: 500; font-size: var(--t-data); color: var(--muted); background: transparent; border-color: transparent; padding-block: 0; }
@media (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .panel h2 button { min-width: 44px; min-height: 44px; margin: -6px -6px -6px 0; }
  .pick .clear { min-height: 36px; padding-inline: 10px; }
}
@media (max-width: 760px), (max-height: 500px) {
  .tb { grid-template-columns: auto minmax(0, 1fr); }
  .tb h1 { padding: 6px 10px 5px; }
  .tb h1 small, .tb .cell:nth-of-type(n+3) { display: none; }  /* Drawings + Status are in the panel footnote */
  .row { flex-wrap: wrap; overflow: visible; }
  .group, .group .btn { flex: 1 1 auto; }
  .btn { padding-inline: 9px; }
  .row[aria-label="Views"] .lab { display: none; }
  #numbersGroup { order: 2; }
  #openLayers { display: block; }
  #layersRow { display: none; order: -1; }
  .rail.layers-open #layersRow { display: flex; }
  .panel { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: auto; top: auto;
    bottom: calc(var(--rail-top, 120px) + 8px); max-height: min(50%, calc(100% - var(--rail-top, 120px) - 90px)); }
  .lbl { white-space: normal; max-width: 44vw; width: max-content; text-align: center; line-height: 1.15; }
  .lbl.dim { white-space: nowrap; max-width: none; }   /* a dimension never wraps into a box; phone wording is short */
}
@media (max-height: 500px) and (orientation: landscape) {
  .tb { grid-template-columns: auto auto auto; flex: 0 1 auto; max-width: none; }
  .tb h1 { grid-column: auto; border-bottom: 0; border-right: 1px solid var(--ink); align-self: stretch; display: flex; align-items: center; }
  .tb .cell { border-top: 0; border-right: 1px solid var(--rule); }
  .tb .cell:nth-of-type(2) { border-right: 0; }
  .north { width: 40px; height: 40px; } .north svg { width: 26px; height: 26px; }
  .panel { left: auto; width: min(330px, 44%); top: 66px; max-height: calc(100% - 66px - var(--rail-top, 120px) - 14px); }  /* below the one-line title block */
  .panel.pick-only { top: auto; }
}
/* Without JavaScript (an email or Files preview), say so plainly instead of showing an empty model. */
html:not(.js) #loading, html:not(.js) .rail, html:not(.js) #pick, html:not(.js) .north { display: none !important; }
.nojs-note { display: none; }
html:not(.js) .nojs-note { display: grid; inset: auto 16px auto 16px; top: 50%; transform: translateY(-50%); }
@media (max-width: 760px), (max-height: 500px) {
  html:not(.js) .nojs-note { top: auto; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: none; }
  html:not(.js) .panel { top: 100px; bottom: 150px; max-height: none; }
}
