/* inference.town — design system
   Day is default. Night is a palette swap, never a blue overlay.
   Illustration variables are read by town.js; UI variables style the app. */

:root {
  color-scheme: light;

  /* UI palette */
  --page: #fff8e9;
  --surface: #fffcf4;
  --surface-2: #f6eed8;
  --text: #243a35;
  --text-2: #526158;
  --primary: #245f55;
  --primary-text: #fff8e9;
  --focus: #005fcc;
  --error: #a3322a;
  --good: #2f6b3a;
  --warn: #8a5a12;
  --border: #d8c9a8;
  --border-strong: #b9a780;
  --code-bg: #183139;
  --code-text: #f7eed8;

  /* Illustration palette (day) */
  --sky: #dcece5;
  --silhouette: #a9c6ba;
  --outline: #293c38;
  --paper: #fff1d2;
  --plaster-shadow: #d8bc8b;
  --roof: #b95f45;
  --roof-hi: #e58b59;
  --machinery: #357c79;
  --machinery-hi: #73b5a1;
  --grass: #91aa69;
  --foliage: #526f48;
  --path: #dccba3;
  --timber: #74513d;
  --window: #f5cb69;
  --water: #70a9b1;
  --water-hi: #bcdad1;

  --radius: 4px;
  --shadow: 2px 2px 0 var(--border-strong);
  --masthead-h: 48px;
  --content: 1040px;
}

[data-theme="night"] {
  color-scheme: dark;
  --page: #142b33;
  --surface: #203d43;
  --surface-2: #1a343b;
  --text: #fff1d2;
  --text-2: #c1d1c5;
  --primary: #f5cb69;
  --primary-text: #142b33;
  --focus: #ffd889;
  --error: #ffb0a0;
  --good: #9fd8a4;
  --warn: #ffd889;
  --border: #33545a;
  --border-strong: #476b70;
  --code-bg: #0f232a;
  --code-text: #f7eed8;

  --sky: #152d38;
  --silhouette: #29464d;
  --outline: #10252d;
  --paper: #f6deaa;
  --plaster-shadow: #a99370;
  --roof: #895046;
  --roof-hi: #c57a51;
  --machinery: #35666a;
  --machinery-hi: #68a49a;
  --grass: #405c4c;
  --foliage: #2a443d;
  --path: #827f6d;
  --timber: #57443b;
  --window: #ffd889;
  --water: #355e70;
  --water-hi: #70999c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/24px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 50;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* ---------- masthead ---------- */

.masthead {
  height: var(--masthead-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.masthead-inner {
  max-width: var(--content);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark svg {
  width: 22px;
  height: 22px;
}
.masthead .spacer {
  flex: 1;
}
.masthead nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.masthead nav a,
.masthead nav button {
  font: inherit;
  font-size: 14px;
  color: var(--text-2);
  background: none;
  border: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.masthead nav a:hover,
.masthead nav button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.directory {
  position: relative;
}
.directory > button[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--text);
}
.directory-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
}
.directory[data-open="true"] .directory-panel {
  display: block;
}
.directory-panel a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
}
.directory-panel a:hover {
  background: var(--surface-2);
}
.directory-panel .sep {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ---------- layout ---------- */

main {
  display: block;
}
.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 40px 0 20px;
}
.hero h1 {
  font-size: 44px;
  line-height: 48px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.hero p.lede {
  margin: 0 0 20px;
  max-width: 46ch;
  color: var(--text-2);
  font-size: 17px;
  line-height: 26px;
}
.hero .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 32px;
  align-items: start;
}
.hero-grid > * {
  min-width: 0;
}
.hero-grid .hero {
  padding: 40px 0 20px;
}
.hero-grid .hero-aside {
  padding: 44px 0 20px;
}
.hero-aside .caption {
  font-size: 13px;
  color: var(--text-2);
  margin: 10px 0 0;
}
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .hero-grid .hero-aside {
    padding: 0 0 24px;
  }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background-color 0.12s ease, transform 0.05s ease;
}
.btn:hover {
  background: color-mix(in srgb, var(--primary) 88%, #000);
}
.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--border-strong);
}
.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn.secondary:hover {
  background: var(--surface-2);
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.small {
  min-height: 36px;
  font-size: 14px;
  padding: 0 12px;
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- visitor guide strip ---------- */

.guide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 4px 0 24px;
}
.guide span.label {
  font-size: 13px;
  color: var(--text-2);
  margin-right: 4px;
}
.guide a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.guide a:hover {
  background: var(--surface-2);
}
.guide .dot {
  color: var(--border-strong);
}

/* ---------- town scene ---------- */

.town-frame {
  position: relative;
  background: var(--sky);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.town {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: var(--sky);
}
.town canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
@media (max-width: 480px) {
  /* Recompose for phones: crop the panorama edges so buildings and residents
     get more screen, keeping the canal and plaza centered. */
  .town {
    aspect-ratio: 3 / 2;
  }
  .town canvas {
    object-fit: cover;
    object-position: center bottom;
  }
}
/* Ghost hotspots: the pixel sign is part of the artwork; the HTML link is an
   invisible hit area that reveals a label on hover/focus for accessibility. */
.town .hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
}
.town .hotspot:hover,
.town .hotspot:focus-visible {
  border-color: #293c38;
  background: rgba(246, 230, 186, 0.16);
  outline: none;
}
.town .hotspot .tag {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -4px);
  background: #f6e6ba;
  color: #233d38;
  border: 1px solid #293c38;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.18);
}
.town .hotspot:hover .tag,
.town .hotspot:focus-visible .tag {
  opacity: 1;
}
.town .hotspot[data-kind="status"] {
  cursor: default;
}
.town-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 6px;
}
.town-controls button {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 3px;
  border: 1px solid #293c38;
  background: #f6e6ba;
  color: #233d38;
  cursor: pointer;
}
.town-controls button:hover {
  background: #ffd77a;
}
.town-legend {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #233d38;
  background: #f6e6ba;
  border: 1px solid #293c38;
  border-radius: 3px;
  padding: 4px 8px;
}

