:root {
  --ink: #071437;
  --muted: #78829d;
  --line: #f1f1f4;
  --paper: #f9f9f9;
  --white: #ffffff;
  --primary: #1b84ff;
  --primary-active: #056ee9;
  --primary-light: #e9f3ff;
  --success: #17c653;
  --shadow: 0 10px 30px rgba(82, 63, 105, .12);
  --header-h: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 12px 18px; background: var(--white); color: var(--primary); }
.skip-link:focus { top: 12px; }

.app-shell { height: 100%; display: grid; grid-template-rows: var(--header-h) 1fr; }
.site-header {
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; width: auto; height: 42px; object-fit: contain; }
.brand-copy { display: grid; line-height: 1.04; }
.brand-copy strong { font-size: 18px; font-weight: 700; }
.brand-copy span { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.header-note { color: var(--muted); font-size: 13px; border-left: 1px solid var(--line); padding-left: 24px; }
.about-button { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-weight: 650; padding: 10px; }
.about-button:hover { color: var(--primary); }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(330px, 390px) 1fr; }
.catalog-panel { min-height: 0; display: flex; flex-direction: column; background: var(--white); z-index: 3; box-shadow: 8px 0 28px rgba(35, 54, 44, .08); }
.catalog-head { padding: 28px 26px 17px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.catalog-head h1 { margin: 0 0 8px; font-size: clamp(27px, 2.4vw, 34px); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.catalog-head > p:last-child { max-width: 310px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.search-form { padding: 0 26px 18px; border-bottom: 1px solid var(--line); }
.search-box { height: 46px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid #ccd8d0; border-radius: 12px; background: var(--paper); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27, 132, 255, .12); }
.search-box svg, .object-arrow, .mobile-results svg, .map-toolbar svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.search-box input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #89938d; }
.clear-search { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #e3e9e4; cursor: pointer; font-size: 20px; line-height: 1; }
.filters-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.filters-row select { width: 100%; height: 40px; padding: 0 30px 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 13px; }
.results-bar { min-height: 47px; display: flex; align-items: center; padding: 0 26px; border-bottom: 1px solid var(--line); }
.results-bar p { margin: 0; color: var(--muted); font-size: 13px; }
.reset-button { margin-left: auto; padding: 6px 0; border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; }
.catalog-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.object-list { display: grid; }
.object-card { border-bottom: 1px solid var(--line); }
.object-card-button { width: 100%; display: grid; grid-template-columns: 34px 1fr 18px; gap: 12px; align-items: start; padding: 18px 22px 18px 26px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.object-card-button:hover, .object-card-button:focus-visible, .object-card.is-selected .object-card-button { background: var(--primary-light); outline: none; }
.object-index { display: grid; place-items: center; width: 30px; height: 30px; border-radius: .475rem; background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 700; }
.object-index b { transform: none; }
.object-copy { min-width: 0; display: grid; gap: 5px; }
.object-kind { color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.object-title { font-size: 14px; font-weight: 600; line-height: 1.38; }
.object-address { color: var(--muted); font-size: 12px; line-height: 1.45; }
.object-arrow { align-self: center; width: 17px; color: #7d8981; }
.empty-state { padding: 48px 32px; text-align: center; color: var(--muted); }
.empty-state > span { display: block; color: var(--primary); font-size: 36px; }
.empty-state h2 { margin: 12px 0 6px; color: var(--ink); font-size: 20px; font-weight: 700; }
.empty-state p { margin: 0 0 18px; font-size: 13px; }
.empty-state button, .pagination button { border: 0; border-radius: .475rem; background: var(--primary); color: white; padding: 11px 17px; font-weight: 600; cursor: pointer; }
.pagination { padding: 14px 26px; border-top: 1px solid var(--line); background: var(--white); }
.pagination button { width: 100%; background: var(--primary-light); color: var(--primary); }

.map-panel { position: relative; min-width: 0; overflow: hidden; background: #dbe3da; }
.map { position: absolute; inset: 0; }
.map-toolbar { position: absolute; right: 18px; top: 18px; z-index: 2; }
.map-toolbar button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: .625rem; background: rgba(255,255,255,.96); box-shadow: var(--shadow); cursor: pointer; }
.map-status { position: absolute; z-index: 2; left: 50%; top: 18px; transform: translateX(-50%); max-width: min(520px, calc(100% - 150px)); padding: 10px 14px; border-radius: .625rem; background: rgba(255,255,255,.95); color: var(--muted); font-size: 12px; box-shadow: var(--shadow); }
.mobile-results { display: none; }

.fallback-map { position: absolute; inset: 0; overflow: hidden; background: #e5e8dd; }
.fallback-map::before, .fallback-map::after { content: ""; position: absolute; inset: -10%; opacity: .62; background-size: 118px 118px; }
.fallback-map::before { background-image: linear-gradient(32deg, transparent 46%, #fff 47%, #fff 51%, transparent 52%), linear-gradient(121deg, transparent 47%, #d3dacd 48%, #d3dacd 50%, transparent 51%); }
.fallback-map::after { transform: rotate(14deg); background-image: linear-gradient(90deg, transparent 48%, rgba(148,184,209,.68) 49%, rgba(148,184,209,.68) 52%, transparent 53%); background-size: 290px 290px; }
.fallback-map-label { position: absolute; left: 18px; bottom: 18px; z-index: 2; padding: 8px 11px; border-radius: 8px; background: rgba(255,255,255,.9); color: var(--muted); font-size: 11px; }
.fallback-marker { position: absolute; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid white; border-radius: 50% 50% 50% 8px; transform: translate(-50%, -100%) rotate(-45deg); background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(27, 132, 255, .3); cursor: pointer; }
.fallback-marker span { transform: rotate(45deg); font-size: 11px; font-weight: 700; }
.fallback-marker:hover, .fallback-marker.is-selected { background: var(--primary-active); z-index: 3; }

.detail-drawer { position: fixed; z-index: 30; right: 18px; top: calc(var(--header-h) + 18px); bottom: 18px; width: min(430px, calc(100vw - 36px)); overflow-y: auto; border-radius: 18px; background: var(--white); box-shadow: var(--shadow); transform: translateX(calc(100% + 40px)); transition: transform .24s ease; }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-close, .dialog-close { position: absolute; z-index: 2; right: 14px; top: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.94); cursor: pointer; font-size: 24px; line-height: 1; box-shadow: 0 3px 12px rgba(0,0,0,.1); }
.detail-hero { min-height: 190px; padding: 58px 24px 24px; display: flex; align-items: end; color: white; background: linear-gradient(145deg, #3898ff, #006ae6); }
.detail-hero.has-image { min-height: 230px; background-size: cover; background-position: center; position: relative; }
.detail-hero.has-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8,26,19,.83), rgba(8,26,19,.08)); }
.detail-hero > div { position: relative; z-index: 1; }
.detail-hero .eyebrow { color: #fff; opacity: .8; }
.detail-hero h2 { margin: 0; font-size: 25px; font-weight: 700; line-height: 1.25; }
.detail-body { padding: 24px; }
.detail-address { display: flex; gap: 9px; margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.detail-address::before { content: "⌖"; color: var(--primary); font-size: 19px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.detail-fact { padding: 13px; border-radius: 11px; background: var(--paper); }
.detail-fact span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.detail-fact strong { font-size: 13px; line-height: 1.35; }
.detail-description { margin: 0 0 24px; color: #465149; line-height: 1.65; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-actions button { min-height: 44px; border: 1px solid var(--primary); border-radius: .475rem; background: var(--white); color: var(--primary); cursor: pointer; font-weight: 600; }
.detail-actions button:first-child { background: var(--primary); color: white; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(18,32,25,.2); }

.about-dialog { max-width: 480px; border: 0; border-radius: 20px; padding: 34px; color: var(--ink); box-shadow: var(--shadow); }
.about-dialog::backdrop { background: rgba(12,29,21,.45); }
.about-dialog h2 { margin: 0 0 14px; font-size: 28px; font-weight: 700; }
.about-dialog p { color: var(--muted); line-height: 1.65; }
.about-dialog .dialog-footnote { margin-bottom: 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; }

body.is-header-hidden { --header-h: 0px; }
body.is-header-hidden .site-header { display: none; }
body.is-header-hidden .app-shell { grid-template-rows: 1fr; }
body.is-header-hidden .workspace { grid-row: 1; }

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .site-header { padding: 0 14px; }
  .brand-logo { height: 38px; }
  .brand-copy strong { font-size: 17px; }
  .brand-copy span { font-size: 9px; }
  .header-note, .about-button { display: none; }
  .workspace { position: relative; display: block; }
  .map-panel { position: absolute; inset: 0; }
  .catalog-panel { position: absolute; z-index: 5; left: 10px; right: 10px; bottom: 10px; max-height: 62%; border-radius: 17px; box-shadow: var(--shadow); transform: translateY(calc(100% + 20px)); transition: transform .24s ease; overflow: hidden; }
  .catalog-panel.is-open { transform: translateY(0); }
  .catalog-head { display: none; }
  .search-form { padding: 12px 13px 10px; order: 1; }
  .search-box { height: 42px; }
  .filters-row { display: none; }
  .results-bar { min-height: 40px; padding: 0 15px; order: 2; }
  .catalog-content { order: 3; }
  .pagination { order: 4; }
  .object-card-button { padding: 15px; }
  .mobile-results { position: absolute; z-index: 6; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; border: 0; border-radius: 24px; padding: 12px 18px; background: var(--primary); color: white; box-shadow: 0 8px 24px rgba(27,132,255,.28); font-weight: 700; }
  .catalog-panel.is-open + .map-panel .mobile-results { display: none; }
  .map-toolbar { top: 14px; right: 14px; }
  .map-status { top: 68px; max-width: calc(100% - 28px); }
  .fallback-map-label { display: none; }
  .detail-drawer { inset: auto 8px 8px; width: auto; max-height: 85%; top: auto; transform: translateY(calc(100% + 20px)); border-radius: 20px; }
  .detail-drawer.is-open { transform: translateY(0); }
  .detail-hero { min-height: 170px; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
