/* ============================================================
   COMPONENTS — Buttons, cards, forms
   ============================================================ */

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.btn--red {
  background-color: var(--color-red-cta);
  color: var(--color-white);
  padding: 16px 32px;
  border: 4px solid var(--color-red-cta);
}

.btn--red:hover {
  background-color: var(--color-red);
  border-color: var(--color-red);
  text-decoration: none;
}

.btn--outline-red {
  background-color: transparent;
  color: var(--color-red-cta);
  padding: 14px 12px;
  border: 4px solid var(--color-red-cta);
}

.btn--outline-red:hover {
  background-color: var(--color-red-cta);
  color: var(--color-white);
  text-decoration: none;
}

.btn--send {
  background-color: transparent;
  color: var(--color-text-gray);
  font-weight: 700;
  padding: 16px 18px;
  border: 2px solid var(--color-text-gray);
  min-width: 216px;
  height: 62px;
}

.btn--send:hover {
  background-color: var(--color-text-gray);
  color: var(--color-white);
  text-decoration: none;
}

/* ============================================================
   LISTING CARD (grid pages)
   ============================================================ */
.listing-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--color-white);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.listing-card:hover {
  text-decoration: none;
}


.listing-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--color-bg-light);
  position: relative;
  overflow: hidden;
}

.listing-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-card__body {
  padding: var(--space-md) 0 var(--space-md);
}

.listing-card__address {
  font-size: var(--text-card);
  font-weight: 400;
  color: var(--color-white);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-card__neighborhood {
  font-size: var(--text-card);
  font-weight: 400;
  font-style: italic;
  color: var(--color-white);
  line-height: 1.2;
  margin-top: 4px;
}

.listing-card__price {
  font-size: var(--text-card);
  font-weight: 900;
  color: var(--color-white);
  margin-top: var(--space-sm);
}

/* ============================================================
   HERO CARD (listing carousel inside hero)
   Figma design: square photo + red band below with white text.
   Cards are fluid — 4 equal columns filling the full carousel width.
   ============================================================ */
.hero-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hero-card:hover {
  text-decoration: none;
}

.hero-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.hero-card__image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-card__body {
  background-color: var(--color-red);
  padding: 10px 32px 14px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.hero-card__address {
  font-size: var(--text-card);
  font-weight: 400;
  color: var(--color-white);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-card__neighborhood {
  font-size: var(--text-card);
  font-weight: 400;
  font-style: italic;
  color: var(--color-white);
  line-height: 1.2;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-card__price {
  font-size: var(--text-card);
  font-weight: 900;
  color: var(--color-white);
  margin-top: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   FORM COMPONENTS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-xl);
}

.form-grid--full {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-family: var(--font-primary);
  font-size: var(--text-footer);
  font-weight: 400;
  color: var(--color-text-dark);
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
  font-family: var(--font-primary);
  font-size: var(--text-footer);
  font-weight: 400;
  color: var(--color-text-dark);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-text-gray);
  padding: 15px 19px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-bottom-color: var(--color-text-dark);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-gray);
}

.form-textarea {
  resize: vertical;
  min-height: 159px;
}

.form-select-wrap {
  position: relative;
}

.form-select-wrap::after {
  content: '';
  position: absolute;
  right: 19px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-dark);
  border-bottom: 2px solid var(--color-text-dark);
  pointer-events: none;
}

.form-select {
  cursor: pointer;
}

/* ============================================================
   BUILDING CARD
   ============================================================ */
.building-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.building-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--color-bg-light);
}

.building-card__body {
  padding: var(--space-sm) 0;
}

.building-card__name {
  font-size: 18px;
  font-weight: 300;
  color: var(--color-text-dark);
  text-transform: uppercase;
}

.building-card__address {
  font-size: var(--text-footer);
  color: var(--color-text-gray);
  margin-top: 4px;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  width: 272px;
  height: 1px;
  background-color: var(--color-red);
  margin-inline: auto;
}

/* ============================================================
   SECTION HEADING
   ============================================================ */
.section-heading {
  font-size: var(--text-heading);
  font-weight: 300;
  line-height: 1.1;
  text-transform: uppercase;
  margin-top: var(--heading-optical-trim);
}

.section-heading--red {
  color: var(--color-red);
  text-align: center;
}

.section-subheading {
  font-size: var(--text-sub);
  font-weight: 300;
  color: var(--color-text-dark);
  text-align: center;
  line-height: 1.5;
}

