/* ==========================================================================
   Nationwide Properties - site styles
   Understated, institutional. One accent colour, generous whitespace,
   thin rules, restrained type.
   ========================================================================== */

:root {
  --navy: #1f3a5f;
  --navy-dark: #16293f;
  --ink: #1c1f23;
  --muted: #5b636d;
  --line: #dce0e5;
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --focus: #b9822b;
  --maxw: 1100px;
  --radius: 4px;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy-dark);
}

h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 0 0 .75rem; }
h3 { font-size: 1.1rem; margin: 0; }

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

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

img { max-width: 100%; height: auto; display: block; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 .4rem;
}

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  background: #fff;
  padding: 8px 14px;
  z-index: 10;
  border: 1px solid var(--line);
}

/* ---------- header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-header__brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy-dark);
  text-decoration: none;
  letter-spacing: .01em;
}
.site-nav {
  display: flex;
  gap: 22px;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: .95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--navy); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: .85rem;
  color: var(--muted);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.site-footer p { margin: 0; max-width: 70ch; }

/* ---------- generic page ---------- */
.page { padding-top: 32px; }

.breadcrumb {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--muted); }

/* ---------- home hero ---------- */
.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}
.hero p.lead {
  font-size: 1.15rem;
  max-width: 62ch;
  color: var(--muted);
  margin: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding: 28px 0 4px;
}
.stats .stat { min-width: 120px; }
.stats .stat b {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.9rem;
  color: var(--navy-dark);
  line-height: 1;
}
.stats .stat span {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.section { margin: 40px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; }
.section-head a { font-size: .9rem; white-space: nowrap; }

/* ---------- property grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover {
  box-shadow: 0 6px 20px rgba(22, 41, 63, .12);
  transform: translateY(-2px);
}
.card__link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card__media {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card__eyebrow {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0;
}
.card__title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--navy-dark);
  margin: 0;
}
.card__meta {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: .85rem;
  color: var(--muted);
}
.card__meta li { position: relative; }
.card__meta li + li::before {
  content: "\00b7";
  position: absolute;
  left: -8px;
}
.card__price {
  margin: auto 0 0;
  padding-top: 10px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
}

/* ---------- filters ---------- */
.filters {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 18px 20px;
  margin-bottom: 28px;
}
.filters__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.field label {
  display: block;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input[type="text"],
.field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.field--range .range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field--range input[type="range"] { flex: 1; }
.field--range output {
  font-size: .85rem;
  color: var(--muted);
  min-width: 4ch;
}
.filters__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.result-count {
  font-size: .9rem;
  color: var(--muted);
}
.btn-reset {
  font: inherit;
  font-size: .85rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  color: var(--ink);
}
.btn-reset:hover { border-color: var(--navy); }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---------- detail page ---------- */
.detail__head { margin-bottom: 24px; }
.detail__id { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }

.detail__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}
@media (min-width: 860px) {
  .detail__grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

.detail__main .section:first-child { margin-top: 0; }
.detail__main p { max-width: 68ch; }

.specs {
  margin: 0;
  border-top: 1px solid var(--line);
}
.specs .spec {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.specs dt { color: var(--muted); font-size: .9rem; }
.specs dd { margin: 0; }
@media (max-width: 520px) {
  .specs .spec { grid-template-columns: 1fr; gap: 2px; }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.gallery__item {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  cursor: zoom-in;
}
.gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.gallery__item:hover { border-color: var(--navy); }
.gallery__item:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- lightbox (photo viewer) ---------- */
.lightbox[hidden] { display: none !important; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  /* flex + margin:auto on the stage keeps the photo centred; overflow:auto means
     if a photo is ever taller than the screen it scrolls rather than clipping
     (margin:auto, unlike place-items:center, keeps the top reachable). */
  display: flex;
  overflow: auto;
  padding: clamp(16px, 4vw, 44px);
  background: rgba(14, 16, 20, 0.86);
  -webkit-overflow-scrolling: touch;
}
.lightbox:not([hidden]) { animation: lightbox-fade 0.13s ease-out; }
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox__stage {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(1080px, 100%);
}
.lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  /* leave room for padding + the caption so the photo is never cut off.
     72vh is the safe floor everywhere; the svh line gives a bit more room
     on browsers that support it. */
  max-height: 72vh;
  max-height: calc(100svh - 10rem);
  object-fit: contain;
  border-radius: 8px;
  background: #0c0d0f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.lightbox:not([hidden]) .lightbox__img { animation: lightbox-pop 0.15s ease-out; }
@keyframes lightbox-pop {
  from { transform: scale(0.97); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.lightbox__caption {
  margin: 0;
  color: #e9ecef;
  font-size: 0.85rem;
  text-align: center;
  max-width: 60ch;
}
.lightbox__close,
.lightbox__btn {
  position: fixed;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(20, 22, 26, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  line-height: 1;
}
.lightbox__close:hover,
.lightbox__btn:hover { background: rgba(40, 44, 50, 0.9); }
.lightbox__close:focus-visible,
.lightbox__btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.lightbox__close {
  top: 14px;
  right: 16px;
  width: 46px;
  height: 46px;
  font-size: 1.25rem;
}
.lightbox__btn {
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  font-size: 2rem;
  padding-bottom: 4px;
}
.lightbox__btn--prev { left: 14px; }
.lightbox__btn--next { right: 14px; }
.lightbox__btn[hidden] { display: none !important; }
@media (max-width: 560px) {
  .lightbox { padding: 10px; }
  .lightbox__img { max-height: 74vh; max-height: calc(100svh - 8rem); }
  .lightbox__close { width: 42px; height: 42px; }
  .lightbox__btn { width: 44px; height: 44px; font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox:not([hidden]),
  .lightbox:not([hidden]) .lightbox__img { animation: none; }
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.doc-list li { border-bottom: 1px solid var(--line); padding: 10px 0; }

.map-frame {
  width: 100%;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- contact card ---------- */
.detail__aside { align-self: start; }
.contact-card {
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-soft);
}
.contact-card__price {
  font-size: 1.15rem;
  margin: 0 0 8px;
}
.contact-card__lead {
  font-size: .9rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.contact-card__name { font-weight: 600; margin: 0 0 2px; }
.contact-card__email { margin: 0; word-break: break-word; }

/* standalone contact page reuses the card full width */
.contact-page .contact-card { max-width: 420px; }

/* ---------- responsive header ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header__inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 40px 0 32px; }
  h1 { font-size: 1.6rem; }
}
