/**
 * Craftex Editorial Carousel Widget Styles
 * Package: craftex-editorial-carousel
 * Version: 1.0.0
 */

/* Section Base */
.craftex-editorial-carousel-section {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  background-color: #D8D7CC;
  overflow: hidden;
  opacity: 1; /* Progressive enhancement: visible by default */
}

/* Background Media & Overlay Layering */
.craftex-section-bg-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

.craftex-section-bg-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Plus Grid Pattern Background */
.craftex-editorial-carousel-section.has-plus-grid {
  --craftex-grid-color: rgba(62, 63, 63, 0.15);
  background-image: radial-gradient(var(--craftex-grid-color) 1px, transparent 0);
  background-size: 32px 32px;
  background-position: -19px -19px;
}

/* SVG Plus Overlay fallback for crisp plus signs (+) */
.craftex-editorial-carousel-section.has-plus-grid::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M23.5 20.5h1v3h3v1h-3v3h-1v-3h-3v-1h3v-3z' fill='%233E3F3F' fill-opacity='0.15'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-position: 0 0;
  z-index: 2;
}

/* Container flex column center alignment */
.craftex-editorial-carousel-container {
  position: relative;
  z-index: 3;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* -------------------------------------------------------------
 * 1. Top Header Row (2 Columns Desktop -> Vertical Stack Mobile)
 * ------------------------------------------------------------- */
.craftex-carousel-header-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 40px;
}

.craftex-carousel-title {
  font-family: "Aeoniktrial", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #3E3F3F;
  margin: 0;
}

.craftex-carousel-body {
  font-family: "Aeoniktrial", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 10px; /* Default 10px body size */
  line-height: 1.6;
  color: #3E3F3F;
  margin: 0;
}

.craftex-carousel-body p {
  margin-top: 0;
  margin-bottom: 12px;
}

.craftex-carousel-body p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------
 * 2. Control Navigation Bar (Theme Button Overrides & Icon Library)
 * ------------------------------------------------------------- */
.craftex-carousel-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  margin-bottom: 24px;
  width: 100%;
}

/* Custom Craftex Theme Button Styling (Override Elementor/WP native defaults) */
.craftex-editorial-carousel-section .craftex-carousel-btn,
.craftex-carousel-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "OCRBLetterpressMW01-Regular", "OCR B Std", "Courier New", monospace;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3E3F3F;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.craftex-editorial-carousel-section .craftex-carousel-btn:hover,
.craftex-editorial-carousel-section .craftex-carousel-btn:focus-visible,
.craftex-editorial-carousel-section .craftex-carousel-btn:active,
.craftex-carousel-btn:hover,
.craftex-carousel-btn:focus-visible,
.craftex-carousel-btn:active {
  color: #1D82EA;
  background: transparent !important;
  box-shadow: none !important;
}

.craftex-carousel-btn:focus-visible {
  outline: 1px solid #1D82EA !important;
  outline-offset: 3px;
}

.craftex-carousel-btn.swiper-button-disabled {
  opacity: 0.35 !important;
  cursor: default;
}

.craftex-btn-arrow,
.craftex-btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.craftex-btn-arrow {
  font-size: 1.2em;
}

