/* A white architectural model under a pale sky, after LAYRS: Amsterdam. The colours are the
   'classic' scheme; app.js sets these properties from the scheme picked (schemes.js). */
:root {
  --sky: #e4e8ea;
  --paper: #ffffff;
  --ink: #000000;
  --muted: #5d6266;
  --rule: #cfd5d8;
  --accent: #c0392b;
  --gutter: clamp(16px, 2.4vw, 32px);
  font: 400 14px/1.5 "Schibsted Grotesk", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
:root[data-scheme="night"] {   /* = schemes.js 'night', for the moment before app.js runs */
  --sky: #171b20; --paper: #22272d; --ink: #f2f3f4; --muted: #9aa1a7; --rule: #3a4148; --accent: #ef6b5b; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sky); color: var(--ink); overflow: hidden; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.veil { position: fixed; left: 0; right: 0; pointer-events: none; }
.veil-top { top: 0; height: 120px; background: linear-gradient(color-mix(in srgb, var(--sky) 80%, transparent) 15%, transparent); }
.veil-bottom { bottom: 0; height: 150px; background: linear-gradient(transparent, var(--sky) 55%); }

.leftcol { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--gutter)); left: var(--gutter); bottom: 150px;
  display: flex; flex-direction: column; gap: 18px; pointer-events: none; width: min(34vw, 460px); }
.leftcol > * { pointer-events: auto; }
.masthead { flex: none; align-self: flex-start; margin: -8px -10px 0; padding: 8px 10px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--sky) 60%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
h1 { margin: 0; font-size: clamp(26px, 3vw, 44px); font-weight: 800; letter-spacing: -0.035em; line-height: .92; }
.dek { margin: 8px 0 0; color: var(--muted); max-width: 30ch; font-size: 14px; line-height: 1.4; }
.city-pick { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-top: 10px; padding: 3px; border-radius: 999px; background: var(--paper);
  box-shadow: 0 1px 4px rgba(30, 40, 50, .12); }
.city-pick a { padding: 4px 12px; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.city-pick a:hover { background: var(--sky); }
.city-pick a[aria-current="page"] { background: var(--ink); color: var(--paper); }

.modes { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--gutter)); left: 50%; transform: translateX(-50%);
  display: flex; background: var(--paper); border-radius: 999px; padding: 3px; box-shadow: 0 1px 0 var(--rule); }
.modes button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.tally { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--gutter) - 8px); right: calc(var(--gutter) - 10px); text-align: right;
  display: flex; flex-direction: column; align-items: flex-end; padding: 8px 10px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--sky) 72%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.tally-year { display: block; font-size: clamp(40px, 5vw, 64px); font-weight: 800; letter-spacing: -0.04em; line-height: .85; }
.tally-count { color: var(--muted); margin-top: 6px; }
.tally-tools { display: flex; gap: 6px; margin-top: 8px; }
.about-open, .scheme-pick { border: 0; background: var(--paper); color: var(--ink); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.scheme-pick { padding: 3px 6px; }

.panel { width: min(300px, calc(100vw - 2 * var(--gutter))); min-height: 0; flex: 0 1 auto; overflow-y: auto; align-self: flex-start;
  background: var(--paper); border-radius: 10px; padding: 14px 16px; }
.panel h2 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.swatches { display: flex; flex-direction: column; }
.swatch { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; background: none; border: 0;
  text-align: left; padding: 3px 0; cursor: pointer; }
.swatches.static .swatch { cursor: default; }
.swatch i { width: 12px; height: 12px; border-radius: 2px; }
.swatch small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.swatch .n { color: var(--muted); font-size: 12px; }
.swatch[aria-pressed="false"] { opacity: .35; }
.ramp { height: 10px; border-radius: 2px; margin: 4px 0 6px; }
.ramp-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.card { position: fixed; z-index: 10; pointer-events: none; background: var(--paper); border-radius: 10px;
  width: 300px; max-height: calc(100vh - 24px); overflow-y: auto; box-shadow: 0 8px 28px rgba(30, 40, 50, .16); font-size: 13px; }
.card.pinned { pointer-events: auto; }
.card-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--sky); cursor: pointer; font-size: 17px; line-height: 1; }
.card-head { padding: 12px 16px 10px; }
.card-head h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; padding-right: 26px; }
.card .when { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card .y { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.card .period { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.card .period i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.card .note { margin: 6px 0 0; }
.card .tag { display: inline-block; margin: 6px 0 0; padding: 1px 8px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; padding: 10px 16px 12px; border-top: 1px solid var(--rule); }
.card dt { color: var(--muted); }
.card dd { margin: 0; text-align: right; }
.card .est { color: var(--muted); font-size: 11px; }
.card .hint { margin: 0; padding: 8px 16px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--rule); }

.howto { position: fixed; right: var(--gutter); bottom: calc(env(safe-area-inset-bottom, 0px) + 128px); color: var(--muted);
  background: color-mix(in srgb, var(--sky) 85%, transparent); padding: 2px 8px; border-radius: 4px; font-size: 12px; pointer-events: none; margin: 0; }
@media (max-width: 720px), (hover: none) { .howto { display: none; } }

.timeline { position: fixed; left: 0; right: 0; bottom: 18px; display: flex; align-items: flex-end; gap: 14px;
  padding: 0 var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 8px); pointer-events: none; }
.timeline > * { pointer-events: auto; }
.timeline canvas { flex: 1; height: 92px; cursor: ew-resize; touch-action: none; min-width: 0; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper);
  cursor: pointer; margin-bottom: 22px; display: grid; place-items: center; flex: none; }
