:root {
  --accent: #1f6feb; /* overwritten at runtime from siteConfig.accent */
  --bg: #f6f8fa;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Cross-site toggle (segmented control) */
.site-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.site-toggle .segment {
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}

.site-toggle .segment.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.site-toggle a.segment:hover {
  color: var(--accent);
  background: #fff;
}

.site-toggle a.segment:focus-visible,
.lang-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Language toggle */
.lang-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Promo banners (Beyond Smart Homes) — decorative, never affect layout width */
.ad-top {
  display: block;
  width: min(100%, 960px);
  margin: 0 auto;
  aspect-ratio: 4 / 1;
  line-height: 0;
}

.ad-top video,
.ad-rail video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ad-rail {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  /* fill 70% of the gutter between the 960px content column and the screen
     edge, capped at 56% of viewport height */
  height: min(56vh, calc((50vw - 508px) * 21 / 9 * 0.7));
  aspect-ratio: 9 / 21;
  z-index: 5;
}

/* hug the content column (inner edges), not the screen edges */
.ad-rail-left { right: calc(50% + 496px); }
.ad-rail-right { left: calc(50% + 496px); }

/* show side rails only when they fit fully outside the 960px content column */
@media (min-width: 1320px) and (min-height: 480px) {
  .ad-rail { display: block; }
}

/* Main */
.page {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.hero h1 { margin: 0 0 0.5rem; font-size: 1.8rem; }
.hero p { margin: 0 0 0.5rem; color: var(--muted); }

.phase-note {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer p { margin: 0.25rem 0; }
.site-footer a { color: var(--accent); }

@media (max-width: 480px) {
  .site-header { justify-content: center; }
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 1rem;
}
.f-search { flex: 1 1 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.f-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; }
.f-label { color: var(--muted); }
.f-field select, .f-field input { padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 0.9rem; min-width: 7.5rem; }
.f-field input[type=number] { width: 7.5rem; }

.btn { padding: 0.45rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 0.9rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-count { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.75rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; overflow: hidden; text-decoration: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-2px); }
.card-thumb { height: 170px; background: var(--bg); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb.noimg { display: flex; align-items: center; justify-content: center; }
.card-thumb.noimg::after { content: '🏠'; font-size: 2.2rem; opacity: 0.35; }
.card-body { padding: 0.9rem 1rem 1rem; }
.card-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.card-title { margin: 0 0 0.35rem; font-size: 1.02rem; line-height: 1.35; }
.card-loc { margin: 0 0 0.3rem; color: var(--muted); font-size: 0.85rem; }
.card-specs { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--text); }
.card-price { margin: 0; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 0.5rem; }

.badge { font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.rented { background: #b35900; color: #fff; }
.badge.neg { background: var(--bg); border: 1px solid var(--border); color: var(--muted); font-weight: 400; }

.empty { color: var(--muted); padding: 2rem 0; }
.pager { display: flex; gap: 0.75rem; align-items: center; justify-content: center; margin-top: 1.25rem; }
.pager-info { color: var(--muted); font-size: 0.9rem; }

/* Detail */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--accent); text-decoration: none; }
.detail-head { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }
.detail-head h1 { margin: 0 0 0.4rem; font-size: 1.5rem; }
.detail-loc { color: var(--muted); margin: 0 0 0.3rem; }
.detail-price { font-size: 1.25rem; font-weight: 700; color: var(--accent); margin: 0 0 1rem; display: flex; align-items: center; gap: 0.6rem; }

.dsection { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.dsection h2 { margin: 0 0 0.75rem; font-size: 1.05rem; color: var(--accent); }
.dsection dl { margin: 0; }
.drow { display: flex; gap: 1rem; padding: 0.3rem 0; }
.drow dt { min-width: 10rem; color: var(--muted); font-size: 0.9rem; }
.drow dd { margin: 0; font-size: 0.95rem; }
.drow a { color: var(--accent); }
.desc { margin: 0; line-height: 1.7; white-space: pre-line; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.82rem; }

/* Detail gallery */
.gallery { margin-bottom: 1rem; }
.gallery-main {
  width: 100%; max-height: 460px; object-fit: cover; display: block;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg);
}
.gallery-thumbs { display: flex; gap: 0.5rem; margin-top: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.gallery-thumbs img {
  width: 84px; height: 62px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; flex: 0 0 auto; opacity: 0.75; transition: opacity 0.15s, border-color 0.15s;
}
.gallery-thumbs img:hover { opacity: 1; }
.gallery-thumbs img.active { border-color: var(--accent); opacity: 1; }

/* Map */
.map-embed {
  width: 100%; height: 320px; border: 1px solid var(--border);
  border-radius: var(--radius); display: block;
}
.map-link { margin: 0.6rem 0 0; font-size: 0.9rem; }
.map-link a { color: var(--accent); }

@media (max-width: 600px) {
  .drow { flex-direction: column; gap: 0.1rem; }
  .drow dt { min-width: 0; }
  .gallery-main { max-height: 300px; }
  .map-embed { height: 240px; }
}
