/*
  Palette grounded in the actual landscape rather than generic "real estate blue" or the
  cream+terracotta combination that's become a default look — see docs/DECISIONS.md.
  Wheat gold + barn rust + deep evergreen, warm ink-brown text, soft prairie-cream ground.
  Single theme (light only) — see docs/DECISIONS.md for why that's a deliberate choice here.
*/
:root {
  --wheat: #c99a3a;
  --wheat-deep: #a97e28;
  --rust: #a8452f;
  --evergreen: #2f4a3c;
  --evergreen-deep: #223729;
  --ink: #2a241c;
  --ink-muted: #6b5f4e;
  --cream: #f5f0e4;
  --surface: #fffdf8;
  --border: #ddd3bc;
  --demo-flag: #a8452f;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Work Sans', ui-sans-serif, system-ui, sans-serif;

  --max-width: 1120px;
  --radius: 3px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
}

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

a { color: var(--evergreen-deep); }
a:hover { color: var(--rust); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0 0 0.6em 0;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em 0; max-width: 68ch; }

/* ---- header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
}
.site-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  line-height: 1.2;
}
.site-brand__logo {
  height: 40px;
  width: auto;
  display: block;
}
.site-brand__text {
  display: flex;
  flex-direction: column;
}
.site-brand small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.primary-nav__list {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.primary-nav__list a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
}
.primary-nav__list a:hover { color: var(--rust); }

/* ---- hero ---- */
.hero {
  background:
    linear-gradient(180deg, rgba(34, 55, 41, 0.82) 0%, rgba(34, 55, 41, 0.93) 100%),
    var(--hero-image) center 65% / cover no-repeat;
  color: #f5f0e4;
  padding: 4.5rem 0;
}
.hero__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
}
.hero__content { flex: 1 1 380px; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p.lede { color: #d9e3da; max-width: 52ch; font-size: 1.15rem; }
.hero__cta {
  display: inline-flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.hero__phone {
  margin: 1.5rem 0 0;
  font-size: 1.05rem;
  color: #d9e3da;
}
.hero__phone a {
  display: inline-block;
  margin-left: 0.4rem;
  color: var(--wheat);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  text-decoration: none;
}
.hero__phone a:hover { color: var(--wheat-deep); text-decoration: underline; }
.hero__logo-card {
  flex: 0 1 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero__logo-card img {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
}
@media (max-width: 780px) {
  .hero__inner { flex-direction: column; }
  .hero__logo-card { order: -1; flex-basis: auto; max-width: 220px; padding: 1.25rem; }
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn--primary { background: var(--wheat); color: var(--evergreen-deep); }
.btn--primary:hover { background: var(--wheat-deep); color: var(--evergreen-deep); }
.btn--outline { border-color: #f5f0e4; color: #f5f0e4; }
.btn--outline:hover { background: rgba(245, 240, 228, 0.12); color: #fff; }
.btn--outline-dark { border-color: var(--evergreen); color: var(--evergreen-deep); }
.btn--outline-dark:hover { background: var(--evergreen); color: #fff; }

/* ---- intro panel (no listings yet) ---- */
.intro-panel { padding: 4.5rem 0; }
.intro-panel__inner { max-width: 62ch; }
.intro-panel h2 { font-size: clamp(1.75rem, 3.5vw, 2.4rem); }

/* ---- sections ---- */
.section { padding: 3.5rem 0; }
.section--muted { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.section__head a.see-all { font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---- listing / sold grids ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.75rem;
}

.listing-card, .sold-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.listing-card:hover, .sold-card:hover {
  border-color: var(--wheat-deep);
  transform: translateY(-2px);
}
.listing-card:hover .listing-card__addr { color: var(--rust); }
.listing-card__media, .sold-card__media {
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(45deg, #e9e2cf, #e9e2cf 12px, #f0ead9 12px, #f0ead9 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}
.listing-card__body, .sold-card__body { padding: 1.1rem 1.25rem 1.3rem; }
.listing-card__price { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin-bottom: 0.15rem; }
.listing-card__addr { font-weight: 600; margin-bottom: 0.1rem; }
.listing-card__town { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 0.6rem; }
.listing-card__stats {
  display: flex;
  gap: 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: auto;
}
.sold-card__badge {
  display: inline-block;
  background: var(--evergreen);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

/* ---- DDF®-sourced listing cards — see docs/DECISIONS.md "DDF-powered Foothills listings" ---- */
.listing-card__link {
  display: contents;
}
.listing-card__link .listing-card__addr,
.listing-card__link .listing-card__price {
  text-decoration: none;
}
.listing-card__attribution {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1.25rem 0.9rem;
}
.listing-card__badge {
  height: 18px;
  width: auto;
  display: block;
}

.demo-ribbon {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--demo-flag);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  z-index: 2;
}

/* ---- listing detail ---- */
.listing-detail__stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 1.5rem 0;
}
.listing-detail__stat { display: flex; flex-direction: column; }
.listing-detail__stat span:first-child { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.listing-detail__stat span:last-child { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }

.listing-detail__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.listing-detail__gallery-item {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}
.listing-detail__gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

/* ---- listing photo lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox[hidden] { display: none; }
.lightbox__image {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.5rem;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
}
.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }
.listing-detail__attribution {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.listing-detail__attribution img { height: 20px; width: auto; display: block; }

.listing-detail__facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
  margin: 1rem 0 2rem;
}
.listing-detail__fact { display: flex; flex-direction: column; gap: 0.15rem; }
.listing-detail__fact span:first-child { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.listing-detail__fact span:last-child { font-size: 1rem; }

/* ---- listing search ---- */
.listing-search__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0 2rem;
}
.listing-search__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.listing-search__field label { color: var(--ink-muted); }
.listing-search__field input, .listing-search__field select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  min-width: 140px;
}
.listing-search__pagination {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.listing-search__pagination .page-numbers {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.listing-search__pagination .page-numbers.current {
  background: var(--rust);
  border-color: var(--rust);
  color: #fff;
}

/* ---- DDF® enhanced browse-wrap notice (see docs/DECISIONS.md) ---- */
.ddf-notice {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--evergreen-deep, #223b2f);
  color: #fff;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
/* Same specificity as the browser's default [hidden] rule, but loads later — without this,
   .ddf-notice's own `display: flex` always wins and the notice never actually disappears when
   main.js sets `notice.hidden = true` on dismiss. */
.ddf-notice[hidden] { display: none; }
.ddf-notice p { margin: 0; max-width: 60ch; }
.ddf-notice a { color: #fff; text-decoration: underline; }
.ddf-notice__dismiss {
  background: #fff;
  color: var(--evergreen-deep, #223b2f);
  border: none;
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- area gallery ---- */
.area-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.area-gallery figure {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.area-gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.area-gallery figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--surface);
}

/* ---- fair housing ---- */
.fair-housing {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  padding-left: 1.25rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--wheat);
}
.fair-housing p { max-width: 68ch; }

/* ---- foothills pedigree ---- */
.pedigree { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
.pedigree__timeline { position: relative; margin-top: 2.25rem; max-width: 640px; }
.pedigree__timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}
.pedigree__entry { position: relative; padding-left: 2.25rem; margin-bottom: 2.75rem; }
.pedigree__entry:last-child { margin-bottom: 0; }
.pedigree__entry::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--wheat);
  box-shadow: 0 0 0 3px var(--cream);
}
.pedigree__entry--current::before { background: var(--rust); }
.pedigree__year {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--evergreen-deep);
  margin-bottom: 0.4rem;
}
.pedigree__photo {
  margin: 1.1rem 0 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 440px;
}
.pedigree__photo img { width: 100%; display: block; filter: sepia(12%) contrast(1.02); }
.pedigree__photo figcaption {
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  background: var(--surface);
}
.pedigree__source {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-muted);
  max-width: 640px;
}

/* ---- communities served ---- */
.communities { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
.communities__group { margin-bottom: 1.5rem; }
.communities__group:last-child { margin-bottom: 0; }
.communities__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.7rem;
}
.communities__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.communities__list li {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.92rem;
}
.communities__group--towns .communities__list li {
  background: var(--evergreen);
  color: #fff;
  border-color: var(--evergreen);
  font-weight: 500;
}

/* ---- community involvement ---- */
.community { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
.community p { max-width: 68ch; }
.community-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
  max-width: 640px;
}
.community-gallery figure {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.community-gallery img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.community-gallery figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--surface);
}

/* ---- IDX placeholder ---- */
.idx-placeholder {
  margin-top: 1rem;
  padding: 2.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 62ch;
}
.idx-placeholder__eyebrow {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.4rem;
}
.idx-placeholder h2 { font-size: 1.3rem; }

/* ---- about layout ---- */
.about-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.about-layout__photo {
  flex: 0 0 280px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.about-layout__photo img { width: 100%; display: block; }
.about-layout__body { flex: 1 1 420px; min-width: 0; }
.about-layout__title {
  color: var(--ink-muted);
  font-weight: 500;
  margin-top: -0.4em;
  margin-bottom: 1.4em;
}

/* ---- page feature image ---- */
.page-feature-image {
  margin: 1.25rem 0 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.page-feature-image img { width: 100%; display: block; }

/* ---- blog ---- */
.post-teaser { border-bottom: 1px solid var(--border); padding: 1.75rem 0; }
.post-teaser:last-child { border-bottom: none; }
.post-teaser__meta { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 0.3rem; }
article.single-post { max-width: 68ch; }
article.single-post h2 { margin-top: 1.6em; }

/* ---- forms ---- */
.contact-direct {
  font-size: 1.1rem;
  margin: 0.5rem 0 2rem;
}
.contact-direct a { font-weight: 600; }
.lead-form {
  display: grid;
  gap: 1rem;
  max-width: 480px;
}
.lead-form label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }
.lead-form input, .lead-form textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
}
.lead-form input:focus, .lead-form textarea:focus {
  outline: 2px solid var(--wheat);
  outline-offset: 1px;
}
.lead-form .honeypot { position: absolute; left: -9999px; }
.form-notice { padding: 0.9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.form-notice--success { background: #e4ede4; border: 1px solid var(--evergreen); }
.form-notice--error { background: #f5e4e0; border: 1px solid var(--rust); }

/* ---- footer ---- */
.site-footer {
  background: var(--evergreen-deep);
  color: #d9e3da;
  padding: 3rem 0 2rem;
  margin-top: 3.5rem;
  font-size: 0.92rem;
}
.site-footer a { color: #f0ead9; }
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.site-footer__brokerage {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: #b9c7bb;
}
/* Gap sized to comfortably clear CREA's Trademark Manual minimum-separation rule (at least
   half the logo's own size from any other logo/lettering) for the widest logo here. */
.site-footer__logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}
.site-footer__logos img {
  display: block;
  height: 40px;
  width: auto;
}
.site-footer__logo-card {
  display: inline-flex;
  align-items: center;
}

/* ---- 404 / utility ---- */
.error-404 { padding: 5rem 0; text-align: center; }

@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