/* ============================================================
   LIGHTBOX — full-page photo gallery overlay
   Generic component, reusable on any page with a photo gallery.
   Markup contract:
     <div class="lightbox" id="<id>" data-lightbox-id="<group>" ...>
       .lightbox__bar > .lightbox__counter (with __current/__total spans), .lightbox__close
       .lightbox__stage > .lightbox__nav--prev, .lightbox__image, .lightbox__nav--next
   Trigger contract:
     - Wrap a gallery's <img> elements in [data-lightbox-gallery="<group>"]
     - Any element with [data-lightbox-open="<group>"] opens the gallery at photo 1
   Figma: node 17:14178 (page 4)
   ============================================================ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  flex-direction: column;
  background-color: var(--color-white);
}

.lightbox.is-open {
  display: flex;
}

.lightbox__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: var(--space-lg) var(--space-2xl);
}

.lightbox__counter {
  font-size: var(--text-sub);
  font-weight: 400;
  color: var(--color-text-dark);
}

.lightbox__close {
  position: absolute;
  right: var(--space-lg);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--color-text-dark);
  cursor: pointer;
}

.lightbox__close svg {
  width: 100%;
  height: 100%;
}

.lightbox__stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 var(--space-2xl);
}

.lightbox__image {
  max-width: 1098px;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Nav buttons — same sizing/shape as the home page hero carousel arrows,
   but lightbox-only colors (does not affect .hero__arrow) */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: var(--color-bg-light);
  color: var(--color-text-med);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox__nav:hover {
  background-color: var(--color-text-gray);
}

.lightbox__nav svg {
  display: block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.lightbox__nav--prev {
  left: var(--space-lg);
}

.lightbox__nav--next {
  right: var(--space-lg);
}

/* ============================================================
   RESPONSIVE — Components
   ============================================================ */

/* ≤1024px — tablet: 2-card scroll-snap carousel */
@media (max-width: 1024px) {
  /* 769–1024px: 2 cards, gap 16px, inset 46px each side
     card = (100vw − 92px − 16px) / 2 = 50vw − 54px */
  .hero-card {
    flex: 0 0 calc(50vw - 54px);
    scroll-snap-align: start;
  }

  .hero__cards {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .hero__cards::-webkit-scrollbar {
    display: none;
  }
}

/* ≤768px — mobile: form layout + tighten card body */
@media (max-width: 768px) {
  /* 481–768px: 2 cards, gap 16px, carousel inset 24px each side (48px total)
     card = (100vw − 48px − 16px) / 2 = 50vw − 32px */
  .hero-card {
    flex: 0 0 calc(50vw - 32px);
  }

  .hero-card__body {
    padding: 10px 16px 14px;
  }

  .hero-card__neighborhood,
  .hero-card__price {
    margin-top: 4px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .lightbox__bar {
    padding: var(--space-md) var(--space-xl);
  }

  .lightbox__counter {
    font-size: var(--text-nav);
  }

  .lightbox__stage {
    padding: 0 var(--space-md);
  }

  .lightbox__close {
    right: var(--space-md);
    width: 18px;
    height: 18px;
  }

  /* Nav buttons straddle the image edge — center of the 48px circle
     sits exactly on the image's edge (inset 0 + half of 48px = 24px
     = the stage padding above), matching .hero__arrow's behavior. */
  .lightbox__nav {
    width: 48px;
    height: 48px;
  }

  .lightbox__nav svg {
    width: 26px;
    height: 26px;
  }

  .lightbox__nav--prev {
    left: 0;
  }

  .lightbox__nav--next {
    right: 0;
  }
}

/* ≤767px — phones: 1 card, gap 0, carousel inset 24px each side (48px total)
   card = 100vw − 48px */
@media (max-width: 767px) {
  .hero-card {
    flex: 0 0 calc(100vw - 48px);
  }

  .hero__cards {
    gap: 0;
  }
}

/* ≤375px — small phone: tightest card body; inset shrinks to 16px each side (32px total)
   card = 100vw − 32px */
@media (max-width: 375px) {
  .hero-card {
    flex: 0 0 calc(100vw - 32px);
  }

  .hero-card__body {
    padding: 8px 12px 10px;
  }

  .btn {
    font-size: 16px;
    padding: 12px 20px;
  }

  .lightbox__bar {
    padding: var(--space-sm) var(--space-lg);
  }

  .lightbox__close {
    width: 14px;
    height: 14px;
  }

  /* Nav size/position inherited from the ≤768px rule above — same
     stage padding (var(--space-md)) applies here, so changing the
     button size without recomputing padding would reintroduce
     overlap or a gap. Keep them in lockstep. */
}
