/* ============ Buy page ============ */

.buy-page {
  background: #ffffff;
}

/* Category section.
   The navbar is the homepage's floating (position:absolute) pill, so the content
   needs a top offset to clear it. The navbar occupies ~134px at desktop and less
   at smaller breakpoints (see the responsive overrides at the bottom of this file
   matching styles.css's navbar breakpoints). */
.buy-categories {
  background: #ffffff;
  padding-top: 210px;
  padding-bottom: clamp(46px, 6vw, 80px);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(26px, 3vw, 48px);
  align-items: stretch;
}

/* Same card/grid system as the 3-tile Buy page, just 4 columns wide at
   desktop — used by the Leasing landing page (Offices/Retail/Industrial/
   Land). Everything else (card design, motion, responsive collapse to 2
   then 1 columns below) is shared, unchanged. */
.category-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.category-card {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.category-image {
  display: block;
  width: 100%;
  aspect-ratio: 0.72 / 1;
  overflow: hidden;
  background: #d7dcdd;
}

.category-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 520ms ease;
}

.category-card:hover .category-image img,
.category-card:focus-within .category-image img {
  transform: scale(1.05);
}

/* Heading matches the homepage section heading (.section-copy h2) exactly:
   Cormorant Garamond, clamp(27px, 1.88vw, 45px), 600, uppercase, line-height 0.98. */
.category-card h2 {
  margin: clamp(16px, 1.6vw, 24px) 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(27px, 1.88vw, 45px);
  line-height: 0.98;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--ink);
}

/* Body text matches the homepage body font size (--section-copy-size = 15.3px). */
.category-card p {
  margin: 0 0 clamp(16px, 1.6vw, 22px);
  font-size: var(--section-copy-size);
  line-height: 1.5;
  font-weight: 400;
  color: #58666b;
}

/* Reuses the standard .pill-button (same 12px/700 text, 42px min-height, 13/26
   padding, 999px radius) — only stretched to the card width. */
.category-button {
  width: 100%;
  min-width: 0;
  margin-top: auto;
}

/* ===== Homepage-style scroll reveal for the category cards ===== */
/* Container stays visible; the cards float + fade in with a stagger, using the
   homepage motion-floatIn keyframe and easing (from styles.css). */
.category-grid.reveal,
.category-grid.reveal.is-visible {
  opacity: 1;
  transform: none;
  animation: none;
}

.category-grid.reveal .category-card {
  --motion-translate-x: 0px;
  --motion-translate-y: 44px;
  --cat-delay: 0s;
  opacity: 0;
  transform: none;
  backface-visibility: hidden;
}

.category-grid.reveal .category-card:nth-child(2) { --cat-delay: 0.09s; }
.category-grid.reveal .category-card:nth-child(3) { --cat-delay: 0.18s; }
.category-grid.reveal .category-card:nth-child(4) { --cat-delay: 0.27s; }

.category-grid.reveal .category-card.motion-item-visible {
  opacity: 1;
  transform: none;
  animation: motion-floatIn 1.1s cubic-bezier(0.445, 0.05, 0.55, 0.95)
    calc(var(--cat-delay, 0s) + 0.001s) backwards;
}

/* Fail-safe: if motion is disabled (reduced-motion / no IntersectionObserver),
   never leave a card hidden. */
html:not(.motion-ready) .category-grid.reveal .category-card {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* Top offset clears the navbar (occupied height per styles.css: 134/100/90/80)
   plus a comfortable gap so the cards sit well below the floating navbar.
   Ordered descending so the smallest matching breakpoint wins. */
@media (max-width: 1280px) {
  .buy-categories { padding-top: 170px; }
}

@media (max-width: 1024px) {
  .buy-categories { padding-top: 158px; }
}

@media (max-width: 900px) {
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px 24px;
  }
}

@media (max-width: 760px) {
  .buy-categories { padding-top: 130px; }
}

@media (max-width: 540px) {
  .category-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin-inline: auto;
  }
}
