/* ==========================================================================
   Housing — the landing-page scroller and the project detail page
   ========================================================================== */

/* --------------------------------------------------------------------------
   Landing page: the section header
   -------------------------------------------------------------------------- */

.housing__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.housing__heading {
  max-width: 42rem;
}

.housing__title {
  margin-top: var(--space-xs);
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  font-weight: var(--fw-bold);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--clr-ink);
}

.housing__intro {
  margin-top: var(--space-md);
  color: var(--clr-muted);
  line-height: 1.65;
}

.housing__nav {
  display: flex;
  gap: var(--space-xs);
  flex: none;
}

.housing__arrow {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(16, 33, 24, 0.14);
  border-radius: 50%;
  background: transparent;
  color: var(--clr-ink);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.housing__arrow svg {
  width: 1.125rem;
  height: 1.125rem;
}

.housing__arrow:hover {
  background: var(--clr-ink);
  border-color: var(--clr-ink);
  color: var(--clr-white);
}

/* The rail cannot scroll further that way — say so rather than leaving a
   button that looks live and does nothing. */
.housing__arrow[disabled] {
  opacity: 0.35;
  cursor: default;
}

.housing__arrow[disabled]:hover {
  background: transparent;
  border-color: rgba(16, 33, 24, 0.14);
  color: var(--clr-ink);
}

/* --------------------------------------------------------------------------
   Landing page: the rail

   Scroll-snap does the work. The arrows only nudge scrollLeft, so with no
   JavaScript the rail still scrolls by touch, trackpad, or keyboard.
   -------------------------------------------------------------------------- */

.housing__rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(19rem, 22rem);
  gap: var(--space-lg);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding-left: var(--space-2xs);

  /* Room for the cards' hover lift and shadow, which would otherwise be
     clipped by the scroll container. */
  padding: var(--space-2xs) var(--space-2xs) var(--space-lg);
  margin: calc(var(--space-2xs) * -1);

  scrollbar-width: thin;
  scrollbar-color: rgba(16, 33, 24, 0.25) transparent;
}

.housing__rail:focus-visible {
  outline: 2px solid var(--clr-ink);
  outline-offset: 4px;
  border-radius: var(--radius-lg, 0.75rem);
}

.housing__rail::-webkit-scrollbar {
  height: 6px;
}

.housing__rail::-webkit-scrollbar-thumb {
  background: rgba(16, 33, 24, 0.22);
  border-radius: 99px;
}

.housing__hint {
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--clr-muted);
}

/* --------------------------------------------------------------------------
   Landing page: a card
   -------------------------------------------------------------------------- */

.hcard {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(16, 33, 24, 0.1);
  border-radius: 1rem;
  background: var(--clr-white);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

.hcard:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 33, 24, 0.18);
  box-shadow: 0 18px 40px -22px rgba(16, 33, 24, 0.45);
}

.hcard__media {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: rgba(16, 33, 24, 0.06);
}

.hcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hcard:hover .hcard__media img {
  transform: scale(1.04);
}

.hcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-xs);
  padding: var(--space-lg);
}

.hcard__where {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--clr-muted);
}

.hcard__where svg {
  width: 0.875rem;
  height: 0.875rem;
  flex: none;
}

.hcard__title {
  font-size: 1.125rem;
  font-weight: var(--fw-bold);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--clr-ink);
}

.hcard__text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--clr-muted);
}

.hcard__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(16, 33, 24, 0.08);
}

.hcard__price {
  display: flex;
  flex-direction: column;
  font-size: 1.0625rem;
  font-weight: var(--fw-bold);
  color: var(--clr-ink);
  font-variant-numeric: tabular-nums;
}

.hcard__price small {
  font-size: 0.6875rem;
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-muted);
}

.hcard__go {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 50%;
  background: rgba(16, 33, 24, 0.06);
  color: var(--clr-ink);
  transition:
    background 0.25s ease,
    color 0.25s ease;
}

.hcard__go svg {
  width: 0.9375rem;
  height: 0.9375rem;
}

.hcard:hover .hcard__go {
  background: var(--clr-ink);
  color: var(--clr-white);
}

/* --------------------------------------------------------------------------
   Status pill — shared by the card and the detail hero
   -------------------------------------------------------------------------- */

.hstatus {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hcard__media .hstatus {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  backdrop-filter: blur(6px);
}

/* Open for subscription */
.hstatus--selling {
  background: rgba(23, 122, 63, 0.92);
  color: #fff;
}

/* Being built — subscriptions taken, handover later */
.hstatus--under {
  background: rgba(196, 122, 12, 0.92);
  color: #fff;
}

/* Nothing left to allocate */
.hstatus--fully {
  background: rgba(16, 33, 24, 0.82);
  color: #fff;
}

/* Not yet open */
.hstatus--coming {
  background: rgba(41, 87, 168, 0.92);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Detail page: hero
   -------------------------------------------------------------------------- */

.hproj__hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(20rem, 42vw, 30rem);
  overflow: hidden;
  background: var(--clr-ink);
}

.hproj__hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

/* Keeps the title legible over any photograph, however light. */
.hproj__hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(9, 20, 14, 0.92) 0%,
    rgba(9, 20, 14, 0.55) 45%,
    rgba(9, 20, 14, 0.25) 100%
  );
}