/* ---------- boards ---------- */

.boards {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin: 20px 0 28px;
}
.board {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.board header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.board header h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.board header .meta {
  font-size: 12px;
  color: var(--text-2);
}
.board .body {
  padding: 8px 16px 16px;
}
.board a.more {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
}

table.prices {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.prices th,
table.prices td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}
table.prices thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2);
  font-weight: 600;
}
table.prices td.num,
table.prices th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.prices tbody tr:last-child td {
  border-bottom: 0;
}
.price-sale {
  color: var(--good);
  font-weight: 700;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}
.badge.sale {
  color: var(--good);
  border-color: currentColor;
}
.badge.new {
  color: var(--warn);
  border-color: currentColor;
}

.news-item {
  margin: 0 0 14px;
}
.news-item .when {
  font-size: 12px;
  color: var(--text-2);
}
.news-item .title {
  font-weight: 600;
  margin: 2px 0 2px;
}
.news-item p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- code ---------- */

.codeblock {
  display: flex;
  flex-direction: column;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 100%;
}
.codeblock pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 238, 216, 0.4) transparent;
  font: 14px/22px ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.codeblock pre::-webkit-scrollbar {
  height: 8px;
}
.codeblock pre::-webkit-scrollbar-thumb {
  background: rgba(247, 238, 216, 0.35);
  border-radius: 4px;
}
.codeblock pre::-webkit-scrollbar-track {
  background: transparent;
}
.codeblock .copy {
  order: -1;
  align-self: flex-end;
  margin: 6px 6px 0;
  font: inherit;
  font-size: 12px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--code-text) 30%, transparent);
  background: color-mix(in srgb, var(--code-text) 12%, transparent);
  color: var(--code-text);
  cursor: pointer;
}
.codeblock .copy:hover {
  background: color-mix(in srgb, var(--code-text) 22%, transparent);
}
code.inline {
  font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---------- sections & cards ---------- */

section.block {
  padding: 32px 0;
  border-top: 1px solid var(--border);
}
section.block h2 {
  font-size: 26px;
  line-height: 32px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
section.block .sub {
  color: var(--text-2);
  margin: 0 0 20px;
  max-width: 62ch;
}
.cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}
.card .k {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  font-weight: 700;
}

/* Illustrated exhibits — less generic than feature cards. */
.exhibits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.exhibit {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.exhibit .art {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.exhibit h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.exhibit p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}
.exhibit .k {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
@media (max-width: 900px) {
  .exhibits {
    grid-template-columns: 1fr;
  }
}

/* ---------- docs & content pages ---------- */

.page,
.page.narrow {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  padding: 32px 0 64px;
}
/* The right-hand outline is only shown when there is genuinely room for it. */
.page aside.toc {
  display: none;
}
@media (min-width: 1240px) {
  .page {
    grid-template-columns: 200px minmax(0, 1fr) 176px;
  }
  .page aside.toc {
    display: block;
  }
}
.page aside.toc,
.page nav.side {
  position: sticky;
  top: calc(var(--masthead-h) + 20px);
  align-self: start;
  font-size: 14px;
}
.page nav.side a,
.page aside.toc a {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-2);
}
.page nav.side a:hover,
.page aside.toc a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.page nav.side a.active {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-2);
}
.prose {
  max-width: 74ch;
  min-width: 0;
}
.prose h1 {
  font-size: 32px;
  line-height: 38px;
  margin: 0 0 12px;
}
.prose h2 {
  font-size: 22px;
  line-height: 28px;
  margin: 32px 0 8px;
}
.prose h3 {
  font-size: 17px;
  margin: 24px 0 6px;
}
.prose p,
.prose li {
  color: var(--text);
}
.prose p {
  margin: 0 0 14px;
}
.prose ul,
.prose ol {
  padding-left: 22px;
  margin: 0 0 14px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 18px;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.prose th {
  background: var(--surface-2);
}
.callout {
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--primary);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 15px;
}

/* ---------- forms ---------- */

.field {
  margin: 0 0 20px;
  max-width: 420px;
}
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.field .hint {
  font-size: 13px;
  color: var(--text-2);
  margin: 4px 0 0;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--focus);
  outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent);
  outline-offset: 0;
}
.field .error {
  color: var(--error);
  font-size: 13px;
  margin: 6px 0 0;
}
.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.pill[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

/* ---------- playground ---------- */

.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px 0 48px;
}
.playground textarea {
  min-height: 160px;
  resize: vertical;
  font: 14px/22px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.output {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-height: 220px;
  padding: 14px;
  white-space: pre-wrap;
  font: 14px/22px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: auto;
}
.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 10px;
}
.stamp {
  display: inline-block;
  border: 2px dashed var(--roof);
  color: var(--roof);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  transform: rotate(-6deg);
}

