:root {
  --ink: #16302B;
  --brand: #004d40;
  --brand-deep: #06211D;
  --brass: #C89B5C;
  --ivory: #FBF8F3;
  --mist: #7C9990;
  --white: #FFFFFF;
  --line: rgba(22, 48, 43, 0.08);

  --radius-lg: 1.375rem;
  --radius-md: 0.875rem;
  --radius-sm: 0.5625rem;
  --shadow-card: 0 14px 34px -14px rgba(6, 33, 29, 0.22);
  --shadow-soft: 0 4px 16px -6px rgba(6, 33, 29, 0.12);
  --ease: cubic-bezier(0.16, 0.84, 0.44, 1);
}

* {
  box-sizing: border-box;
}

/* Fluid root size: shrinks proportionally below ~373px viewport width,
   flat at 16px from ~427px up — this is what makes every rem-based
   size in this file scale on narrow phones and cap on larger screens. */
html {
  font-size: clamp(14px, 3.75vw, 16px);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ivory);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* Fills the actual device width at every screen size — no fixed
   column, no cap. overflow-x is a second line of defense against
   horizontal overflow alongside the one already set on html/body.
   Height uses 100dvh (falls back to 100vh where dvh isn't supported)
   rather than 100vh alone — 100vh is measured including space a
   mobile browser's address bar temporarily occupies, which is its own
   small form of vertical overflow (page taller than what's actually
   visible until you scroll); dvh tracks the real visible viewport. */
.app-container {
  width: 100%;
  margin: 0 auto;
  position: relative;
  background: var(--ivory);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  color: var(--ink);
  margin: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Eyebrow / label utility ---------- */
.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  color: var(--brass);
}

/* ---------- Side drawer menu ---------- */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 78%;
  max-width: 20rem;
  background: var(--white);
  color: var(--ink);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.25);
}
.side-menu.open {
  transform: translateX(0);
}
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.menu-logo {
  height: 3rem;
  width: 3rem;
  border-radius: 0.625rem;
}
.close-btn {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}
.menu-items {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.625rem;
  gap: 0.125rem;
  flex: 1;
}
.menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.2s ease;
}
.menu-link:hover,
.menu-link:active {
  background: rgba(22, 48, 43, 0.06);
  color: var(--brand);
}
.menu-link.active-link {
  background: rgba(200, 155, 92, 0.16);
  color: var(--brass);
  font-weight: 600;
}
.menu-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--line);
}
.menu-footer p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--mist);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 33, 29, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 150;
}
.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Header ---------- */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem 0.875rem;
  background: var(--ivory);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-logo {
  height: 1.875rem;
  width: auto;
}
.hamburger {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.hamburger span {
  display: block;
  width: 1rem;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.location-pill {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4375rem 0.5rem;
  font-family: "Inter", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  white-space: nowrap;
}
.location-pill svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--brand);
  flex-shrink: 0;
}
.location-pill .chevron {
  width: 0.625rem;
  height: 0.625rem;
  color: var(--mist);
}
.notif-btn {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  flex-shrink: 0;
}
.notif-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--ink);
}
.notif-dot {
  position: absolute;
  top: 0.5rem;
  right: 0.5625rem;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: #D65A4A;
  border: 1.5px solid var(--white);
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem 0.375rem;
  animation: rise-in 0.6s var(--ease) both;
}
.hero-text {
  flex: 1;
  min-width: 0;
}
.hero .eyebrow {
  display: block;
  margin-bottom: 0.625rem;
}
.hero h1 {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 600;
}
.hero p {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mist);
}
.hero-image {
  display: none;
  flex: 0 0 auto;
  width: 8.75rem;
  aspect-ratio: 3 / 4;
  align-self: center;
  background-size: cover;
  background-position: center;
  background-color: var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.hero-image.has-image {
  display: block;
  animation: rise-in 0.5s var(--ease) both;
}

/* ---------- Search bar ---------- */
.search-section {
  padding: 1rem 1.25rem 0.25rem;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--white);
  border-radius: 999px;
  padding: 0.375rem 0.375rem 0.375rem 1rem;
  box-shadow: var(--shadow-soft);
}
.search-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--mist);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  color: var(--ink);
  padding: 0.625rem 0;
}
.search-input::placeholder {
  color: var(--mist);
}
.search-filter-btn {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  background: rgba(0, 77, 64, 0.08);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
  cursor: pointer;
}
.search-filter-btn svg {
  width: 1rem;
  height: 1rem;
}

