/* =====================================================================
   Hero Carousel  (namespaced with .hc- to avoid Bootstrap collisions)
   Card-style slider: big active image + content + thumbnail rail.
   Mechanics adapted from the classic LornDev/CodingNepal card slider.
   ===================================================================== */

.hc {
  position: relative;
  width: 100%;
  height: 640px;
  overflow: hidden;
  background-color: #000;
}

/* ---- Slides ---------------------------------------------------------- */
/* Non-active slides are hidden via opacity:0, which also gives each item
   its own stacking context so the content's z-index can't leak on top of
   the active slide. Visibility is restored per-state below. */
.hc .hc-list .hc-item {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.hc .hc-list .hc-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Legibility gradient over each slide (sits above image, below content) */
.hc .hc-list .hc-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.7) 30%,
    rgba(0, 0, 0, 0.35) 55%,
    rgba(0, 0, 0, 0) 80%
  );
}

/* ---- Slide content --------------------------------------------------- */
.hc .hc-list .hc-item .hc-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1140px, 86%);
  padding-right: 30%;
  box-sizing: border-box;
  z-index: 2;
  color: #fff;
  text-shadow: 0 5px 12px rgba(0, 0, 0, 0.35);
}

.hc .hc-content .hc-author {
  font-weight: 700;
  letter-spacing: 0.35em;
  font-size: 0.85rem;
  text-transform: uppercase;
  opacity: 0.92;
}