/* ---------- footer ---------- */

footer.site {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0 40px;
  margin-top: 24px;
}
footer.site .wrap {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 24px;
}
footer.site h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin: 0 0 8px;
}
footer.site a {
  display: block;
  font-size: 14px;
  text-decoration: none;
  color: var(--text-2);
  padding: 3px 0;
}
footer.site a:hover {
  color: var(--text);
}
footer.site .fine {
  font-size: 13px;
  color: var(--text-2);
  max-width: 36ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .boards {
    grid-template-columns: 1fr;
  }
  .cols {
    grid-template-columns: 1fr 1fr;
  }
  .page,
  .page.narrow {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .page nav.side,
  .page aside.toc {
    position: static;
  }
  .playground {
    grid-template-columns: 1fr;
  }
  footer.site .wrap {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 767px) {
  .masthead nav > a {
    display: none;
  }
  .masthead nav {
    gap: 0;
  }
  .masthead-inner {
    gap: 8px;
  }
  .masthead nav a,
  .masthead nav button {
    padding: 8px 8px;
  }
  .hero h1 {
    font-size: 30px;
    line-height: 34px;
  }
  .hero {
    padding-top: 24px;
  }
  .town .hotspot {
    display: none;
  }
  .town .town-legend {
    display: none;
  }
  .wrap {
    padding: 0 16px;
  }
  .masthead-inner {
    padding: 0 16px;
  }
  .guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  .guide .label {
    grid-column: 1 / -1;
  }
  .guide .dot {
    display: none;
  }
  .guide a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    background: var(--surface-2);
  }
  .cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .masthead nav a span.long {
    display: none;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
