/* ---------------- HERO (image / video / placeholder) ---------------- */
.unit-hero {
  position: relative;
  width: 100%;
  height: 60vh;
  min-height: 420px;
  overflow: hidden;
  background-color: var(--brand-forest);
}
.unit-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.unit-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 30, 23, 0.35) 0%, rgba(10, 20, 15, 0.05) 30%, transparent 60%);
}
.unit-hero.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.unit-hero.is-placeholder .unit-hero-placeholder-label {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--brand-sage);
  font-size: 18px;
}

/* ---------------- HEADER BLOCK ---------------- */
.unit-header {
  padding: 32px 20px 48px;
}
.unit-header .breadcrumb {
  margin-bottom: 12px;
}
.unit-header-top {
  /* Previously took the price/CTA column out of flow (position:absolute)
     so the row's height — and so the gap before .unit-stats — was set by
     the short title alone, with price/CTA floating over top of it. That
     saved a bit of "dead air" under the title, but the floated column's
     real height (price + Book a Private Tour, sometimes + the MLS button
     too) regularly ran past the fixed margin that was standing in for it,
     letting .unit-stats' border-top line cut straight through the bottom
     button (Hayden's feedback, Aug 2026). A fixed margin big enough to
     never overlap then pushed .unit-stats down noticeably even on units
     with just one button (Hayden's follow-up feedback) — a guessed
     constant can't win both ways.
     Back to a plain flex row instead: the browser sizes the row to
     whichever column is actually taller (title or price/CTA) and no
     further, so the gap before .unit-stats is always exactly right —
     tight for a single button, a bit taller only on units that genuinely
     stack a second (MLS) button — with zero magic numbers to keep in
     sync as buttons get added or removed. */
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}
.unit-title {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 0.28em;
  color: var(--brand-forest);
}
.unit-price {
  font-size: 28px;
  font-weight: 600;
  color: var(--brand-forest);
}
.unit-header-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  flex-shrink: 0;
}
/* .unit-header-cta intentionally has no size overrides — it uses
   .btn-forest's default padding/font-size as-is, which already matches
   the hero's "Book a Private Tour" button (.btn-primary in home.css:
   same 16px/32px padding, 16px font, 30px radius). Was shrunk here at
   first, but per Hayden's feedback it should read as the same button. */

/* "View on MLS" — sits directly under "Book a Private Tour" (see
   .unit-header-price) only when this unit's MLS Listing URL is filled in
   on the Sheet (see units.mjs / mlsUrl). Deliberately the exact same
   padding/font-size/border-radius as .btn-forest so it reads as "the same
   size button" per Hayden's feedback, just outlined rather than filled so
   it doesn't compete with the primary Book-a-Tour CTA above it. */
.btn-forest-outline {
  display: inline-block;
  background: transparent;
  color: var(--brand-forest);
  border: 1px solid var(--brand-forest);
  padding: 16px 32px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.btn-forest-outline:hover {
  background: var(--brand-forest);
  color: #fff;
}
.unit-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  border-top: 1px solid var(--brand-sage-light);
  padding-top: 20px;
}
.unit-stat {
  display: flex;
  flex-direction: column;
}
.unit-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-forest);
}
.unit-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

/* ---------------- TWO-COLUMN CONTENT LAYOUT ---------------- */
/* Description / floor plan / Matterport / features on the left; the photo
   gallery as a right-hand rail — per Hayden's requested page structure.
   DOM order (main column, then gallery column) is what puts the gallery on
   the right in a plain grid, no explicit reordering needed. */
.unit-content-grid {
  display: grid;
  grid-template-columns: 1fr 620px;
  gap: 0 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  align-items: start;
}
.unit-content-main {
  min-width: 0;
}
.unit-content-gallery {
  position: sticky;
  top: 24px;
  padding: 48px 0;
}

/* ---------------- SHARED CONTENT SECTIONS ---------------- */
/* Tightened from 48px per Hayden's feedback — About This Home / Features &
   Finishes / Floor Plan (and Matterport/Video when present) were reading
   too far apart from each other in the main content column. */
.unit-section {
  padding: 28px 0;
  border-top: 1px solid var(--brand-sage-light);
}
.unit-content-main .unit-section:first-child {
  border-top: none;
}
.unit-section h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  color: var(--brand-forest);
  letter-spacing: 0.28em;
  margin-bottom: 18px;
}
.unit-section-inner {
  max-width: 1320px;
  margin: 0 auto;
}

