/*
 * Engineering Edge — homepage carousel (first-party replacement for Elfsight).
 *
 * Look mirrors the retired Elfsight slide: a per-slide gradient/colour band, a
 * type badge, bold title, short (line-clamped) teaser, a "More" button, a figure
 * on the right, and dot indicators. Each slide carries its own `background`,
 * cross-faded on change (two stacked layers). White text is protected by a scrim
 * + text-shadow so a light palette entry can't wash out the title.
 *
 * ee theme tokens (kept in sync with static/ka/ka.css / the spec).
 */
@import url("../shared/tokens.css");
.ee-carousel {
  position: relative;
  /* square band, edge-to-edge (§1) */
  border-radius: 0;
  overflow: hidden;
  min-height: 320px;
  color: #fff;
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  isolation: isolate;
}
/* Content column aligns with the page's .ui.container sections below. The band
   (bg + arrows) stays full-width on the root. */
.ee-carousel-container {
  position: relative;
  z-index: 2;
}

/* ── background cross-fade layers ─────────────────────────── */
.ee-carousel-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.ee-cbg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: #334155;
  background-size: cover;
  background-position: center;
}
.ee-cbg.active {
  opacity: 1;
}
/* text-protection scrim: darker on the text (left) side, fading toward the
   figure; goes near-uniform when the layout stacks (see media query). */
.ee-cbg-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.6) 0%,
    rgba(15, 23, 42, 0.28) 52%,
    rgba(15, 23, 42, 0.05) 100%
  );
}

/* ── content ──────────────────────────────────────────────── */
.ee-carousel-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 44%;
  align-items: center;
  gap: 28px;
  min-height: 320px;
  padding: 34px 0;
  transition: opacity 0.22s ease;
}
.ee-carousel-content {
  min-width: 0;
}
.ee-car-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 3px 9px;
  margin-bottom: 14px;
}
.ee-car-title {
  font-size: 27px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 12px;
  text-shadow: 0 1px 10px rgba(15, 23, 42, 0.45);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ee-car-teaser {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 20px;
  max-width: 54ch;
  text-shadow: 0 1px 8px rgba(15, 23, 42, 0.4);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ee-car-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 22px;
  background: var(--ee-orange);
  /* Dark ink on brand orange (≈5.9:1) rather than white (≈2.4:1), so the CTA
     meets WCAG AA while keeping the brand colour — same call as the Ask CTA. */
  color: var(--ee-ink);
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.ee-car-more:hover {
  background: #e07f00;
  color: var(--ee-ink);
  text-decoration: none;
}
.ee-car-figure {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ee-car-figure img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  display: block;
}

/* ── arrows ───────────────────────────────────────────────── */
.ee-car-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 23, 42, 0.4);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ee-car-arrow:hover {
  background: rgba(15, 23, 42, 0.62);
}
.ee-car-prev {
  left: 12px;
}
.ee-car-next {
  right: 12px;
}

/* ── dots ─────────────────────────────────────────────────── */
.ee-car-dots {
  position: absolute;
  z-index: 3;
  bottom: 14px;
  left: 0;
  display: flex;
  gap: 4px;
}
.ee-car-dot {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ee-car-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.15s, width 0.15s, border-radius 0.15s;
}
.ee-car-dot[aria-current="true"]::before {
  background: #fff;
  width: 22px;
  border-radius: 5px;
}

.ee-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ee-carousel :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── responsive: stack on phones (first-class acceptance) ──── */
@media (max-width: 767px) {
  .ee-carousel {
    min-height: 0;
    border-radius: 0;
  }
  .ee-carousel-inner {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: 0;
    padding: 20px 0 40px;
  }
  /* order: badge + title, figure, teaser, More */
  .ee-carousel-content {
    display: contents;
  }
  .ee-car-head {
    order: 1;
  }
  .ee-car-figure {
    order: 2;
  }
  .ee-car-teaser {
    order: 3;
    -webkit-line-clamp: 2; /* clamp tighter on phones */
    margin-bottom: 16px;
  }
  .ee-car-more {
    order: 4;
    align-self: flex-start;
  }
  .ee-carousel-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .ee-car-title {
    font-size: 20px;
    -webkit-line-clamp: 3;
  }
  .ee-car-figure img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
  }
  /* swipe is the primary control on touch — hide the arrows, keep the dots */
  .ee-car-arrow {
    display: none;
  }
  .ee-car-dots {
    left: 0;
    right: 0;
    bottom: 4px;
    justify-content: center;
  }
  /* near-uniform scrim so text is protected top-to-bottom when stacked */
  .ee-cbg-scrim {
    background: linear-gradient(
      180deg,
      rgba(15, 23, 42, 0.5) 0%,
      rgba(15, 23, 42, 0.55) 100%
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .ee-cbg,
  .ee-carousel-inner {
    transition: none;
  }
}
