:root {
  color-scheme: light;
  --text: #17202a;
  --muted: #5d6b76;
  --line: #d8e0e7;
  --panel: #ffffff;
  --accent: #0f766e;
  --bg: #f5f7f8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: #075985; text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--text); }
.header-search { display: flex; gap: 8px; max-width: 520px; width: 100%; }
.header-search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}
button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: white;
  background: var(--accent);
  cursor: pointer;
}
.street-page { padding: 18px clamp(16px, 4vw, 56px) 48px; }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumbs > *:not(:last-child)::after { content: "/"; margin-left: 8px; color: #9aa6af; }
.street-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 24px;
  align-items: start;
  margin-bottom: 18px;
}
h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 56px); line-height: 1.05; letter-spacing: 0; }
.lede { margin: 0; color: var(--muted); font-size: 18px; max-width: 780px; }
.quick-facts, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.quick-facts { display: grid; gap: 10px; padding: 14px; }
.quick-facts span { color: var(--muted); }
.quick-facts strong { color: var(--text); }
.map-shell {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dde7e8;
}
.map-placeholder {
  display: grid;
  place-content: center;
  min-height: 360px;
  text-align: center;
  color: #244044;
  background: linear-gradient(135deg, #dbe7e7, #f2f5f2);
}
.map-placeholder strong { display: block; font-size: 28px; }
.map-placeholder span { color: var(--muted); }
.map-load { position: absolute; right: 16px; bottom: 16px; }
.map-canvas { min-height: 420px; }
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 24px;
}
.primary-content { display: grid; gap: 18px; }
.panel { padding: 18px; }
.panel h2, .panel h3 { margin: 0 0 12px; letter-spacing: 0; }
.poi-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.poi-group ul, .side-links ul { margin: 0; padding-left: 18px; }
.poi-group li { margin-bottom: 10px; }
.poi-group span { display: block; color: var(--muted); }
.index-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding-left: 18px;
}
.index-list span { color: var(--muted); font-size: 14px; }
.widget-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.widget-row > [data-widget] {
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f9fbfb;
}
.widget-row > [data-widget] strong { color: var(--text); }
.widget-row > [data-widget] span { display: block; }
.widget-row > [data-state="empty"] { background: #f6f8f8; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 700; }
.map-canvas { min-height: 420px; height: 420px; }
.map-canvas .leaflet-container { height: 100%; width: 100%; }

/* Route panel */
.route-panel { margin-bottom: 22px; }
.route-help { margin: 0 0 12px; color: var(--muted); }
.route-status { margin: 10px 0 0; color: var(--muted); min-height: 1.2em; }
.route-summary { margin: 10px 0 0; font-size: 18px; }
.route-panel[data-state="error"] .route-status { color: #b91c1c; }

/* Wikipedia / Wikimedia media widgets */
.media-widget { min-height: 120px; }
.media-widget .widget-loading, .media-widget .widget-empty { color: var(--muted); margin: 0; }
.wiki-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wiki-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.wiki-list li:last-child { border-bottom: 0; }
.wiki-list span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-grid .photo { display: block; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); aspect-ratio: 4 / 3; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Header search + autocomplete */
.header-search { position: relative; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field input { width: 100%; }
.search-suggestions {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  max-height: 360px;
  overflow: auto;
}
.search-suggestions li { border-radius: 6px; }
.search-suggestions li.is-active { background: #eef2f3; }
.search-suggestions a { display: flex; flex-direction: column; padding: 8px 10px; color: var(--text); }
.search-suggestions a:hover { text-decoration: none; }
.search-suggestions strong { font-weight: 600; }
.search-suggestions span { color: var(--muted); font-size: 13px; }

/* Search + home form */
.search-page-form { display: flex; gap: 8px; max-width: 560px; margin-top: 18px; }
.search-page-form input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 16px;
}
.search-results { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 4px; }
.search-results li { border-bottom: 1px solid var(--line); }
.search-results li:last-child { border-bottom: 0; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px; color: var(--text); }
.search-results strong { font-weight: 600; }
.search-results span { color: var(--muted); }

/* Home */
.home-hero { display: block; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.home-card { display: block; color: var(--text); transition: border-color .15s, transform .15s; }
.home-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.home-card h2 { margin: 0 0 6px; font-size: 20px; }
.home-card p { margin: 0; color: var(--muted); }

/* Pagination */
.pager { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pager a { font-weight: 600; }
.pager-current { color: var(--muted); }
.pager-next { margin-left: auto; }

/* Footer */
.site-footer {
  margin-top: 48px;
  padding: 28px clamp(16px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 10px; }
.site-footer p { margin: 0; font-size: 14px; }

@media (max-width: 760px) {
  .site-header, .street-hero, .content-grid { grid-template-columns: 1fr; }
  .site-header { display: grid; }
  .street-page { padding-inline: 12px; }
  h1 { font-size: 34px; }
  .search-page-form { max-width: none; }

  /* Mobile map sheet: fixed-height overlay, no document layout shift on open. */
  body.map-sheet-lock { overflow: hidden; }
  .map-shell.map-sheet--open {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    height: 80vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  }
  .map-shell.map-sheet--open .map-canvas { height: 100%; min-height: 0; }
  .map-sheet-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 1001;
    padding: 8px 14px;
    border-radius: 999px;
  }
}