/* Unit pages only (.unit-page, set on <main> in unit.mjs — register.mjs
   reuses .unit-section-inner and .unit-register for its own, differently-
   sized page and must NOT pick this up). Fixes a real misalignment Hayden
   spotted: .unit-header used the site-wide .container (1320px) while the
   two-column content grid below it (About This Home, Floor Plan, etc.)
   is 1400px — both centered, so on a normal desktop window the header
   sits ~40px to the right of the copy below it. Widening the header and
   the Related Homes / per-unit request-form sections to match 1400px
   gives the whole page one consistent left edge. (The About This
   Home/Floor Plan/Features sections' own .unit-section-inner already
   ends up narrower than 1400px regardless — they sit inside the
   .unit-content-grid's 1fr column, next to the 620px photo gallery — so
   this override is a no-op for them and only actually changes Related
   Homes and the request form, which sit outside that grid.) */
.unit-page .unit-header.container,
.unit-page .unit-section-inner {
  max-width: 1400px;
}

/* Sections outside the two-column grid (register, related) keep their own
   full-width padded band. */
.unit-register.unit-section,
.unit-related.unit-section {
  padding: 48px 20px;
}

/* ---------------- GALLERY (right rail) ---------------- */
/* 2 photos across, 5 rows (10 photos) before "See More" reveals the rest —
   per Hayden's request to cut down how far this page scrolls when a unit
   has a lot of photos. */
.unit-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
}
.gallery-thumb img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-fast, 0.2s) ease;
}
.gallery-thumb:hover img {
  transform: scale(1.03);
}
/* Kept in the DOM (not removed) so the lightbox's prev/next still cycles
   through every photo before "See More" is clicked — see unit.mjs.
   Toggled via a class on the grid itself (not per-thumb) so collapsing
   back with "See Less" is just as simple as expanding. */
.gallery-thumb--extra {
  display: none;
}
.unit-gallery-grid.is-expanded .gallery-thumb--extra {
  display: block;
}
.gallery-see-more {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border-radius: 30px;
  border: 1px solid var(--brand-forest);
  background: none;
  color: var(--brand-forest);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.gallery-see-more:hover {
  background: var(--brand-forest);
  color: #fff;
}
.gallery-see-more[hidden] {
  display: none;
}
.floorplan-thumb {
  cursor: zoom-in;
}
.floorplan-thumb img {
  height: auto;
}
.floorplan-download {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 26px;
  border-radius: 30px;
  border: 1px solid var(--brand-forest);
  color: var(--brand-forest);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast, 0.2s) var(--ease-standard, ease), color var(--duration-fast, 0.2s) var(--ease-standard, ease);
}
.floorplan-download:hover {
  background: var(--brand-forest);
  color: #fff;
}

/* ---------------- LIGHTBOX ---------------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 15, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-overlay[hidden] {
  display: none;
}
.lightbox-image {
  max-width: 88vw;
  max-height: 88vh;
  border-radius: 8px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}
.lightbox-prev {
  left: 20px;
}
.lightbox-next {
  right: 20px;
}

/* ---------------- DESCRIPTION ---------------- */
.unit-description p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-muted);
  max-width: 75ch;
}

/* ---------------- MEDIA EMBEDS (Matterport / video) ---------------- */
.media-embed {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}
.media-embed iframe,
.media-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------------- FEATURES ---------------- */
/* The Features/Finishes Notes cell is written as light markdown (###
   section headings, **bold** callouts, * bullets, --- dividers — see
   renderFeaturesMarkdown in unit.mjs) and rendered here as a 2-column
   flow so long lists of finishes don't run the page on forever. */
.unit-features-content {
  columns: 2;
  column-gap: 40px;
  max-width: 900px;
}
.unit-features-content h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-forest);
  margin: 22px 0 10px;
  break-inside: avoid;
  /* A heading is never worth leaving alone at the bottom of a column — if
     the next line can't fit too, push the heading itself to the next
     column instead of stranding it with nothing underneath. */
  break-after: avoid;
  break-after: avoid-column;
}
.unit-features-content h3:first-child {
  margin-top: 0;
}
/* The Features/Finishes Notes cell is written as 4 fixed sections in a
   fixed order (Interior Design & Everyday Comfort, Statement Kitchens,
   Premium Appliance Package, Spa-Inspired Bathrooms — confirmed identical
   structure across every unit). Left to auto-balance, the browser was
   splitting "Statement Kitchens" mid-list (its last item, Sink &
   Fixtures, landing at the top of column 2 instead of the Premium
   Appliance Package heading) to even out the two columns' heights. Hayden
   asked for the first two sections to always stay together in column 1
   and the second two to start fresh at the top of column 2, so force the
   break at that exact point instead of letting it balance freely. */
