/* WordPress Block Spacing Support */
.artisans-block[class*="has-margin"] {
  margin: var(--wp--style--block-gap, 0);
}

.artisans-block[class*="has-padding"] {
  padding: var(--wp--style--block-gap, 0);
}

/* Ensure spacing doesn't break the swiper container */
.artisans-block .artisans-swiper {
  margin: 0;
  padding: 0;
}

/* Artisans Block Styles */
.artisans-block {
  width: 100%;
  overflow: hidden;
}

/* Default spacing when no WordPress spacing is applied */
.artisans-block:not([class*="has-margin"]):not([class*="has-padding"]) {
  margin: 0 auto;
  padding: 0;
}

/* Swiper Container */
.artisans-swiper {
  width: 100%;
  height: 470px;
  padding: 0;
  overflow: visible;
}

.artisans-swiper .swiper-wrapper {
  display: flex;
  align-items: flex-start;
  height: 100%;
}

/* Individual Slide Styles */
.artisan-slide {
  /* width: 347px !important; */
  width: auto;
  height: 470px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.artisan-slide:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.artisan-slide-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.artisan-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.artisan-slide:hover .artisan-image {
  transform: scale(1.05);
}

/* Overlay for artisan info */
.artisan-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 40px 20px 20px;
  color: white;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.artisan-name {
  font-family: "Kollektif", Arial, sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 8px 0;
  color: white;
}

.artisan-title {
  font-family: "Kollektif", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.8;
}

/* Modal Styles - MicroModal Compatible */
.artisan-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
}

.artisan-modal[aria-hidden="false"] {
  display: flex;
}

.artisan-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.artisan-modal-container {
  position: relative;
  width: 90%;
  max-width: 1258px;
  max-height: 90vh;
  background: white;
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.artisan-modal-close {
  /* position: absolute; */
  /* top: 0;
    right: 0; */
  margin-inline-start: auto;
  width: 2rem;
  height: 2rem;
  background: #425eab;
  border: none;
  color: #fff4e4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  border-radius: 0 8px 0 0;
  transition: background-color 0.3s ease;
  @media (min-width: 992px) {
    width: 4rem;
    height: 4rem;
  }
}

.artisan-modal-close:hover {
  background: #3a5299;
}

.artisan-modal-close svg {
  width: 24px;
  height: 24px;
}

/* Modal Content */
.artisan-modal-content {
  padding: 0;
  height: 100%;
  position: relative;
}

.artisan-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: #666;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #425eab;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Artisan Details Layout */
.artisan-details {
  padding: 1rem 2rem 2rem 2rem;
  /* min-height: 600px; */
  @media (min-width: 992px) {
    padding: 1rem 4rem 4rem 4rem;
  }
}

.artisan-info {
  display: grid;
  column-gap: 3rem;
  @media (min-width: 768px) {
    grid-template-columns: 1fr 1fr;
  }
}

.artisan-main-image {
  /* flex-shrink: 0; */
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.modal-artisan-img {
  width: auto;
  height: 100%;
  max-height: 500px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin-inline: auto;
}

.artisan-text-content {
  flex: 1;
  padding: 2rem 0 0;
}

.community-title {
  font-family: "Kollektif", Arial, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.5;
  color: #828282;
  margin: 0 0 48px 0;
}

.modal-artisan-name {
  font-family: "Kollektif", Arial, sans-serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1.5;
  color: #343434;
  margin: 0 0 8px 0;
}

.modal-artisan-title {
  font-family: "Kollektif", Arial, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.5;
  color: #343434;
  margin: 0 0 35px 0;
}

.modal-artisan-description {
  font-family: "Inter", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.1;
  color: #828282;
  margin: 0;
}

.modal-artisan-description p {
  margin: 0 0 15px 0;
}

.modal-artisan-description p:last-child {
  margin-bottom: 0;
}

/* Products Grid */
.modal-products-grid {
  margin-top: 35px;
}

.products-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.product-item {
  width: 85px;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.product-image-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.product-item:hover .product-image {
  transform: scale(1.1);
}

.no-products {
  color: #828282;
  font-style: italic;
  text-align: center;
  padding: 40px;
}

/* Responsive Design */
@media (max-width: 1440px) {

  .modal-artisan-name {
    font-size: 42px;
  }

  .artisan-text-content {
    padding: 50px 0 0;
  }
}

@media (max-width: 1024px) {

  .artisan-modal-container {
    width: 95%;
    max-height: 95vh;
  }
  /*     
    .artisan-details {
        padding: 80px 40px 30px;
    } */

  .artisan-info {
    flex-direction: column;
    gap: 30px;
  }

  /* .artisan-main-image {
        width: 100%;
        max-width: 300px;
        height: 350px;
        margin: 0 auto;
    } */

  .artisan-text-content {
    padding: 0;
  }

  .modal-artisan-name {
    font-size: 36px;
  }

  .community-title {
    font-size: 20px;
    margin-bottom: 30px;
  }

  .modal-artisan-title {
    font-size: 20px;
  }

  .products-container {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  /* .artisans-swiper {
    height: 320px;
  }

  .artisan-slide {
    width: 240px !important;
    height: 320px;
  } */

  .artisan-name {
    font-size: 20px;
  }

  .artisan-title {
    font-size: 12px;
  }

  .artisan-modal-container {
    width: 98%;
    margin: 20px auto;
    max-height: calc(100vh - 40px);
  }

  /* .artisan-details {
        padding: 60px 20px 20px;
        overflow-y: auto;
        max-height: calc(100vh - 100px);
    } */

  .modal-artisan-name {
    font-size: 28px;
  }

  .community-title {
    font-size: 18px;
    margin-bottom: 20px;
  }

  .modal-artisan-title {
    font-size: 18px;
  }

  .modal-artisan-description {
    font-size: 14px;
  }

  .artisan-modal-close {
    width: 60px;
    height: 60px;
  }

  .product-item {
    width: 70px;
    height: 75px;
  }

  .products-container {
    gap: 15px;
  }
}

@media (max-width: 480px) {
  /* .artisan-slide {
    width: 200px !important;
    height: 280px;
  }

  .artisans-swiper {
    height: 280px;
  } */

  /* .artisan-details {
        padding: 50px 15px 15px;
    } */

  .modal-artisan-name {
    font-size: 24px;
    line-height: 1.2;
  }

  .community-title {
    font-size: 16px;
  }

  .modal-artisan-title {
    font-size: 16px;
  }

  .modal-artisan-description {
    font-size: 13px;
    line-height: 1.3;
  }

  .product-item {
    width: 60px;
    height: 65px;
  }
}

/* Accessibility */
.artisan-slide:focus {
  outline: 3px solid #425eab;
  outline-offset: 2px;
}

.artisan-modal-close:focus {
  outline: 3px solid #fff4e4;
  outline-offset: -3px;
}

/* MicroModal Animations */
.micromodal-slide {
  display: none;
}

.micromodal-slide.is-open {
  display: block;
}

.micromodal-slide[aria-hidden="false"] .artisan-modal-overlay {
  animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide[aria-hidden="false"] .artisan-modal-container {
  animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide[aria-hidden="true"] .artisan-modal-overlay {
  animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide[aria-hidden="true"] .artisan-modal-container {
  animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide .artisan-modal-container,
.micromodal-slide .artisan-modal-overlay {
  will-change: transform;
}

@keyframes mmfadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mmfadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes mmslideIn {
  from {
    transform: translateY(15%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes mmslideOut {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(15%);
  }
}
