/* Peek carousel, from the Figma hero carousel: an 880px active slide centred in a full-bleed viewport with its
   neighbours peeking at the edges and clipped shorter (Figma 438 vs 510px). The track position comes from --idx, set
   inline from state. Shared by the hero and the Life at Dicoding rows; each adds its own label, caption and header. */

.lp-carousel {
  /* 36px each side on mobile: the page padding (20px) plus a section inset (16px), so text over and under the slide
     lines up with the rest of the page instead of touching the rail. */
  --slide-w: min(55rem, calc(100vw - 4.5rem));
  --slide-gap: 1rem;

  position: relative;
}

.lp-carousel__viewport {
  overflow: hidden;
}

.lp-carousel__track {
  display: flex;
  gap: var(--slide-gap);
  margin-left: 50%;
  /* Written without a negated bracket: Chromium drops the minus inside "- 1 * (w + gap)", which put slide 2 off by
     two gaps. This form is exact for every index. */
  transform: translateX(calc(var(--slide-w) * (-0.5 - var(--idx, 0)) - var(--idx, 0) * var(--slide-gap)));
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lp-carousel__slide {
  display: flex;
  flex: 0 0 var(--slide-w);
  flex-direction: column;
  gap: 1.375rem;
}

.lp-carousel__image {
  aspect-ratio: 88 / 51;
  overflow: hidden;
  border-radius: var(--radius-ui-2xl);
  background: var(--lp-ui-bg-secondary);
  clip-path: inset(7% 0 round var(--radius-ui-2xl));
  transition: clip-path 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lp-carousel__slide.is-active .lp-carousel__image {
  clip-path: inset(0 round var(--radius-ui-2xl));
}

.lp-carousel__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lp-carousel__controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

.lp-carousel__count {
  margin-right: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--lp-ui-text-primary);
}

.lp-carousel__arrow {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--lp-ui-border-primary);
  border-radius: var(--radius-md);
  background: var(--lp-ui-bg-primary);
  color: var(--lp-ui-text-secondary);
  box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.lp-carousel__arrow:hover {
  background: var(--muted);
}

.lp-carousel__arrow:disabled {
  opacity: 0.4;
  cursor: default;
  background: var(--lp-ui-bg-primary);
}

.lp-carousel__arrow:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--ring) 50%, transparent);
  outline-offset: 2px;
}

.lp-carousel__arrow svg {
  width: 1.25rem;
  height: 1.25rem;
}

@media (min-width: 48rem) {
  .lp-carousel { --slide-w: min(55rem, calc(100vw - 8rem)); --slide-gap: 2rem; }
}

@media (min-width: 64rem) {
  .lp-carousel { --slide-gap: 5.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lp-carousel__track,
  .lp-carousel__image { transition: none; }
}