.hc .hc-content .hc-title,
.hc .hc-content .hc-topic {
  font-size: clamp(2.1rem, 5.2vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

/* Lighter, more luminous blue + strong dark halo so the accent word stays
   legible over light/blue-tinted product photos. */
.hc .hc-content .hc-topic {
  color: #4da3ff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.6);
}

.hc .hc-content .hc-des {
  margin-top: 1rem;
  max-width: 520px;
  font-size: clamp(0.9rem, 1.15vw, 1.05rem);
  line-height: 1.6;
  opacity: 0.95;
}

.hc .hc-content .hc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.hc .hc-content .hc-buttons .hc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 0.25s ease, background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.hc .hc-content .hc-buttons .hc-btn-primary {
  background: linear-gradient(135deg, var(--bs-primary, #0d6efd) 0%, #0a58ca 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(13, 110, 253, 0.35);
}

.hc .hc-content .hc-buttons .hc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(13, 110, 253, 0.45);
}

.hc .hc-content .hc-buttons .hc-btn-secondary {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.hc .hc-content .hc-buttons .hc-btn-secondary:hover {
  background: #fff;
  color: var(--bs-primary, #0d6efd);
  text-shadow: none;
  transform: translateY(-2px);
}

/* ---- Thumbnail rail -------------------------------------------------- */
/* No horizontal padding: the first thumbnail must sit exactly at left:50%
   so the image morph (hcShowImage / hcOutImage, which target left:50%)
   lines up perfectly with it during next/prev transitions. */
.hc .hc-thumbnail {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: max-content;
  z-index: 100;
  display: flex;
  gap: 15px;
}

/* Rendered as <button> so clicking promotes the card to the active slide
   instead of navigating — hence the button resets below. */
.hc .hc-thumbnail .hc-thumb-item {
  display: block;
  width: 150px;
  height: 200px;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hc .hc-thumbnail .hc-thumb-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.hc .hc-thumbnail .hc-thumb-item:focus-visible {
  outline: 3px solid #4da3ff;
  outline-offset: 2px;
}

.hc .hc-thumbnail .hc-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dark gradient scrim so the white labels stay readable on light photos */
.hc .hc-thumbnail .hc-thumb-item .hc-thumb-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 12px 12px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.55) 45%,
    rgba(0, 0, 0, 0) 100%
  );
}

.hc .hc-thumb-content .hc-thumb-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
}

.hc .hc-thumb-content .hc-thumb-desc {
  font-size: 0.72rem;
  opacity: 0.9;
}

/* ---- Arrows ---------------------------------------------------------- */
/* Anchored to the content's left edge at every breakpoint. The container
   spans the content width but is click-through (pointer-events:none) so it
   never blocks the thumbnails sitting to its right; only the buttons catch
   clicks. */
.hc .hc-arrows {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 40px;
  width: min(1140px, 86%);
  z-index: 100;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
}

.hc .hc-arrows button {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  border: none;
  color: #fff;
  font-family: monospace;
  font-weight: bold;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.hc .hc-arrows button:hover {
  background-color: #fff;
  color: #000;
}

/* ---- Time / progress bar -------------------------------------------- */
.hc .hc-time {
  position: absolute;
  z-index: 1000;
  width: 0%;
  height: 3px;
  background-color: var(--bs-primary, #0d6efd);
  left: 0;
  top: 0;
}

/* =====================================================================
   Active slide (always the first .hc-item) — animate its content in
   ===================================================================== */
.hc .hc-list .hc-item:nth-child(1) {
  z-index: 1;
  opacity: 1;
}

.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-author,
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-title,
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-topic,
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-des,
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-buttons {
  transform: translateY(50px);
  filter: blur(20px);
  opacity: 0;
  animation: hcShowContent 0.5s 1 forwards ease-in-out;
}

.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-title {
  animation-delay: 0.2s;
}
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-topic {
  animation-delay: 0.4s;
}
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-des {
  animation-delay: 0.6s;
}
.hc .hc-list .hc-item:nth-child(1) .hc-content .hc-buttons {
  animation-delay: 0.8s;
}

@keyframes hcShowContent {
  to {
    transform: translateY(0);
    filter: blur(0);
    opacity: 1;
  }
}

/* =====================================================================
   NEXT button effect
   ===================================================================== */
.hc.next .hc-list .hc-item:nth-child(1) img {
  width: 150px;
  height: 200px;
  position: absolute;
  bottom: 40px;
  left: 50%;
  border-radius: 18px;
  animation: hcShowImage 0.7s ease 1 forwards;
}

/* Keep the outgoing slide full-screen behind the zooming image so the
   uncovered edges show the previous image instead of black (overlap). */
.hc.next .hc-list .hc-item:nth-last-child(1) {
  opacity: 1;
  z-index: 0;
}
.hc.next .hc-list .hc-item:nth-last-child(1) .hc-content {
  opacity: 0;
}

/* During a transition two slides are visible at once; show only the incoming
   slide's scrim so the overlay doesn't stack and double the darkness. */
.hc.next .hc-list .hc-item:nth-last-child(1)::after,
.hc.prev .hc-list .hc-item:nth-child(2)::after {
  display: none;
}

@keyframes hcShowImage {
  to {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

.hc.next .hc-thumbnail .hc-thumb-item:nth-last-child(1) {
  overflow: hidden;
  animation: hcShowThumbnail 0.5s ease 1 forwards;
}

.hc.next .hc-thumbnail {
  animation: hcEffectNext 0.5s ease 1 forwards;
}

@keyframes hcShowThumbnail {
  from {
    width: 0;
    opacity: 0;
  }
}

@keyframes hcEffectNext {
  from {
    transform: translateX(150px);
  }
}

/* Jumping straight to a clicked thumbnail reorders the rail by more than one
   position, so the single-step rail slide/grow would look wrong — suppress it
   and let the rail snap while the chosen image morphs in. */
.hc.next.hc-jump .hc-thumbnail,
.hc.next.hc-jump .hc-thumbnail .hc-thumb-item:nth-last-child(1) {
  animation: none;
}

/* Running time bar */
.hc.next .hc-time,
.hc.prev .hc-time {
  animation: hcRunningTime 3s linear 1 forwards;
}

@keyframes hcRunningTime {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}

/* =====================================================================
   PREV button effect
   ===================================================================== */
.hc.prev .hc-list .hc-item:nth-child(2) {
  z-index: 2;
  opacity: 1;
}

.hc.prev .hc-list .hc-item:nth-child(2) img {
  animation: hcOutImage 0.7s ease 1 forwards;
  position: absolute;
  bottom: 0;
  left: 0;
}

@keyframes hcOutImage {
  to {
    width: 150px;
    height: 200px;
    border-radius: 18px;
    bottom: 40px;
    left: 50%;
  }
}

.hc.prev .hc-thumbnail .hc-thumb-item:nth-child(1) {
  overflow: hidden;
  opacity: 0;
  animation: hcShowThumbnail 0.5s ease 1 forwards;
}

.hc.prev .hc-list .hc-item:nth-child(2) .hc-content .hc-author,
.hc.prev .hc-list .hc-item:nth-child(2) .hc-content .hc-title,
.hc.prev .hc-list .hc-item:nth-child(2) .hc-content .hc-topic,
.hc.prev .hc-list .hc-item:nth-child(2) .hc-content .hc-des,
.hc.prev .hc-list .hc-item:nth-child(2) .hc-content .hc-buttons {
  animation: hcOutContent 0.5s linear 1 forwards !important;
}

@keyframes hcOutContent {
  to {
    transform: translateY(-150px);
    filter: blur(20px);
    opacity: 0;
  }
}

/* Arrows stay clickable during a transition: each navigation restarts the
   animation (see playTransition in hero-carousel.js), so the user can always
   navigate without waiting for the running transition to finish. */

/* =====================================================================
   Responsive
   ===================================================================== */
/* Taller hero on large/wide screens so it fills the viewport better.
   Thumbnail size stays 150x200 so the image morph stays aligned. */
@media screen and (min-width: 1400px) {
  .hc {
    height: 720px;
  }
}

@media screen and (min-width: 1800px) {
  .hc {
    height: 820px;
  }
}

/* Desktop: show the whole product (contain) on a clean white field instead of
   cropping it to fill (cover). The product photos already sit on white, so the
   side fill blends in. */
@media screen and (min-width: 992px) {
  .hc {
    background-color: #fff;
  }
  .hc .hc-list .hc-item img {
    object-fit: contain;
    background-color: #fff;
    /* Zoom the contained product ~150% so it fills more of the hero; the
       overflow is clipped by .hc (overflow:hidden), trimming the photo's
       empty margins rather than shrinking the product. */
    transform: scale(1.5);
  }
}

@media screen and (max-width: 991px) {
  .hc {
    height: 600px;
  }
  .hc .hc-thumbnail .hc-thumb-item {
    width: 130px;
    height: 180px;
  }
}

@media screen and (max-width: 767px) {
  .hc {
    height: 560px;
  }
  .hc .hc-list .hc-item .hc-content {
    padding-right: 0;
    width: 88%;
  }
  /* Hide the long description on tablet and below */
  .hc .hc-content .hc-des {
    display: none;
  }
  .hc .hc-content .hc-title,
  .hc .hc-content .hc-topic {
    font-size: clamp(1.8rem, 9vw, 2.6rem);
  }
  .hc .hc-thumbnail {
    bottom: 24px;
    gap: 10px;
  }
  .hc .hc-thumbnail .hc-thumb-item {
    width: 110px;
    height: 150px;
  }
  /* keep the morph illusion aligned with the smaller thumbnails */
  .hc.next .hc-list .hc-item:nth-child(1) img {
    width: 110px;
    height: 150px;
    bottom: 24px;
  }
  @keyframes hcOutImage {
    to {
      width: 110px;
      height: 150px;
      border-radius: 18px;
      bottom: 24px;
      left: 50%;
    }
  }
  /* Keep the default left-aligned (centered-container) positioning; only
     nudge it up a little on small screens. Overriding left/width here
     without resetting the default translateX(-50%) pushed it off-screen. */
  .hc .hc-arrows {
    bottom: 24px;
  }
}

@media screen and (max-width: 480px) {
  .hc {
    height: 520px;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hc *,
  .hc *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
  }
}