.unit-features-content h3:nth-of-type(3) {
  break-before: column;
  /* Starting a forced new column here means this heading is visually the
     "first" thing in column 2, same as h3:first-child is for column 1 —
     without this it keeps its normal 22px top margin and sits noticeably
     lower than "Interior Design & Everyday Comfort" opposite it. */
  margin-top: 0;
}
.unit-features-content hr {
  border: none;
  border-top: 1px solid var(--brand-sage-light);
  margin: 18px 0;
  break-inside: avoid;
  break-after: avoid;
  break-after: avoid-column;
}
.unit-features-content ul {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  /* Deliberately NOT break-inside: avoid — letting the list itself split
     between columns (each <li> already has its own break-inside: avoid)
     is what lets the two columns balance evenly instead of dumping an
     entire multi-item list into whichever column has room. */
}
.unit-features-content li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-muted);
  padding-left: 18px;
  position: relative;
  margin-bottom: 8px;
  break-inside: avoid;
}
.unit-features-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-accent);
}
.unit-features-content strong {
  color: var(--brand-forest);
  font-weight: 600;
}

/* ---------------- REGISTRATION FORM ---------------- */
.unit-register {
  background: var(--bg-light);
}
.register-form {
  max-width: 560px;
  display: grid;
  gap: 14px;
}
.register-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.register-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 4px;
}
.register-form input,
.register-form select,
.register-form textarea {
  width: 100%;
  border: 1px solid #d8dedb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font-body);
  background: #fff;
  color: inherit;
}
.register-form textarea {
  min-height: 90px;
  resize: vertical;
}
.register-form--general {
  max-width: 700px;
}
/* ---------------- LEAD-GATEWAY FORM (rcatalyst-forms.js) ----------------
   Same visual spec as .register-form above, under its own class name on
   purpose: the rcatalyst embed script owns this form via
   data-rcatalyst-form, and script.js's own submit listener matches forms
   by the literal class "register-form" to drive the old Salesforce
   Web-to-Lead flow (still used by the per-unit "Register Your Interest"
   forms). Keeping this form off the "register-form" class means it can
   never be caught by that listener, so the two systems can't collide. */
.lead-form {
  max-width: 700px;
  display: grid;
  gap: 14px;
}
.lead-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.lead-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 4px;
}
.lead-form input,
.lead-form select,
.lead-form textarea {
  width: 100%;
  border: 1px solid #d8dedb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font-body);
  background: #fff;
  color: inherit;
}
.lead-form textarea {
  min-height: 90px;
  resize: vertical;
}
.register-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.register-consent input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand-forest);
}
.register-consent-body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-muted);
}
.register-consent-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.register-consent-text.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.register-consent-text a {
  color: inherit;
}
.register-consent-toggle {
  display: inline-block;
  margin-top: 2px;
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-accent);
  cursor: pointer;
  text-decoration: underline;
}
.register-submit {
  background: var(--brand-forest);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  transition: background var(--duration-fast) ease;
}
.register-submit:hover {
  background: var(--brand-accent);
}
.register-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.register-status {
  font-size: 14px;
  color: var(--brand-accent);
  font-weight: 600;
}
.register-status[hidden] {
  display: none;
}

/* ---------------- RELATED UNITS ---------------- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  /* Title-then-price-CTA side-by-side (see .unit-header-top above) gets
     cramped once the container itself is under ~1024px — stack the two
     columns instead. */
  .unit-header-top {
    flex-direction: column;
    gap: 16px;
  }
  .unit-header-price {
    align-items: flex-start;
  }
  .unit-content-grid {
    grid-template-columns: 1fr;
  }
  .unit-content-gallery {
    position: static;
    padding: 0 0 24px;
    order: -1;
  }
  .unit-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .unit-title {
    font-size: 28px;
  }
  .register-form .form-row {
    grid-template-columns: 1fr;
  }
  .lead-form .form-row {
    grid-template-columns: 1fr;
  }
  .unit-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .unit-features-content {
    columns: 1;
  }
  .lightbox-nav {
    width: 42px;
    height: 42px;
    font-size: 26px;
  }
}
