/**
 * Borshon Eyewear Shape Carousel - Frontend Styles
 * Inspired by luxury editorial eyewear showcases
 */

.bec-carousel-wrapper {
  position: relative;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 0 36px;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.bec-carousel-wrapper * {
  box-sizing: border-box;
}

/* 3D Stage */
.bec-carousel-stage {
  position: relative;
  width: 100%;
  height: var(--bec-height-desk, 440px);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  cursor: grab;
}

.bec-carousel-stage:active {
  cursor: grabbing;
}

.bec-cards-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

/* Individual Card */
.bec-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(260px, 25vw, 360px);
  height: clamp(340px, 34vw, 470px);
  border-radius: 4px;
  overflow: hidden;
  background-color: #1a1a1a;
  text-decoration: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.5s ease,
              filter 0.5s ease,
              box-shadow 0.5s ease;
  will-change: transform, opacity;
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bec-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  text-decoration: none;
  color: #ffffff;
  overflow: hidden;
}

/* Image */
.bec-card-img-wrap {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bec-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bec-card[data-position="0"]:hover .bec-card-img {
  transform: scale(1.04);
}

/* Gradient Overlay at Bottom */
.bec-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 48%,
    rgba(0, 0, 0, 0.28) 70%,
    rgba(0, 0, 0, 0.82) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Card Content: Title & Circle Button */
.bec-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  z-index: 5;
  pointer-events: none;
}

.bec-card-title {
  font-size: clamp(19px, 2.1vw, 26px);
  font-weight: 500;
  line-height: 1.15;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  margin: 0;
  white-space: nowrap;
}

/* Circular Arrow Button (visible on active card) */
.bec-card-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.35s ease, transform 0.35s ease, background-color 0.25s, border-color 0.25s;
  pointer-events: auto;
  flex-shrink: 0;
}

.bec-card-btn svg {
  width: 17px;
  height: 17px;
  stroke: #ffffff;
  stroke-width: 1.8;
  transition: transform 0.25s ease;
}

/* Center Active Card Button State */
.bec-card[data-position="0"] .bec-card-btn {
  opacity: 1;
  transform: scale(1);
}

.bec-card[data-position="0"] .bec-card-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: #ffffff;
}

.bec-card[data-position="0"] .bec-card-btn:hover svg {
  transform: translateX(2px);
}

/* 3D Coverflow Perspective Transforms */
/* Center (Position 0 - Active) */
.bec-card[data-position="0"] {
  transform: translate3d(-50%, -50%, 0) scale(1) rotateY(0deg);
  z-index: 10;
  opacity: 1;
  filter: brightness(1);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.26), 0 5px 15px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

/* Immediate Left (Position -1) */
.bec-card[data-position="-1"] {
  transform: translate3d(calc(-50% - 82%), -50%, -60px) scale(0.88) rotateY(21deg);
  z-index: 7;
  opacity: 0.95;
  filter: brightness(0.92);
  cursor: pointer;
}

/* Immediate Right (Position 1) */
.bec-card[data-position="1"] {
  transform: translate3d(calc(-50% + 82%), -50%, -60px) scale(0.88) rotateY(-21deg);
  z-index: 7;
  opacity: 0.95;
  filter: brightness(0.92);
  cursor: pointer;
}

/* Far Left (Position -2) */
.bec-card[data-position="-2"] {
  transform: translate3d(calc(-50% - 158%), -50%, -150px) scale(0.77) rotateY(28deg);
  z-index: 4;
  opacity: 0.88;
  filter: brightness(0.85);
  cursor: pointer;
}

/* Far Right (Position 2) */
.bec-card[data-position="2"] {
  transform: translate3d(calc(-50% + 158%), -50%, -150px) scale(0.77) rotateY(-28deg);
  z-index: 4;
  opacity: 0.88;
  filter: brightness(0.85);
  cursor: pointer;
}

/* Outside Visible Range (Hidden) */
.bec-card[data-hidden="true"] {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.bec-card[data-hidden="true"].is-left {
  transform: translate3d(calc(-50% - 225%), -50%, -240px) scale(0.65) rotateY(34deg);
}

.bec-card[data-hidden="true"].is-right {
  transform: translate3d(calc(-50% + 225%), -50%, -240px) scale(0.65) rotateY(-34deg);
}

/* Fallback Placeholder */
.bec-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2b2b2b 0%, #151515 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #a0a0a0;
  gap: 10px;
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

.bec-placeholder svg {
  width: 48px;
  height: 48px;
  stroke: #666;
}

/* Horizontal Dash Indicators */
.bec-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 32px;
  padding: 0;
  list-style: none;
}