/* ---------- Search results modal ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: rgba(6, 33, 29, 0.5);
  padding: 3.75rem 1.25rem 1.25rem;
}
.search-modal.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.search-modal-inner {
  width: 100%;
  max-width: 30rem;
  max-height: 80vh;
  background: var(--ivory);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}
.search-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.search-modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}
.search-modal-results {
  overflow-y: auto;
  padding: 0.625rem 1.125rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.search-result-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}
.search-result-card:active {
  background: rgba(22, 48, 43, 0.06);
}
.search-result-img {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--line);
  flex-shrink: 0;
}
.search-result-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.125rem;
}
.search-result-info p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--mist);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ---------- Quick actions ---------- */
.quick-actions {
  display: flex;
  gap: 0.625rem;
  padding: 1.375rem 1.25rem 0.5rem;
}
.action-btn {
  flex: 1;
  min-width: 0;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem 0.625rem 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease);
  animation: rise-in 0.6s var(--ease) both;
}
.action-btn:nth-child(1) { animation-delay: 0.05s; }
.action-btn:nth-child(2) { animation-delay: 0.12s; }
.action-btn:nth-child(3) { animation-delay: 0.19s; }
.action-btn:active {
  transform: scale(0.96);
}
.btn-icon {
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 50%;
  background: rgba(0, 77, 64, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}
.btn-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}
.action-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}
.action-text strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}
.action-text span {
  font-size: 0.66rem;
  color: var(--mist);
  line-height: 1.25;
}

/* ---------- Trust badges ---------- */
.trust-row {
  padding: 1.125rem 1.25rem 0.25rem;
}
.trust-box {
  display: flex;
  justify-content: space-between;
  gap: 0.375rem;
  background: rgba(200, 155, 92, 0.10);
  border-radius: var(--radius-lg);
  padding: 1rem 0.5rem;
}
.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  text-align: center;
}
.trust-item svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--brand);
  flex-shrink: 0;
}
.trust-item span {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

/* ---------- Filter pills ---------- */
.filter-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.125rem 1.25rem 0.875rem;
  -webkit-overflow-scrolling: touch;
}
.filter-pills::-webkit-scrollbar {
  display: none;
}
.pill {
  flex: 0 0 auto;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5625rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}
.pill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Scroll sections ---------- */
.scroll-section {
  padding: 1.625rem 0 0.25rem;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 1.25rem 0.875rem;
}
.section-header .eyebrow {
  display: block;
  margin-bottom: 0.25rem;
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}
.section-header a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.section-header a::after {
  content: "→";
  transition: transform 0.2s var(--ease);
}
.section-header a:active::after {
  transform: translateX(3px);
}

.horizontal-scroller {
  display: flex;
  gap: 0.875rem;
  overflow-x: auto;
  padding: 0.125rem 1.25rem 0.625rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.horizontal-scroller::-webkit-scrollbar {
  display: none;
}

/* ---------- Property card ---------- */
.property-card {
  flex: 0 0 auto;
  width: 15rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.25s var(--ease);
  animation: rise-in 0.5s var(--ease) both;
}
.property-card:active {
  transform: scale(0.98);
}
.card-img {
  height: 10rem;
  background-size: cover;
  background-position: center;
  background-color: var(--line);
  position: relative;
}
.card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 33, 29, 0) 55%, rgba(6, 33, 29, 0.55) 100%);
}
.price-tag {
  position: absolute;
  z-index: 1;
  bottom: 0.625rem;
  right: 0.625rem;
  background: rgba(251, 248, 243, 0.94);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
}
.verified-mark {
  position: absolute;
  z-index: 1;
  top: 0.625rem;
  left: 0.625rem;
  background: var(--brand);
  color: var(--white);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem 0.25rem 0.375rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.1875rem;
  letter-spacing: 0.2px;
}
.verified-mark svg {
  width: 0.6875rem;
  height: 0.6875rem;
}
.fav-btn {
  position: absolute;
  z-index: 1;
  top: 0.625rem;
  right: 0.625rem;
  width: 1.8125rem;
  height: 1.8125rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
}
.fav-btn svg {
  width: 0.875rem;
  height: 0.875rem;
}
.fav-btn.active svg {
  fill: #D65A4A;
  stroke: #D65A4A;
}
.card-info {
  padding: 0.75rem 0.875rem 0.9375rem;
}
.card-info h3 {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.1875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-info p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  color: var(--mist);
}
.pin-icon {
  width: 0.6875rem;
  height: 0.6875rem;
  flex-shrink: 0;
  color: var(--mist);
}

/* ---------- Loading + empty/error states ---------- */
.loading-shimmer {
  flex: 0 0 auto;
  width: 15rem;
  height: 14.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--line) 30%, rgba(22, 48, 43, 0.14) 50%, var(--line) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.error-msg {
  padding: 1.25rem;
  font-size: 0.85rem;
  color: var(--mist);
  font-style: italic;
}

/* ---------- Stats bar ---------- */
.stats-bar {
  padding: 1.375rem 1.25rem 0.25rem;
}
.stats-box {
  display: flex;
  justify-content: space-between;
  gap: 0.625rem;
  background: rgba(200, 155, 92, 0.10);
  border-radius: var(--radius-lg);
  padding: 1.25rem 0.875rem;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
  flex: 1;
}
.stat-icon {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  background: rgba(0, 77, 64, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}
.stat-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}
.stat-item strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}
.stat-item span {
  font-size: 0.68rem;
  color: var(--mist);
  font-weight: 500;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}