/* Fonts and colours come from the shared design system (ds/ds.css, built from ~/Documents/DesignSystem/tokens.json). */
:root {
  --page: var(--ds-page); --surface: var(--ds-surface); --ink: var(--ds-ink); --ink2: var(--ds-ink2); --muted: var(--ds-muted);
  --line: var(--ds-line); --border: var(--ds-border); --accent: var(--ds-accent);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: var(--ds-size-body)/1.45 var(--ds-font); }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 20px; }
h2 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
header p { margin: 2px 0 0; color: var(--ink2); }
main { padding: 0 20px 32px; max-width: 1400px; margin: 0 auto; }
.actions { display: flex; gap: 8px; }
button, .button, select, input[type=number] {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px;
}
button, .button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
input[type=number] { width: 62px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; color: var(--ink2); }
.filters label { display: inline-flex; gap: 6px; align-items: center; }
#pmvInputs { display: inline-flex; gap: 12px; }
#pmvInputs[hidden] { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile b { display: block; font-size: 26px; font-weight: 600; }
.tile span { color: var(--ink2); }
.card { margin-bottom: 12px; min-width: 0; }
.card svg { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.indicator, .note { margin: 8px 0 0; color: var(--ink2); font-size: 13px; }
.indicator { font-variant-numeric: tabular-nums; min-height: 1.45em; }
.foot { text-align: center; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
th:nth-child(2), td:nth-child(2) { text-align: left; white-space: normal; width: 99%; }
td:first-child { padding-right: 0; }
tr.group td { color: var(--muted); font-size: 12px; text-align: left; padding-top: 10px; }
tr.off td { color: var(--muted); }
.badge { display: inline-block; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 20px; margin-right: 6px; }
.bar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; vertical-align: middle; margin-right: 6px; }
ol { margin: 0; padding-left: 0; list-style: none; }
ol li { margin-bottom: 10px; }
ol li p { margin: 2px 0 0 26px; color: var(--ink2); }
#auto { margin-top: 10px; }
#drop { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(42, 120, 214, 0.18); border: 3px dashed var(--accent); font-size: 22px; z-index: 10; }
#drop[hidden] { display: none; }
.two.flat { gap: 12px; margin-top: 8px; }
h2.sub { margin-top: 14px; }
#sunpath { margin-top: 2px; }
section:has(#sunpath) > h2 { flex-wrap: wrap; justify-content: flex-start; }
h2 span { display: inline-flex; gap: 10px; align-items: center; font-weight: 400; }
.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--ink2); }
.scale { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink2); }
.scale i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid var(--border); }
.seasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.seasons div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.seasons b.big { font-size: 22px; font-weight: 600; display: block; }
.seasons p { margin: 4px 0 0; color: var(--ink2); }
.seasons ul { margin: 6px 0 0; padding-left: 16px; color: var(--ink2); }
ol.plain li { margin: 0 0 4px; color: var(--ink2); }
#limits { margin-top: 4px; font-size: 13px; }
#limits th:nth-child(2), #limits td:nth-child(2) { width: auto; white-space: nowrap; }
#limits td.v { text-align: right; border-left: 2px solid var(--surface); color: #0b0b0b; }
#limits tr.first td { border-top: 2px solid var(--line); }
#psychro { cursor: crosshair; }
#pick { padding: 0 20px 24px; max-width: 1400px; margin: 0 auto; }
#pick[hidden] { display: none; }
#q { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; width: min(380px, 100%); }
.mapwrap { position: relative; }
#map { height: min(70vh, 640px); min-height: 380px; border-radius: 10px; border: 1px solid var(--border); background: #fcfcfd; }
#near { position: absolute; top: 12px; right: 12px; z-index: 500; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; margin: 0; }
#near[hidden] { display: none; }
#near button { width: 100%; text-align: left; margin-bottom: 4px; }
#near small { color: var(--ink2); display: block; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; }
.dot.ob { background: #1f6bff; } .dot.ep { background: #ff5b1f; }
.maplibregl-popup-content button { margin-top: 6px; }
svg.wide { max-width: 760px; }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.rule { display: grid; grid-template-columns: 76px 1fr; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.shades { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 10px; margin-bottom: 8px; }
.shadekey { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; max-width: 900px; }
.shade { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.shade.off { opacity: 0.55; }
.shade svg { background: #fff; border-radius: 6px; }
.shade b { font-size: 14px; } .shade b span { color: var(--ds-accent2, #eb6834); font-weight: 600; margin-left: 6px; font-size: 13px; }
.shade small { display: block; color: var(--muted); margin: 1px 0 6px; }
.shade dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 6px; font-size: 12.5px; }
.shade dt { color: var(--muted); } .shade dd { margin: 0; color: var(--ink); }
.shade p { margin: 0; color: var(--ink2); font-size: 12.5px; line-height: 1.4; }
@media (max-width: 520px) { .shades { grid-template-columns: 1fr; } .shade { grid-template-columns: 1fr; } }
.codes { display: grid; gap: 0; }
.code { display: grid; grid-template-columns: 130px minmax(200px, 1fr) minmax(280px, 2.4fr); gap: 4px 14px; align-items: baseline; padding: 9px 2px; border-top: 1px solid var(--line); }
.code:first-child { border-top: 0; }
.code .scope { font-size: 12px; color: var(--muted); }
.code .scope b { display: block; color: var(--ink); font-size: 13px; }
.code a { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 13px; }
.code a:hover { text-decoration: underline; }
.code small { display: block; color: var(--muted); }
.code p { margin: 0; color: var(--ink2); font-size: 12.5px; line-height: 1.45; }
.code p.here { color: var(--ink); margin-top: 3px; }
.code .flag { color: var(--ds-signal-warn, #b07a00); }
@media (max-width: 900px) { .code { grid-template-columns: 1fr; } }
.techs { display: grid; gap: 0; }
.tech { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(150px, 0.9fr) 90px 90px minmax(260px, 3fr); gap: 4px 14px; align-items: baseline; padding: 9px 2px; border-top: 1px solid var(--line); }
.tech:first-child { border-top: 0; }
.tech b { font-size: 13px; }
.tech .fig { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tech .fit { height: 6px; border-radius: 3px; background: var(--line); align-self: center; overflow: hidden; }
.tech .fit i { display: block; height: 100%; background: var(--accent); }
.tech small { color: var(--muted); }
.tech p { margin: 0; color: var(--ink2); font-size: 12.5px; line-height: 1.4; }
@media (max-width: 900px) { .tech { grid-template-columns: 1fr 1fr; } .tech p { grid-column: 1 / -1; } }
.rule svg { width: 76px; height: 57px; background: #fff; border-radius: 6px; }
.rule b { display: block; font-size: 13px; }
.rule p { margin: 2px 0 0; color: var(--ink2); font-size: 12.5px; line-height: 1.4; }
.rule small { color: var(--muted); }
h2.part { margin: 22px 0 10px; font-size: 17px; justify-content: flex-start; gap: 12px; }
table.small { font-size: 12.5px; }
table.small th:nth-child(2), table.small td:nth-child(2) { width: auto; text-align: right; white-space: nowrap; }
table.small td:first-child, table.small th:first-child { text-align: left; padding-right: 8px; }
table.small td.adv { text-align: left; white-space: normal; }
ul.notes { margin: 8px 0 0; padding-left: 18px; color: var(--ink2); font-size: 13px; }
.rule b.fig { font-size: 15px; color: var(--ink); }
#zones { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tile.zone b { color: var(--accent); }
#shadeTable td, #shadeTable th { white-space: normal; vertical-align: top; }
#shadeTable td.adv { min-width: 190px; }
#shadeTable td:first-child { white-space: nowrap; }
.card { overflow-x: auto; }
#glazSpec td, #glazSpec th { white-space: normal; vertical-align: top; }
#glazSpec td:first-child, #glazSpec td:nth-child(2) { white-space: nowrap; }
svg.igu { width: 230px; min-width: 230px; background: #fff; border-radius: 6px; display: block; }
#glazSpecKey { margin-top: 8px; }
/* The IPCC scenario bar stays on screen while the page scrolls. */
#ipcc { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1200; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: calc(100vw - 24px); padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14); }
#ipcc[hidden] { display: none; }
#ipcc .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
#ipcc .seg button { border: 0; border-radius: 0; background: none; color: var(--ink2); padding: 5px 10px; font: inherit; cursor: pointer; }
#ipcc .seg button + button { border-left: 1px solid var(--line); }
#ipcc .seg button.on { background: var(--ink); color: var(--page); }
#ipcc .seg button:disabled { opacity: 0.4; cursor: default; }
#ipcc .note { font-size: 12px; line-height: 1.3; cursor: help; }
main { padding-bottom: 110px; }
/* The map in the manner of Mapbox Light: white land, grey water, quiet controls. The note keeps its line, so the map does not move when it speaks. */
#pickNote { min-height: 1.45em; margin: 0 0 8px; }
#map.maplibregl-map { background: #fcfcfd; font: inherit; overflow: hidden; }
#map .maplibregl-ctrl-group { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16); }
#map .maplibregl-ctrl-group button { width: 34px; height: 34px; }
#map .maplibregl-popup-content { border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16); color: #0d0d0d; padding: 10px 14px; font-size: 13px; line-height: 1.4; }
#map .maplibregl-popup.tip { pointer-events: none; }
#map .maplibregl-popup.tip .maplibregl-popup-content { padding: 6px 10px; }
#map .maplibregl-ctrl-attrib { background: rgba(252, 252, 253, 0.8); color: #7c7d7e; font-size: 10px; }
#map .maplibregl-ctrl-attrib a { color: #7c7d7e; }
.three { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.5fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .three { grid-template-columns: 1fr; } }
.tally { margin: 6px 0 2px; gap: 3px 14px; } .tally b { color: var(--ink); font-weight: 600; } .tally .lead { color: var(--muted); }
/* Outdoor comfort: four maps that go 4, 2 or 1 across, each with its own count; the comparison and the limits side by side; cards for the seasons. */
.filters.tight { margin: 2px 0 8px; }
.maps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.maps > div { min-width: 0; }
.maps .tally { font-size: 11px; gap: 2px 10px; }
@media (max-width: 1500px) { .maps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .maps { grid-template-columns: minmax(0, 1fr); } }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 6px; }
@media (max-width: 1000px) { .pair { grid-template-columns: minmax(0, 1fr); } }
.scroll { overflow-x: auto; }
#limits { width: 100%; }
#limits th { white-space: nowrap; font-weight: 500; }
.seasons { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.seasons div { background: var(--page); }
@media (max-width: 720px) { h2 { flex-wrap: wrap; } .card { padding: 10px; } }
@media (max-width: 720px) {
  #ipcc { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; gap: 6px; padding: 6px 8px; justify-content: center; }
  #ipcc b, #ipcc .note { display: none; }
  #ipcc .seg button { padding: 5px 7px; font-size: 11px; white-space: nowrap; }
}

/* folded notes under a table */
.fold { margin-top: 6px; }
.fold summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.fold span { display: block; margin: 4px 0 0 14px; }
[hidden] { display: none !important; }
/* a card with its chart beside its text */
.card.side { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: center; }
@media (max-width: 720px) { .card.side { grid-template-columns: 1fr; } }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button, label.button { cursor: pointer; transition: background 0.12s, border-color 0.12s, filter 0.12s, transform 0.05s; }
button:hover:not(:disabled), label.button:hover { border-color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary:hover:not(:disabled) { filter: brightness(1.12); }
button.primary:active:not(:disabled) { filter: brightness(0.9); }
.maplibregl-popup-content button.primary { margin-top: 8px; width: 100%; padding: 7px 10px; }
/* what is still being fetched or worked out */
#busy { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1300; margin: 0; padding: 5px 14px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); pointer-events: none; }
#busy[hidden] { display: none; }
.filling { opacity: 0.35; transition: opacity 0.2s; }
.card, .tile, .tiles { transition: opacity 0.25s; }
/* building archetypes */
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 4px 22px; }
.form { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.form.weak { opacity: 0.55; }
.form b { font-size: 13px; display: block; }
.form .fit { display: inline-block; width: 90px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-right: 8px; vertical-align: middle; }
.form .fit i { display: block; height: 100%; background: var(--accent); }
.form small { color: var(--muted); font-size: 11.5px; }
.form p { margin: 5px 0 4px; font-size: 13px; }
.recs { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
@media (max-width: 520px) { .form { grid-template-columns: 1fr; } .forms { grid-template-columns: 1fr; } }
.recs { columns: 2; column-gap: 28px; }
/* forms compared by simulation */
.study td { vertical-align: middle; text-align: right; }
.study td.pic { width: 124px; min-width: 124px; padding: 2px 6px 2px 0; }
.study td.pic svg { display: block; }
.study td:nth-child(2) { min-width: 230px; max-width: 300px; }
.study td small { font-size: 11.5px; line-height: 1.35; }
.study small.src { color: var(--muted); }
.study th { text-align: right; font-weight: 600; vertical-align: bottom; }
.study th small { font-weight: 400; color: var(--muted); }
.study .v { font-variant-numeric: tabular-nums; }
.study .bar { display: block; height: 4px; width: 46px; margin: 3px 0 0 auto; background: var(--line); border-radius: 2px; overflow: hidden; }
.study .bar i { display: block; height: 100%; background: var(--accent); margin-left: auto; }
.study .by { background: color-mix(in srgb, var(--accent) 7%, transparent); }
/* The map view fills the window: the headline and the search stay in sight, the map takes all that is left,
   and its key lies over its lower edge. */
body:has(#pick:not([hidden])) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body:has(#pick:not([hidden])) > header { flex: none; }
#pick { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: none; padding: 0 20px 20px; margin: 0; }
#pick > #pickNote:empty { display: none; }
#pick .mapwrap { flex: 1; min-height: 0; }
#pick #map { height: 100%; min-height: 0; }
#pick #mapKey { position: absolute; left: 10px; right: 10px; bottom: 22px; z-index: 450; margin: 0; padding: 6px 10px; max-height: 28%; overflow: auto;
  background: color-mix(in srgb, var(--surface) 90%, transparent); border-radius: 8px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14); }
#pick #near { max-height: calc(100% - 24px - 30%); }

/* Daylight factor card */
.dfTable { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
.dfTable th, .dfTable td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.dfTable th { font-weight: 500; color: var(--ink2); }
.dfRoom { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; margin-bottom: 8px; }
.dfRoom label { display: flex; flex-direction: column; font-size: 12px; color: var(--ink2); gap: 2px; }
.dfRoom input { width: 100%; }
#dfOut .big { font-size: 15px; margin: 4px 0; }
#dfOut .big small { display: block; color: var(--ink2); font-size: 12px; }
#dfOut ul { margin: 4px 0 6px; padding-left: 18px; font-size: 13px; }
#dfOut b.ok { color: #1d8a4f; } #dfOut b.no { color: #c0392b; }
.dfBox { width: 100%; height: auto; display: block; cursor: grab; touch-action: pan-y; margin-bottom: 6px; }
.dfBox:active { cursor: grabbing; }
ul.pg { margin: 2px 0 0; padding-left: 18px; font-size: 13px; }
ul.pg li { margin: 2px 0; }