.play svg { width: 16px; height: 16px; fill: currentColor; }
.attribution { position: fixed; left: var(--gutter); right: var(--gutter); bottom: 4px; margin: 0; color: var(--muted);
  font-size: 10.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attribution:hover { white-space: normal; }

.loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted);
  background: color-mix(in srgb, var(--paper) 80%, transparent); padding: 6px 14px; border-radius: 999px; }

.about { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: 0 20px 60px rgba(30, 40, 50, .25); color: var(--ink); background: var(--paper); overflow-y: auto; }
.about::backdrop { background: color-mix(in srgb, var(--sky) 70%, transparent); }
.about article { padding: 28px 32px 32px; }
.about h2 { margin: 0 0 12px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.about h3 { margin: 22px 0 6px; font-size: 15px; font-weight: 700; }
.about p, .about li { line-height: 1.6; max-width: 64ch; }
.about ul { padding-left: 18px; margin: 6px 0 0; }
.about li { margin-bottom: 6px; }
.about a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.about .local { color: var(--accent); font-size: 12px; }
.about-close { position: sticky; float: right; top: 10px; margin: 10px 10px 0 0; width: 32px; height: 32px; border: 0;
  border-radius: 50%; background: var(--sky); cursor: pointer; font-size: 18px; }

@media (max-width: 720px) {
  .dek { display: none; }
  h1 { font-size: 26px; }
  .tally-year { font-size: 30px; }
  .modes { top: auto; left: 12px; right: 12px; transform: none; bottom: calc(env(safe-area-inset-bottom, 0px) + 112px); overflow-x: auto; }
  .modes button { flex: 1 0 auto; padding: 8px 11px; }
  .leftcol { width: auto; right: var(--gutter); bottom: 170px; }
  .panel { max-height: 30vh; margin-top: auto; }
  .card { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-height: 60vh; border-radius: 14px 14px 0 0; }
  .timeline canvas { height: 72px; }
}

/* ---------- occupancy layers ---------- */
.layer { margin-top: 12px; }
.layer h3 { margin: 0 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.layer h3 .lic { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--accent); }
.swatch.child { padding-left: 18px; font-size: 13px; }
.swatch.layer-cat[aria-pressed="false"] i { opacity: .25; }
.swatch.layer-cat[aria-pressed="false"] span { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.chip { border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip small { opacity: .6; }
.layer-tools { display: flex; gap: 6px; margin-top: 12px; }
.btn { border: 1px solid var(--rule); background: var(--paper); border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.occupants { border-top: 1px solid var(--rule); padding: 10px 16px 12px; }
.occupants h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.occupants ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.occupants li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: start; }
.occupants li i { width: 10px; height: 10px; border-radius: 2px; margin-top: 5px; }
.occupants li small { display: block; color: var(--muted); font-size: 11px; }
.occupants li .item-note { font-style: italic; }
.occupants a { color: inherit; }
.occupants .mini { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; }
.occupants .mark-open { margin-top: 8px; }
.mark-form { display: grid; gap: 6px; margin-top: 8px; }
.mark-form label { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }
.mark-form input, .mark-form select, .mark-form textarea { font: inherit; font-size: 13px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; padding: 4px 6px; }
.mark-form .row { display: flex; gap: 6px; }
.mark-form .row label { flex: 1; }
