/* ─── Hero ───────────────────────────────────────────────── */
/*
  Fluid height via clamp(): min 200px (small mobile) → scales at 40vw
  → caps at 480px (wide desktop). Never dominates the viewport.
*/
.hero {
  height: clamp(200px, 40vw, 480px);
  overflow: hidden;
  background: var(--color-surface);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ─── Posts section ───────────────────────────────────── */
.posts {
  padding-block: var(--space-xl);
}

.posts__heading {
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--step-2);
  font-weight: 700;
  margin-block-end: var(--space-xl);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stack spacing between category sections */
.category-section + .category-section {
  margin-block-start: var(--space-2xl);
}

.category-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: var(--space-m);
}

.category-section__title {
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--step-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Carousel arrows (desktop only) ─────────────────────── */
.carousel-arrows {
  display: none;
  gap: var(--space-xs);
}

.carousel-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.carousel-arrow:hover {
  background: var(--color-surface-hover);
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ─── Carousel wrapper (holds Reel + fade overlay) ───────── */
.carousel-wrapper {
  position: relative;
}

/*
  Right-edge fade gradient: signals more content beyond the visible area.
  pointer-events: none so clicks pass through to cards beneath.
  Hidden via .carousel-wrapper--end when the reel is fully scrolled to the end.
*/
.carousel-wrapper::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 5rem;
  background: linear-gradient(to right, transparent, var(--color-bg));
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease;
}

.carousel-wrapper--end::after {
  opacity: 0;
}

/* ─── The Reel ────────────────────────────────────────────── */
/*
  Core of the Reel primitive from Every Layout:
  display:flex + overflow-x:auto = native horizontal scroll, no JS required.
  Scrollbar hidden because peek + fade already signal scrollability.
*/
.reel {
  display: flex;
  overflow-x: auto;
  gap: var(--space-m);
  scrollbar-width: none;
  /* Snap cards to the left edge after scrolling stops */
  scroll-snap-type: x mandatory;
}

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

/*
  Mobile: each card is 80% wide → 1 full card visible + 20% peek of the next.
  flex: 0 0 80% (grow:0, shrink:0, basis:80%) pins every card to exactly 80% —
  more reliable than min-width alone, which lets the flex algorithm vary sizes
  based on content and causes images to appear at different sizes.
*/
.reel > * {
  flex: 0 0 80%;
  scroll-snap-align: start;
}

/* ─── View all link ───────────────────────────────────────── */
.view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  width: fit-content;
  margin: var(--space-l) auto 0;
  padding: var(--space-s) var(--space-l);
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text-muted);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.view-all:hover {
  background: var(--color-accent);
  color: var(--color-text-on-accent-fill);
  border-color: var(--color-accent);
}

.view-all__arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.view-all:hover .view-all__arrow {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .view-all:hover .view-all__arrow {
    transform: none;
  }
}

/* ─── Responsive ─────────────────────────────────────────── */

/*
  36rem (576px): tablet portrait and large phones.
  Switch to 2-card carousel layout. The card width halves but the user
  now sees 2 cards — the layout change explains the size change.
*/
@media (min-width: 36rem) {
  .reel > * {
    flex: 0 0 46%;
  }
}

/*
  48rem (768px): carousel arrows appear — swipe is less expected on
  pointer devices.
*/
@media (min-width: 48rem) {
  .carousel-arrows {
    display: flex;
  }
}

/*
  64rem (1024px): desktop. Switch to 3-card carousel layout.
  Separating this from the nav breakpoint keeps nav and carousel
  concerns independent.
*/
@media (min-width: 64rem) {
  .reel > * {
    flex: 0 0 30%;
  }
}
