/**
 * Craftex Brand Showcase Widget Styles
 * Package: craftex-brand-showcase
 * Version: 1.0.0
 */

/* Section Base */
.craftex-brand-showcase-section {
  position: relative;
  width: 100%;
  min-height: 100vh; /* Default 100vh section height */
  box-sizing: border-box;
  background-color: #D8D7CC;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  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 Overlay */
.craftex-brand-showcase-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;
}

.craftex-brand-showcase-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 Base (Force Flex Growth to 100% Section Height inside Padding) */
.craftex-brand-showcase-container {
  position: relative;
  z-index: 3;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  height: 100%;
  flex: 1 1 100%; /* Force flex child to fill section height */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* -------------------------------------------------------------
 * 1. Desktop 2-Column Split Grid
 * ------------------------------------------------------------- */
.craftex-brand-showcase-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr; /* Default 60/40 Split Ratio */
  gap: 60px;
  align-items: stretch;
  width: 100%;
  height: 100%;
  flex: 1 1 100%;
  min-height: 0; /* CRITICAL: Prevents grid from expanding due to img aspect ratio */
}

.craftex-brand-left-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Space title at top and grid at bottom */
  width: 100%;
  height: 100%;
  min-height: 0;
}

.craftex-brand-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 0 30px 0;
}

/* -------------------------------------------------------------
 * 2. Brands Cards Flex Layout (Logo at Top / Card Body at Bottom)
 * ------------------------------------------------------------- */
.craftex-brands-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px;
  align-items: stretch;
  width: 100%;
}

.craftex-brand-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Logo photo alone at top, Name+Desc+Link together at bottom */
  box-sizing: border-box;
}

.craftex-brand-logo-wrap {
  margin-bottom: 24px;
  display: block;
}

.craftex-brand-logo-img {
  display: block;
  width: auto;
  height: auto;
  max-height: 36px;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}

.craftex-brand-card-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: auto;
}

.craftex-brand-card-name {
  font-family: "Aeoniktrial", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: #3E3F3F;
  margin: 0 0 12px 0;
}

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

.craftex-brand-card-desc p {
  margin-top: 0;
  margin-bottom: 8px;
}

.craftex-brand-card-desc p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------
 * 3. Action Links (READ MORE ↗)
 * ------------------------------------------------------------- */
.craftex-brand-link-wrap {
  margin-top: auto;
}

.craftex-brand-link {
  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;
  text-decoration: none;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.craftex-brand-link:hover,
.craftex-brand-link:focus-visible,
.craftex-brand-link:active {
  color: #1D82EA;
}

.craftex-brand-link:focus-visible {
  outline: 2px solid #1D82EA;
  outline-offset: 3px;
}

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

.craftex-link-label {
  height: 14px;
}

.craftex-link-icon {
  min-height: 14px;
  font-size: 13px;
}

.craftex-link-icon svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* -------------------------------------------------------------
 * 4. Right Column Featured Photo Frame (Absolute Match to Grid/Section)
 * ------------------------------------------------------------- */
.craftex-brand-right-col {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden; /* Clips any overflow */
}

.craftex-brand-featured-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 0; /* Sharp architectural edges */
  background-color: transparent;
}

.craftex-brand-featured-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-brand-featured-frame:hover .craftex-brand-featured-img {
  transform: translate3d(0, var(--craftex-parallax-y, 0px), 0) scale(calc(var(--craftex-parallax-scale, 1) * 1.02));
}

/* Desktop Absolute Fitting: Image is absolute inside right column so intrinsic size NEVER inflates section or overflows */
@media (min-width: 1025px) {
  .craftex-brand-right-col {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .craftex-brand-featured-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .craftex-brand-featured-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center center;
  }
}

/* -------------------------------------------------------------
 * 5. Stagger Reveal & Entrance Motion Presets
 * ------------------------------------------------------------- */
.craftex-reveal-item {
  opacity: 1; /* Visible by default */
}

/* Hidden state prior to scroll reveal (Default Fade Up) */
.craftex-brand-showcase-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-brand-showcase-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-brand-showcase-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-brand-showcase-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-brand-showcase-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-brand-showcase-section,
.elementor-editor-active .craftex-brand-showcase-section *,
body.elementor-editor-active .craftex-reveal-item {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

/* -------------------------------------------------------------
 * 6. Responsive Media Queries (Mobile & Tablet Breakpoints)
 * ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .craftex-brand-showcase-section {
    height: auto;
    min-height: auto;
  }

  .craftex-brand-showcase-container {
    height: auto;
    flex: none;
  }

  .craftex-brand-showcase-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    height: auto;
    flex: none;
  }

  .craftex-brand-left-col {
    height: auto;
  }

  .craftex-brand-right-col {
    height: auto;
    position: relative;
  }

  .craftex-brand-featured-frame {
    position: relative;
    height: 480px;
    min-height: 480px;
  }

  .craftex-brand-featured-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@media (max-width: 767px) {
  .craftex-brand-showcase-section {
    padding: 40px 20px !important;
    height: auto;
  }

  .craftex-brand-title {
    font-size: 24px;
    margin-bottom: 30px;
  }

  .craftex-brands-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    height: auto;
  }

  .craftex-brand-card {
    height: auto;
  }

  .craftex-brand-featured-frame {
    position: relative;
    height: 380px;
    min-height: 380px;
    margin-top: 10px;
  }

  .craftex-brand-featured-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
