/*!
 * carousel.css — Horizontal swipe carousel
 * rnsrajim.com | Matrix/Cyberpunk theme
 * Zero external dependencies — Apache/LiteSpeed shared-hosting compatible
 */

/* ── Outer wrapper ─────────────────────────────────────── */
.carousel-wrap {
  position: relative;
  /* Side padding reserves space for prev/next buttons */
  padding: 0 48px;
  max-width: 1160px;
  margin: 0 auto;
  /* Reserve height so page doesn't jump before JS renders items */
  min-height: 160px;
}

/* ── Scrollable track ──────────────────────────────────── */
.car-track {
  display: flex;
  align-items: stretch;
  gap: 20px;
  overflow-x: auto;
  /* Native CSS scroll-snap: no JS needed for basic snapping */
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;     /* iOS momentum scroll */
  overscroll-behavior-x: contain;        /* stop page-scroll chaining */
  scrollbar-width: none;                 /* Firefox: hide scrollbar */
  /* top/bottom padding; extra bottom space is consumed by dot row */
  padding: 8px 2px 38px;
  /* Compositing hint — hardware-accelerated scroll on Android */
  will-change: scroll-position;
  contain: layout;
  outline: none;
}
.car-track::-webkit-scrollbar { display: none; }   /* Chrome/Safari */

/* Custom keyboard focus ring */
.car-track:focus-visible {
  outline: 1px solid rgba(0, 255, 65, .45);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Cursor states */
.car-track                { cursor: grab; }
.car-track.car-drag       { cursor: grabbing;
                             scroll-behavior: auto;
                             user-select: none;
                             -webkit-user-select: none; }
/* Disable child pointer events during drag so links don't fire */
.car-track.car-drag > *   { pointer-events: none; }

/* ── Individual item slot ──────────────────────────────── */
.car-item {
  /* 3 items visible: (100% - 2 × gap) / 3 */
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: 0;                   /* prevent flex-item blowout */
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  contain: layout style;
  display: flex;
  flex-direction: column;
}

/* 2 items visible — tablet */
@media (max-width: 960px) {
  .carousel-wrap { padding: 0 44px; }
  .car-item { flex: 0 0 calc((100% - 20px) / 2); }
}

/* 1 item visible — large mobile */
@media (max-width: 600px) {
  .carousel-wrap { padding: 0 38px; }
  .car-item { flex: 0 0 min(360px, 84vw); }
}

/* 1 item visible — small mobile */
@media (max-width: 380px) {
  .carousel-wrap { padding: 0 32px; }
  .car-item { flex: 0 0 90vw; }
}

/* ── Prev / Next buttons ───────────────────────────────── */
.car-btn {
  position: absolute;
  /* Vertical centre on the card area, offset up for dot row below */
  top: 50%;
  transform: translateY(calc(-50% - 19px));
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(0, 255, 65, .2);
  background: rgba(0, 0, 0, .88);
  color: #00ff41;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s ease,
              background   .2s ease,
              box-shadow   .2s ease,
              opacity      .15s ease;
  /* Remove tap highlight on mobile */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.car-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  pointer-events: none;
}

.car-btn:hover:not(:disabled) {
  border-color: #00ff41;
  background: rgba(0, 255, 65, .07);
  box-shadow: 0 0 14px rgba(0, 255, 65, .22);
}

.car-btn:active:not(:disabled) {
  background: rgba(0, 255, 65, .13);
}

.car-btn:focus-visible {
  outline: 1px solid #00ff41;
  outline-offset: 2px;
}

.car-btn:disabled {
  opacity: .18;
  cursor: default;
  pointer-events: none;
}

.car-prev { left:  0; }
.car-next { right: 0; }

/* ── Dot / page indicators ─────────────────────────────── */
.car-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  /* Pull the dots up to sit inside the track's bottom padding */
  margin-top: -32px;
  padding-top: 4px;
  position: relative;
  z-index: 1;
  min-height: 20px;
}

.car-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 255, 65, .15);
  border: 1px solid rgba(0, 255, 65, .28);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .22s ease,
              width       .22s ease,
              border-radius .22s ease,
              box-shadow  .22s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.car-dot:hover {
  background: rgba(0, 255, 65, .42);
  border-color: rgba(0, 255, 65, .7);
}

.car-dot.active {
  background: #00ff41;
  width: 20px;
  border-radius: 4px;
  border-color: #00ff41;
  box-shadow: 0 0 8px rgba(0, 255, 65, .55);
}

.car-dot:focus-visible {
  outline: 1px solid #00ff41;
  outline-offset: 3px;
}

/* ── Edge-fade scroll hints ─────────────────────────────── */
.carousel-wrap::before,
.carousel-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 38px;         /* align with bottom of cards (above dots) */
  width: 30px;
  pointer-events: none;
  z-index: 1;
}
.carousel-wrap::before { left: 48px;  background: linear-gradient(to right, rgba(0,0,0,.6), transparent); }
.carousel-wrap::after  { right: 48px; background: linear-gradient(to left,  rgba(0,0,0,.6), transparent); }

@media (max-width: 960px) {
  .carousel-wrap::before { left: 44px;  }
  .carousel-wrap::after  { right: 44px; }
}
@media (max-width: 600px) {
  .carousel-wrap::before { left: 38px;  width: 20px; }
  .carousel-wrap::after  { right: 38px; width: 20px; }
}

/* ── Cards fill their slot completely ───────────────────── */
/* .news-card and .feat-card must stretch to fill .car-item */
.car-item > .news-card,
.car-item > .feat-card {
  width: 100%;
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.car-item > .feat-card {
  height: 100%;
  min-height: 185px;
}

/* ── Screen-reader live region ──────────────────────────── */
.car-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── No-scroll state: all items fit — hide navigation chrome ─ */
.carousel-wrap.car-no-scroll .car-btn,
.carousel-wrap.car-no-scroll .car-dots,
.carousel-wrap.car-no-scroll::before,
.carousel-wrap.car-no-scroll::after {
  display: none;
}

.carousel-wrap.car-no-scroll {
  padding: 0;
  min-height: 0;
}

.carousel-wrap.car-no-scroll .car-track {
  flex-wrap: wrap;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 8px;
  cursor: default;
}

/* ── Reduced motion: respect OS preference ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .car-track { scroll-behavior: auto; }
  .car-dot,
  .car-btn   { transition: none; }
}
