:root {
  --blue-900: #0d3b73;
  --blue-800: #124a8d;
  --blue-700: #1a5eaa;
  --blue-050: #f3f7fb;
  --ink: #1b2430;
  --muted: #66758a;
  --line: #dbe5ef;
  --line-strong: #c8d7e6;
  --card: #ffffff;
  --accent: #0f69c9;
  --accent-dark: #094f98;
  --success: #f1f8ff;
  --shadow: 0 16px 42px rgba(16, 43, 74, 0.08);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #edf4fb 0, #f8fbfe 340px, #f5f8fc 340px, #f5f8fc 100%);
}

body.lightbox-open {
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.site-header {
  background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
  color: #fff;
  padding-bottom: 34px;
}

.top-strip,
.hero-shell,
.page-shell,
.site-footer {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
}

.top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 11px;
}

.main-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-weight: 700;
}

.main-nav a {
  color: rgba(255, 255, 255, 0.92);
}

.hero-shell {
  display: block;
  padding: 12px 0 0;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.eyebrow.dark {
  color: var(--accent);
}

.hero-copy h1,
.section-head h2,
.results-head h2 {
  margin: 0;
  letter-spacing: -.04em;
}

.hero-copy h1 {
  max-width: 11ch;
  font-size: clamp(44px, 6vw, 72px);
  line-height: .94;
}

.hero-lead {
  max-width: 56ch;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.6;
}

.search-panel,
.brand-section,
.results-head,
.listing-card {
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-panel {
  border-radius: var(--radius-lg);
  padding: 18px;
  color: var(--ink);
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.search-grid.compact {
  grid-template-columns: 1.1fr 1.1fr 1.3fr 1.2fr;
  align-items: end;
}

.advanced-grid {
  margin-top: 14px;
}

.search-grid label {
  display: grid;
  gap: 7px;
}

.range-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.search-grid label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-grid input,
.search-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
}

.search-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 18px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.advanced-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
  cursor: pointer;
}

.advanced-link[aria-expanded="true"] {
  color: var(--accent);
}

.advanced-filters[hidden] {
  display: none;
}

.trust-row {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.trust-row span {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--success);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.page-shell {
  padding: 22px 0 28px;
}

.site-footer {
  padding: 0 0 34px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

.footer-copy {
  display: grid;
  gap: 4px;
}

.visitor-stats {
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--ink);
}

.visitor-stats-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.visitor-stats-value {
  font-weight: 700;
}

.brand-section {
  border-radius: 22px;
  padding: 20px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h2,
.results-head h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.brand-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fbff;
  font-weight: 800;
}

.brand-pill small {
  color: var(--muted);
  font-weight: 700;
}

.results-shell {
  margin-top: 18px;
}

.results-column {
  min-width: 0;
}

.results-head {
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.results-status {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.results-meta {
  text-align: right;
}

.results-counters {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.results-list {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.pagination {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pagination-summary {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-button {
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.pagination-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.pagination-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination-gap {
  color: var(--muted);
  font-weight: 800;
  padding: 0 4px;
}

.listing-card {
  border-radius: 22px;
  padding: 16px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.listing-media {
  height: 190px;
  min-height: 190px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(140deg, rgba(13, 59, 115, 0.95), rgba(25, 94, 170, 0.78)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.18), transparent 20%);
  position: relative;
  overflow: hidden;
}

.listing-gallery-track {
  height: 100%;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.listing-gallery-track::-webkit-scrollbar {
  display: none;
}

.listing-gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listing-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  cursor: zoom-in;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(13, 59, 115, 0.78);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.gallery-nav.prev {
  left: 10px;
}

.gallery-nav.next {
  right: 10px;
}

.gallery-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(13, 59, 115, 0.74);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 17, 31, 0.84);
  backdrop-filter: blur(8px);
}

.lightbox-shell {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 24px;
}

.lightbox-stage {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  border-radius: 24px;
  -webkit-overflow-scrolling: touch;
}

.lightbox-stage.zoomed {
  place-items: start center;
  cursor: grab;
}

.lightbox-image {
  display: block;
  max-width: none;
  max-height: none;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

.lightbox-close,
.lightbox-nav,
.lightbox-tool {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 52px;
  height: 52px;
  font-size: 34px;
  line-height: 1;
}

.lightbox-nav {
  width: 56px;
  height: 56px;
  font-size: 38px;
  line-height: 1;
}

.lightbox-nav.prev {
  grid-column: 1;
  grid-row: 1;
}

.lightbox-nav.next {
  grid-column: 3;
  grid-row: 1;
}

.lightbox-toolbar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
  color: #fff;
}

.lightbox-caption {
  max-width: min(70ch, 100%);
  font-weight: 700;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-tool {
  width: 46px;
  height: 46px;
  font-size: 28px;
  line-height: 1;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-tool:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav:disabled,
.lightbox-tool:disabled {
  opacity: 0.45;
  cursor: default;
}

.listing-media::before {
  content: "";
  position: absolute;
  inset: auto 14px 22px 14px;
  height: 58px;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.06));
  border-radius: 18px 28px 14px 14px;
}

.listing-media::after {
  content: "ФОТО";
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: rgba(255,255,255,.9);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .12em;
}

.listing-media.has-photo::before,
.listing-media.has-photo::after {
  display: none;
}

.listing-body {
  min-width: 0;
}

.listing-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.listing-title {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1;
}

.listing-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.price {
  white-space: nowrap;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-dark);
}

.price-block {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.price-insight {
  min-width: min(320px, 100%);
  padding: 12px 14px;
  border-radius: 16px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: #f8fbff;
  text-align: right;
}

.price-insight-badge {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.price-insight strong {
  font-size: 16px;
}

.price-insight span,
.price-insight small {
  color: var(--muted);
}

.price-insight-below {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.22);
}

.price-insight-below .price-insight-badge {
  background: rgba(16, 185, 129, 0.14);
  color: #0f7d59;
}

.price-insight-near {
  background: rgba(13, 59, 115, 0.06);
  border-color: rgba(13, 59, 115, 0.14);
}

.price-insight-near .price-insight-badge {
  background: rgba(13, 59, 115, 0.12);
  color: var(--accent-dark);
}

.price-insight-above {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.24);
}

.price-insight-above .price-insight-badge {
  background: rgba(245, 158, 11, 0.16);
  color: #9a5b00;
}

.specs-row {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.spec-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fbff;
  white-space: nowrap;
}

.spec-inline span,
.source-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.spec-inline strong,
.source-meta strong {
  display: block;
  font-size: 14px;
}

.listing-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.source-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-link {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
}

.action-link.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.empty-state {
  padding: 26px;
  border-radius: 22px;
  background: #fff;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.site-footer {
  padding: 0 0 26px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1040px) {
  .listing-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .top-strip,
  .results-head,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-meta {
    text-align: left;
  }

  .pagination {
    align-items: flex-start;
  }

  .search-grid,
  .search-grid.compact {
    grid-template-columns: 1fr;
  }

  .range-group {
    grid-template-columns: 1fr;
  }

  .listing-top,
  .listing-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .specs-row {
    gap: 8px;
  }

  .listing-title,
  .price {
    font-size: 24px;
  }

  .price-block {
    justify-items: start;
  }

  .price-insight-badge {
    justify-self: start;
  }

  .price-insight {
    min-width: 0;
    text-align: left;
  }

  .lightbox-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 16px 12px 20px;
  }

  .lightbox-stage,
  .lightbox-toolbar {
    grid-column: 1;
  }

  .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    font-size: 30px;
  }

  .lightbox-nav.prev {
    left: 10px;
  }

  .lightbox-nav.next {
    right: 10px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 28px;
  }

  .lightbox-toolbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 4px;
  }

  .lightbox-caption {
    font-size: 14px;
  }
}