.bec-dash {
  appearance: none;
  -webkit-appearance: none;
  background-color: #dedede;
  border: none;
  width: 32px;
  height: 3.5px;
  border-radius: 3px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: background-color 0.3s ease, width 0.3s ease, transform 0.2s ease;
  outline: none;
}

.bec-dash:hover {
  background-color: #a8a8a8;
}

.bec-dash.is-active {
  background-color: #121212;
  width: 38px;
}

.bec-dash:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}

/* Navigation Arrows (Always visible, sleek luxury styling) */
.bec-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  color: #1f2937;
  transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, opacity 0.25s ease;
  opacity: 0.95;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.bec-nav-arrow:hover {
  background: #ffffff;
  color: var(--primary, #8B571F);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 3px 8px rgba(0, 0, 0, 0.08);
  opacity: 1;
}

.bec-nav-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

.bec-nav-prev {
  left: 20px;
}

.bec-nav-next {
  right: 20px;
}

.bec-nav-arrow svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* Responsive Breakpoints */
/* Tablet */
@media (max-width: 1024px) {
  .bec-carousel-stage {
    height: var(--bec-height-tab, 380px);
  }
  .bec-card {
    width: clamp(240px, 34vw, 320px);
    height: clamp(310px, 42vw, 400px);
  }
  .bec-card[data-position="-1"] {
    transform: translate3d(calc(-50% - 72%), -50%, -50px) scale(0.86) rotateY(18deg);
  }
  .bec-card[data-position="1"] {
    transform: translate3d(calc(-50% + 72%), -50%, -50px) scale(0.86) rotateY(-18deg);
  }
  .bec-card[data-position="-2"] {
    transform: translate3d(calc(-50% - 135%), -50%, -120px) scale(0.72) rotateY(24deg);
    opacity: 0.6;
  }
  .bec-card[data-position="2"] {
    transform: translate3d(calc(-50% + 135%), -50%, -120px) scale(0.72) rotateY(-24deg);
    opacity: 0.6;
  }
  .bec-card-content {
    padding: 18px 20px;
  }
}

/* Mobile Devices */
@media (max-width: 680px) {
  .bec-carousel-wrapper {
    padding: 16px 0 28px;
  }
  .bec-carousel-stage {
    height: var(--bec-height-mob, 320px);
    perspective: 800px;
    -webkit-perspective: 800px;
  }
  .bec-card {
    width: 68vw;
    max-width: 280px;
    height: 90%;
    border-radius: 4px;
  }
  .bec-card-content {
    padding: 16px 18px;
  }
  .bec-card-title {
    font-size: 19px;
  }
  .bec-card-btn {
    width: 34px;
    height: 34px;
  }
  .bec-card-btn svg {
    width: 14px;
    height: 14px;
  }
  /* On mobile, tuck outer cards slightly so center card is the clear hero */
  .bec-card[data-position="0"] {
    transform: translate3d(-50%, -50%, 0) scale(1) rotateY(0deg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  }
  .bec-card[data-position="-1"] {
    transform: translate3d(calc(-50% - 66%), -50%, -40px) scale(0.84) rotateY(16deg);
    opacity: 0.75;
  }
  .bec-card[data-position="1"] {
    transform: translate3d(calc(-50% + 66%), -50%, -40px) scale(0.84) rotateY(-16deg);
    opacity: 0.75;
  }
  .bec-card[data-position="-2"],
  .bec-card[data-position="2"] {
    opacity: 0;
    pointer-events: none;
  }
  .bec-indicators {
    margin-top: 22px;
    gap: 6px;
  }
  .bec-dash {
    width: 24px;
    height: 3px;
  }
  .bec-dash.is-active {
    width: 28px;
  }
  .bec-nav-arrow {
    width: 36px;
    height: 36px;
    opacity: 0.9;
    display: flex;
  }
  .bec-nav-prev {
    left: 8px;
  }
  .bec-nav-next {
    right: 8px;
  }
  .bec-nav-arrow svg {
    width: 16px;
    height: 16px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .bec-card,
  .bec-dash,
  .bec-card-btn {
    transition: none !important;
  }
}
