:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --ink: #2b2825;
  --muted: #5a534c;
  --accent: #1e467a;
  --gold: #c9a64b;
  --border: #ddd6ca;
  --terrace-w: 2300px;
  --margin-x: 70px;
  --house-w: 360px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  transition: background 0.45s ease, color 0.45s ease;
}

body.theme-dusk {
  --bg: #151b26;
  --surface: #1f2736;
  --ink: #eceef2;
  --muted: #a6b0c3;
  --accent: #7aa7e0;
  --gold: #e0bd63;
  --border: #2e384d;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.theme-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.theme-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.theme-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

body.theme-dusk .theme-btn[aria-pressed="true"] {
  color: #111622;
}

.site-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1.25rem;
  font-weight: 700;
}

.street-history p {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.terrace-section {
  margin: 2.5rem 0 4rem;
}

.section-bar {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-bar h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  margin: 0;
}

.scroll-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scroll-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.5rem;
}

.scroll-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.scroll-btn:hover {
  background: #ece6db;
  border-color: var(--muted);
}

.scroll-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  padding-bottom: 1.25rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #ebe7de;
  transition: background 0.45s ease, border-color 0.45s ease;
}

body.theme-dusk .scroll-viewport {
  background: #10151f;
}

.terrace-track {
  width: var(--terrace-w);
  margin: 0 auto;
  contain: layout style;
}

.elevation-wrap svg {
  display: block;
  width: var(--terrace-w);
  height: auto;
  transform: translateZ(0);
}

.house-group {
  cursor: pointer;
}

.house-group .house-hit {
  transition: fill 0.18s ease;
}

.house-group:hover .house-hit,
.house-group.is-active .house-hit {
  fill: rgba(30, 70, 122, 0.06);
}

.room-light {
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.house-group:hover .room-light,
.house-group.is-active .room-light {
  opacity: 0.92;
}

.house-group:hover .room-light--soft,
.house-group.is-active .room-light--soft {
  opacity: 0.58;
}

.dusk-sky,
.dusk-shade,
.lamp-glow {
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

body.theme-dusk .dusk-sky,
body.theme-dusk .lamp-glow {
  opacity: 1;
}

body.theme-dusk .dusk-shade {
  opacity: 0.24;
}

body.theme-dusk .lamp-lantern {
  fill: #FFE9A6;
  fill-opacity: 0.92;
}

body.theme-dusk .room-light {
  opacity: 0.22;
}

body.theme-dusk .room-light--soft {
  opacity: 0.10;
}

body.theme-dusk .house-group:hover .room-light,
body.theme-dusk .house-group.is-active .room-light {
  opacity: 0.98;
}

body.theme-dusk .house-group:hover .room-light--soft,
body.theme-dusk .house-group.is-active .room-light--soft {
  opacity: 0.68;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(6, var(--house-w));
  padding: 1.25rem var(--margin-x) 0.5rem;
  align-items: stretch;
}

.house-card {
  padding: 1.15rem 1.25rem;
  margin: 0 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(43, 40, 37, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.house-card:hover,
.house-card.is-active {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 70, 122, 0.12);
  border-top-color: var(--gold);
}

.house-number {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.house-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.occupant-meta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.house-card p {
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.house-card p:last-child {
  margin-bottom: 0;
}

/* Occupant Chronicle Timeline (replaces plain table) */
.chronicle {
  position: relative;
  margin: 0.9rem 0 0;
  padding: 0 0 0 1.15rem;
  list-style: none;
  border-left: 2px solid var(--border);
}

.chronicle-item {
  position: relative;
  padding-bottom: 1rem;
}

.chronicle-item:last-child {
  padding-bottom: 0.1rem;
}

.chronicle-item::before {
  content: "";
  position: absolute;
  left: -1.48rem;
  top: 0.35rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.chronicle-era {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(30, 70, 122, 0.08);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

body.theme-dusk .chronicle-era {
  background: rgba(122, 167, 224, 0.14);
}

.chronicle-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.chronicle-role {
  display: block;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.chronicle-note {
  font-size: 0.86rem;
  line-height: 1.48;
  color: var(--ink);
  margin: 0;
}

/* Vintage Advert Clipping */
.advert-btn {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.4rem;
  background: #f2ead9;
  border: 1px solid #cbbda2;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.advert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.advert-btn img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.advert-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #4a4238;
  margin-top: 0.3rem;
  font-weight: 600;
}

.chronicle-item.is-hidden {
  display: none;
}

.chronicle-toggle {
  appearance: none;
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(30, 70, 122, 0.06);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chronicle-toggle:hover {
  background: rgba(30, 70, 122, 0.12);
}

body.theme-dusk .chronicle-toggle {
  background: rgba(122, 167, 224, 0.10);
}

/* Native Lightbox Dialog */
dialog.advert-dialog {
  max-width: min(92vw, 680px);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

dialog.advert-dialog::backdrop {
  background: rgba(15, 20, 30, 0.72);
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.dialog-head h4 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.dialog-close {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.advert-dialog img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
