/**
 * FoodHub247 hero carousel — 4 slides, alternating brand-color panels with
 * a diagonal/curved image edge. Uses the site's own CSS variables/typography
 * so it stays in sync with theme.css automatically.
 */

.hero-carousel {
  position: relative;
  padding: var(--gap) var(--page-padding) 0;
  max-width: var(--container-max);
  margin: 0 auto;
}

.hero-carousel__viewport {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.hero-carousel__track {
  display: flex;
  transition: transform 0.5s var(--ease-out);
}

.hero-slide {
  flex: 0 0 100%;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  overflow: hidden;
}

.hero-slide__media {
  order: -1;
  position: relative;
  height: 230px;
  clip-path: var(--hero-clip-mobile);
}

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

.hero-slide__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px 64px 34px;
}

.hero-slide__eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-slide__title {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-slide__desc {
  margin: 0 0 8px;
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0.9;
}

.hero-slide__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--duration) var(--ease-out);
}

.hero-slide__cta:hover {
  transform: translateY(-2px);
}

/* Slide 1 — deep primary, forward slant */
.hero-slide--1 {
  background: var(--primary-dark);
  color: var(--white);
  --hero-clip-mobile: polygon(0 0, 100% 0, 100% 100%, 0 82%);
  --hero-clip-desktop: polygon(14% 0, 100% 0, 100% 100%, 0 100%);
}
.hero-slide--1 .hero-slide__eyebrow { color: var(--accent); }
.hero-slide--1 .hero-slide__desc { color: rgba(255, 255, 255, 0.82); }
.hero-slide--1 .hero-slide__cta { background: var(--accent); color: var(--white); }

/* Slide 2 — soft cream, half-circle forward "(" — tall bite curving in at the divide */
.hero-slide--2 {
  background: var(--bg-soft);
  color: var(--text);
  --hero-clip-mobile: ellipse(120% 90% at 50% 0%);
  --hero-clip-desktop: ellipse(90% 120% at 100% 50%);
}
.hero-slide--2 .hero-slide__eyebrow { color: var(--accent); }
.hero-slide--2 .hero-slide__desc { color: var(--text-muted); }
.hero-slide--2 .hero-slide__cta { background: var(--primary); color: var(--white); }

/* Slide 3 — accent (warm), backward slant "\" — mirrors slide 1: full-height sweep right at the divide, not pinched into the far edge */
.hero-slide--3 {
  background: var(--accent);
  color: var(--white);
  --hero-clip-mobile: polygon(0 0, 100% 0, 100% 82%, 0 100%);
  --hero-clip-desktop: polygon(0 0, 100% 0, 100% 100%, 14% 100%);
}
.hero-slide--3 .hero-slide__eyebrow { color: var(--white); }
.hero-slide--3 .hero-slide__desc { color: rgba(255, 255, 255, 0.88); }
.hero-slide--3 .hero-slide__cta { background: var(--white); color: var(--accent-hover); }

/* Soft, gently animated blend where the accent panel meets the image, instead of a hard cut */
.hero-slide--3 .hero-slide__media::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, var(--accent) 0%, rgba(165, 74, 46, 0.55) 20%, transparent 50%);
  background-size: 140% 140%;
  animation: hero-blend-pulse 6s ease-in-out infinite;
}

@keyframes hero-blend-pulse {
  0%, 100% { opacity: 0.9; background-position: 50% 100%; }
  50% { opacity: 0.55; background-position: 50% 65%; }
}

/* Slide 4 — primary green, half-circle backward ")" — same divide anchor as slide 3, reversed (wide/flat) proportions */
.hero-slide--4 {
  background: var(--primary);
  color: var(--white);
  --hero-clip-mobile: ellipse(90% 120% at 50% 0%);
  --hero-clip-desktop: ellipse(120% 90% at 100% 50%);
}
.hero-slide--4 .hero-slide__eyebrow { color: var(--accent); }
.hero-slide--4 .hero-slide__desc { color: rgba(255, 255, 255, 0.82); }
.hero-slide--4 .hero-slide__cta { background: var(--white); color: var(--primary); }

/* Two-tone blend (primary into accent) where the panel meets the image — richer, not animated */
.hero-slide--4 .hero-slide__media::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--primary) 0%, rgba(45, 68, 34, 0.5) 16%, transparent 42%),
    linear-gradient(to top, transparent 30%, rgba(165, 74, 46, 0.35) 40%, transparent 55%);
}

/* Controls — arrows sit outside the card in the gutter (clear of text/image), dots float on the card */
.hero-carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}
.hero-carousel__arrow:hover {
  background: var(--bg-soft);
  border-color: var(--border-dark);
}
.hero-carousel__arrow--prev { left: calc(var(--page-padding) - 17px); }
.hero-carousel__arrow--next { right: calc(var(--page-padding) - 17px); }

.hero-carousel__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-carousel__dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(2px);
}

.hero-carousel__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: width var(--duration) var(--ease-out), background var(--duration) var(--ease-out);
}
.hero-carousel__dot.is-active {
  width: 20px;
  background: var(--white);
}

@media (min-width: 768px) {
  .hero-slide { flex-direction: row; min-height: 340px; }
  .hero-slide__media { order: 0; flex: 1; height: auto; clip-path: var(--hero-clip-desktop); }
  .hero-slide__text { max-width: calc(48% - 30px); padding: 40px 28px 40px 48px; }
  .hero-slide__cta { align-self: flex-start; }
  .hero-carousel__arrow { width: 44px; height: 44px; }
  .hero-carousel__arrow--prev { left: calc(var(--page-padding) - 22px); }
  .hero-carousel__arrow--next { right: calc(var(--page-padding) - 22px); }

  /* Divide is on the left at this breakpoint (text left, image right) — blend from that edge instead of the bottom */
  .hero-slide--3 .hero-slide__media::before {
    background: linear-gradient(to right, var(--accent) 0%, rgba(165, 74, 46, 0.55) 16%, transparent 42%);
  }
  .hero-slide--4 .hero-slide__media::before {
    background:
      linear-gradient(to right, var(--primary) 0%, rgba(45, 68, 34, 0.5) 14%, transparent 38%),
      linear-gradient(to right, transparent 26%, rgba(165, 74, 46, 0.35) 36%, transparent 50%);
  }
}

@media (min-width: 992px) {
  .hero-slide { min-height: 420px; }
  .hero-slide__title { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
  .hero-slide__desc { font-size: 1rem; }
}