.craftex-btn-label {
  font-size: inherit;
  font-family: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.craftex-btn-arrow svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* -------------------------------------------------------------
 * 3. Swiper Photo Carousel & Dynamic 3rd Slide Opacity & Overflow
 * ------------------------------------------------------------- */
.craftex-carousel-swiper-wrap {
  width: 100%;
  overflow: visible;
}

/* Allow overflow-x on the RIGHT side only via inset clip-path */
.craftex-editorial-swiper {
  width: 100%;
  overflow: visible !important;
  clip-path: inset(-100px -100vw -100px 0px);
  -webkit-clip-path: inset(-100px -100vw -100px 0px);
}

.craftex-editorial-slide {
  box-sizing: border-box;
  opacity: 0.2; /* Dynamic fallback: 3rd slide and outer slides 20% opacity */
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1st active slide and 2nd next slide: 100% opacity */
.craftex-editorial-swiper .swiper-slide.swiper-slide-active,
.craftex-editorial-swiper .swiper-slide.swiper-slide-next {
  opacity: 1;
}

.craftex-editorial-slide-image-wrap {
  position: relative;
  width: 100%;
  height: 45vh; /* Default 45vh height */
  overflow: hidden;
  border-radius: 0; /* Sharp architectural edges */
  background-color: transparent !important; /* Removed background color */
}

.craftex-slide-link {
  display: block;
  width: 100%;
  height: 100%;
}

.craftex-editorial-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  transform: translate3d(0, var(--craftex-parallax-y, 0px), 0) scale(var(--craftex-parallax-scale, 1));
}

.craftex-editorial-slide-image-wrap:hover .craftex-editorial-slide-img {
  transform: translate3d(0, var(--craftex-parallax-y, 0px), 0) scale(calc(var(--craftex-parallax-scale, 1) * 1.02));
}

/* -------------------------------------------------------------
 * 4. Stagger Reveal & Entrance Motion Presets
 * ------------------------------------------------------------- */
.craftex-reveal-item {
  opacity: 1; /* Default: visible immediately to prevent blank content */
}

/* Hidden state prior to scroll reveal (Default Fade Up) */
.craftex-editorial-carousel-section.is-craftex-motion-ready[data-craftex-reveal="yes"]:not(.is-craftex-visible) .craftex-reveal-item {
  opacity: 0;
  transform: translateY(28px);
}

/* Entrance Preset: Fade Up */
.craftex-editorial-carousel-section[data-motion-preset="fade-up"].is-craftex-motion-ready:not(.is-craftex-visible) .craftex-reveal-item {
  opacity: 0;
  transform: translateY(28px);
}

/* Entrance Preset: Pure Fade In */
.craftex-editorial-carousel-section[data-motion-preset="fade-in"].is-craftex-motion-ready:not(.is-craftex-visible) .craftex-reveal-item {
  opacity: 0;
  transform: translateY(0);
}

/* Entrance Preset: Fade & Zoom */
.craftex-editorial-carousel-section[data-motion-preset="fade-zoom"].is-craftex-motion-ready:not(.is-craftex-visible) .craftex-reveal-item {
  opacity: 0;
  transform: scale(0.96) translateY(12px);
}

/* Revealed Active State */
.craftex-editorial-carousel-section.is-craftex-motion-ready[data-craftex-reveal="yes"].is-craftex-visible .craftex-reveal-item {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity var(--craftex-motion-duration, 0.9s) cubic-bezier(0.16, 1, 0.3, 1),
              transform var(--craftex-motion-duration, 0.9s) cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--craftex-reveal-order, 0) * var(--craftex-stagger-delay, 0.12s));
}

/* Elementor Editor Active Fallback: Always 100% visible */
.elementor-editor-active .craftex-editorial-carousel-section,
.elementor-editor-active .craftex-editorial-carousel-section *,
body.elementor-editor-active .craftex-reveal-item {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

/* -------------------------------------------------------------
 * 5. Responsive Media Queries (Mobile & Tablet Breakpoints)
 * ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .craftex-carousel-header-row {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 30px;
  }
}

@media (max-width: 767px) {
  .craftex-editorial-carousel-section {
    padding: 40px 20px !important;
  }

  /* Full-Width Bleed for Swiper Wrapper on Mobile */
  .craftex-carousel-swiper-wrap {
    width: 100vw !important;
    position: relative;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    box-sizing: border-box;
  }

  .craftex-editorial-swiper {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    overflow: visible !important;
  }

  .craftex-carousel-header-row {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
  }

  .craftex-carousel-title {
    font-size: 24px;
    line-height: 1.2;
  }

  .craftex-carousel-body {
    font-size: 10px; /* Preserve 10px mobile body size */
    line-height: 1.5;
  }

  .craftex-carousel-controls-bar {
    margin-top: 24px;
    margin-bottom: 16px;
  }

  .craftex-editorial-slide-image-wrap {
    height: 280px;
  }
}
