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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

img { max-width: 100%; }

a { color: var(--navy); }

button, input, select { font-family: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--navy);
  color: var(--white);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}
.skip:focus { top: 12px; }

.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;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--content);
  margin: 0 auto;
  padding: 22px 28px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
  min-width: 0;
}
.brand img { display: block; flex: none; }
.brand-lockup { display: flex; flex-direction: column; min-width: 0; }
.wordline { display: flex; align-items: baseline; }
.wordmark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--navy);
}
.tld {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-left: 1px;
}
.brand-bar {
  display: block;
  height: 3px;
  margin-top: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--flame) 0%, var(--coral) 28%, var(--magenta) 54%, var(--violet) 78%, var(--indigo) 100%);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-links a,
.linkish {
  color: var(--ink);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}
.nav-links a:hover,
.linkish:hover { color: var(--navy); }
.inline-form { margin: 0; }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.search {
  display: flex;
  align-items: center;
  width: min(780px, calc(100% - 48px));
  margin: 8px auto 6px;
  padding: 7px 7px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow-search);
}
.search:focus-within {
  box-shadow: var(--shadow-search), 0 0 0 2px rgba(0, 64, 176, 0.18);
}
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  flex: 1;
}
.field + .field { border-left: 1px solid var(--line); }
.field.where { flex: 1.45; }
.field.price { flex: 1.05; }
.field.beds { flex: 0.7; }
.lbl {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}
.field input,
.field select {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  min-width: 0;
  padding: 0;
  outline: none;
}
.field input::placeholder { color: var(--muted); opacity: 1; }
.field select {
  appearance: none;
  cursor: pointer;
}
.field select.is-set { color: var(--ink); font-weight: 600; }
.search-btn {
  width: 46px;
  height: 46px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--magenta);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.search-btn:hover { background: #9e217c; }

.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: 18px 28px 0;
}
.block + .block { margin-top: 34px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}
.section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.view-map {
  color: var(--navy);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.view-map:hover { text-decoration: underline; }

.cities {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
}
.city {
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  min-width: 0;
}
.city img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  background: var(--paper);
  display: block;
}
.city span {
  display: block;
  margin-top: 10px;
  font-size: 14.5px;
  font-weight: 500;
}
.city.is-active img { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--navy); }
.city.is-active span { color: var(--navy); font-weight: 700; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.card-media { position: relative; }
.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-card);
  background: var(--paper);
  display: block;
}
.heart {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.heart[aria-pressed="true"] path {
  fill: var(--magenta);
  stroke: var(--white);
}
.card-copy { text-decoration: none; color: inherit; display: block; }
.price {
  margin: 10px 0 0;
  color: var(--navy);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.015em;
}
.meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}
.empty { color: var(--ink); }
.empty a { font-weight: 600; }

.footer {
  max-width: var(--content);
  margin: 48px auto 28px;
  padding: 8px 28px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.footer p { margin: 0; }
.footer nav { display: flex; gap: 22px; }
.footer a { color: var(--ink); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.prose {
  max-width: 720px;
  margin: 8px auto 0;
  padding: 8px 28px 12px;
}
.prose h1 {
  margin: 12px 0 12px;
  color: var(--navy);
  font-size: 32px;
  letter-spacing: -0.03em;
}
.prose p { margin: 0 0 14px; }
.note {
  background: var(--paper);
  border-radius: 12px;
  padding: 14px 16px;
}
.stack-form, .prose form { display: grid; gap: 12px; max-width: 360px; }
.stack-form label, .prose form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.stack-form input, .prose form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.btn {
  width: fit-content;
  background: var(--navy);
  color: var(--white);
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: #00348f; }
.credits { padding-left: 18px; }
.credits li { margin: 0 0 8px; }

.detail { padding-bottom: 12px; }
.back {
  display: inline-block;
  margin-bottom: 14px;
  font-weight: 600;
  text-decoration: none;
}
.detail-photo {
  width: min(880px, 100%);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-card);
  background: var(--paper);
  display: block;
}
.detail h1 {
  margin: 16px 0 0;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -0.03em;
}
.detail-price { font-size: 20px; }
.address { margin: 8px 0 0; }
.detail .note { margin-top: 14px; max-width: 680px; }
#detail-map {
  height: 320px;
  margin-top: 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  max-width: 880px;
}

.map-page { padding-bottom: 8px; }
#catalog-map {
  height: min(68vh, 720px);
  min-height: 460px;
  margin: 14px 28px 0;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
}
.map-status {
  margin: 10px 28px 0;
  color: var(--muted);
  font-size: 14px;
}

.pin-popup {
  display: block;
  width: 200px;
  text-decoration: none;
  color: inherit;
}
.pin-popup img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
.pin-popup strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 14px;
}
.pin-popup span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .cities {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .city { flex: 0 0 112px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search {
    flex-direction: column;
    align-items: stretch;
    border-radius: 28px;
    width: calc(100% - 32px);
    padding: 6px;
  }
  .field { border-left: 0; padding: 4px 12px; }
  .field + .field { border-top: 1px solid var(--line); }
  .search-btn { margin: 8px 8px 4px auto; }
  #catalog-map { margin: 14px 16px 0; min-height: 380px; }
}
@media (max-width: 640px) {
  .topbar, .wrap, .footer { padding-left: 16px; padding-right: 16px; }
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .nav-links { width: 100%; justify-content: flex-end; gap: 16px; }
  .cards { grid-template-columns: 1fr; }
  .wordmark { font-size: 18px; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