.hproj__hero-inner {
  position: relative;
  z-index: 1;
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-2xl);
  color: var(--clr-white);
}

.hproj__title {
  margin-top: var(--space-sm);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: var(--fw-bold);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: inherit;
}

.hproj__where {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  margin-top: var(--space-sm);
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.82);
}

.hproj__where svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

/* --------------------------------------------------------------------------
   Detail page: body
   -------------------------------------------------------------------------- */

.hproj__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: var(--space-3xl);
  align-items: start;
}

.hproj__intro {
  margin-top: var(--space-sm);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--clr-muted);
}

.hproj__h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  color: var(--clr-ink);
}

.hproj__features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm) var(--space-lg);
}

.hproj__features li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--clr-ink);
}

.hproj__features svg {
  width: 1rem;
  height: 1rem;
  flex: none;
  margin-top: 0.1875rem;
  color: #177a3f;
}

.hproj__plans {
  display: grid;
  gap: var(--space-sm);
}

.hproj__plans li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem var(--space-sm);
  padding: var(--space-md);
  border: 1px solid rgba(16, 33, 24, 0.1);
  border-radius: 0.625rem;
}

.hproj__plans strong {
  font-size: 0.9375rem;
  font-weight: var(--fw-bold);
  color: var(--clr-ink);
}

.hproj__plans span {
  font-size: 0.875rem;
  color: var(--clr-muted);
}

/* --------------------------------------------------------------------------
   Detail page: the rail
   -------------------------------------------------------------------------- */

.hproj__card {
  position: sticky;
  top: var(--space-xl);
  padding: var(--space-xl);
  border: 1px solid rgba(16, 33, 24, 0.12);
  border-radius: 1rem;
  background: var(--clr-white);
  box-shadow: 0 20px 45px -32px rgba(16, 33, 24, 0.55);
}

.hproj__price-label {
  font-size: 0.6875rem;
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-muted);
}

.hproj__price {
  margin-top: 0.25rem;
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  color: var(--clr-ink);
  font-variant-numeric: tabular-nums;
}

.hproj__facts {
  margin: var(--space-lg) 0;
  border-top: 1px solid rgba(16, 33, 24, 0.1);
}

.hproj__facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(16, 33, 24, 0.08);
}

.hproj__facts dt {
  font-size: 0.8125rem;
  color: var(--clr-muted);
  flex: none;
}

.hproj__facts dd {
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  color: var(--clr-ink);
  text-align: right;
}

.hproj__cta {
  width: 100%;
  justify-content: center;
  margin-top: var(--space-sm);
}

.hproj__note {
  margin-top: var(--space-md);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--clr-muted);
}

/* --------------------------------------------------------------------------
   Detail page: the other projects
   -------------------------------------------------------------------------- */

.hstrip__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-md);
}

.hstrip__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs);
  padding-right: var(--space-md);
  border: 1px solid rgba(16, 33, 24, 0.1);
  border-radius: 0.75rem;
  background: var(--clr-white);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.hstrip__item:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 33, 24, 0.22);
}

.hstrip__item img {
  width: 4rem;
  height: 3.25rem;
  flex: none;
  object-fit: cover;
  border-radius: 0.5rem;
}

.hstrip__item span {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.hstrip__item strong {
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  color: var(--clr-ink);
  line-height: 1.3;
}

.hstrip__item small {
  font-size: 0.75rem;
  color: var(--clr-muted);
}

.hproj__missing {
  text-align: center;
}

.hproj__missing .hproj__title {
  color: var(--clr-ink);
}

.hproj__missing .hproj__intro {
  margin-inline: auto;
  margin-bottom: var(--space-lg);
  max-width: 34rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 64rem) {
  .hproj__grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  /* Sticky is a desktop affordance — in one column it would follow the
     member down the page over the content they are trying to read. */
  .hproj__card {
    position: static;
  }
}

@media (max-width: 48rem) {
  .housing__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-lg);
  }

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

@media (max-width: 40rem) {
  .housing__rail {
    grid-auto-columns: minmax(15rem, 78vw);
  }
}

/* A member who has asked for less motion gets no smooth scroll and no lift. */
@media (prefers-reduced-motion: reduce) {
  .housing__rail {
    scroll-behavior: auto;
  }

  .hcard,
  .hcard__media img,
  .hstrip__item {
    transition: none;
  }

  .hcard:hover {
    transform: none;
  }

  .hcard:hover .hcard__media img {
    transform: none;
  }
}
