/* =========================================
   VARIABLES MAYU
========================================= */

:root {
  --mayu-bg: #fffaf6;
  --mayu-cream: #f4dcc7;
  --mayu-wine: #351622;
  --mayu-brown: #2b1200;
  --mayu-text: #1c1c1c;
  --mayu-muted: #6f6365;
  --mayu-white: #ffffff;
  --mayu-line: rgba(53, 22, 34, 0.12);
}


/* =========================================
   PÁGINA
========================================= */

.product-page {
  background: var(--mayu-bg);
  color: var(--mayu-text);
}


/* =========================================
   HEADER PÁGINAS DE PRODUCTO
========================================= */

.product-page .header {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: #fffaf6;

  border-bottom:
    1px solid
    rgba(53, 22, 34, 0.08);

  box-shadow:
    0 4px 18px
    rgba(53, 22, 34, 0.04);

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.product-page .header.scrolled {
  background: #fffaf6;

  box-shadow:
    0 4px 18px
    rgba(53, 22, 34, 0.06);
}


/* =========================================
   BREADCRUMB
========================================= */

.product-breadcrumb {
  padding: 24px 0 8px;

  font-size: 0.82rem;

  color: var(--mayu-muted);
}

.product-breadcrumb a {
  color: var(--mayu-wine);

  text-decoration: none;
}

.product-breadcrumb a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* =========================================
   SECCIÓN PRINCIPAL
========================================= */

.product-detail {
  padding:
    34px
    0
    70px;
}


/* Ancho máximo de la ficha */

.product-detail > .container {
  max-width: 1240px;
}


/* =========================================
   GRID PRINCIPAL
========================================= */

.product-detail-grid {
  display: grid;

  /*
    Foto más vertical.
    El lado izquierdo tiene un ancho
    máximo controlado para evitar
    que la imagen se vea demasiado horizontal.
  */

  grid-template-columns:
    minmax(340px, 460px)
    minmax(360px, 1fr);

  gap: clamp(
    46px,
    6vw,
    78px
  );

  align-items: center;
  justify-content: center;
}


/* =========================================
   IMAGEN PRINCIPAL
========================================= */

.product-detail-media {
  width: 100%;
  max-width: 460px;

  margin:
    0
    auto;

  /*
    Formato vertical
  */

  aspect-ratio: 4 / 5;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: transparent;

  border: 0;
  border-radius: 0;

  overflow: hidden;
}


/* Imagen sin bordes ni marco */

.product-detail-media img {
  width: 100%;
  height: 100%;

  display: block;

  /*
    Recorta ligeramente los lados
    para que la foto se vea más vertical
  */

  object-fit: cover;
  object-position: center;

  border: 0;
  border-radius: 0;

  filter: none;
}


/* =========================================
   INFORMACIÓN DEL PRODUCTO
========================================= */

.product-detail-copy {
  width: 100%;
  max-width: 570px;
}


/* =========================================
   CATEGORÍA
========================================= */

.product-kicker {
  display: inline-block;

  margin-bottom: 12px;

  font-size: 0.76rem;
  font-weight: 800;

  letter-spacing: 0.14em;

  text-transform: uppercase;

  color: var(--mayu-wine);
}


/* =========================================
   TÍTULO
========================================= */

.product-detail-copy h1 {
  margin: 0;

  max-width: 570px;

  color: var(--mayu-brown);

  font-size: clamp(
    2.2rem,
    4vw,
    3.8rem
  );

  line-height: 1.03;

  letter-spacing: -0.045em;
}


/* =========================================
   PRECIO
========================================= */

.product-price {
  display: block;

  margin:
    20px
    0
    18px;

  color: var(--mayu-wine);

  font-size: 1.9rem;
  font-weight: 800;
}


/* =========================================
   DESCRIPCIÓN
========================================= */

.product-description {
  max-width: 570px;

  margin: 0;

  color: #55494b;

  font-size: 1rem;

  line-height: 1.75;
}


/* =========================================
   TAGS
========================================= */

.product-tags {
  display: flex;

  gap: 10px;

  flex-wrap: wrap;

  margin:
    24px
    0
    30px;
}


.product-tags span {
  padding:
    8px
    13px;

  background: var(--mayu-white);

  border:
    1px solid
    var(--mayu-line);

  border-radius: 999px;

  color: var(--mayu-wine);

  font-size: 0.82rem;
  font-weight: 700;
}


/* =========================================
   BOTONES
========================================= */

.product-actions {
  display: flex;

  gap: 12px;

  flex-wrap: wrap;

  align-items: center;
}


.product-primary,
.product-secondary {
  min-height: 48px;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 9px;

  padding:
    13px
    20px;

  border-radius: 999px;

  font-family: inherit;
  font-weight: 800;

  text-decoration: none;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}


/* Agregar al pedido */

.product-primary {
  border:
    1px solid
    var(--mayu-wine);

  background:
    var(--mayu-wine);

  color:
    #ffffff;
}

.product-primary:hover {
  transform:
    translateY(-1px);
}


/* WhatsApp */

.product-secondary {
  border:
    1px solid
    var(--mayu-wine);

  background:
    transparent;

  color:
    var(--mayu-wine);
}

.product-secondary:hover {
  background:
    var(--mayu-cream);

  transform:
    translateY(-1px);
}


/* Deshabilitado */

.product-primary:disabled {
  opacity: 0.55;

  cursor: not-allowed;

  transform: none;
}


/* =========================================
   NOTA DE STOCK
========================================= */

.product-stock-note {
  display: block;

  margin-top: 14px;

  color: var(--mayu-muted);

  font-size: 0.82rem;

  line-height: 1.5;
}


/* =========================================
   DATOS DEL PRODUCTO
========================================= */

.product-trust {
  margin-top: 34px;

  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  border-top:
    1px solid
    var(--mayu-line);

  border-bottom:
    1px solid
    var(--mayu-line);
}


.product-trust div {
  padding:
    18px
    16px;
}


.product-trust div:first-child {
  padding-left: 0;
}


.product-trust strong,
.product-trust span {
  display: block;
}


.product-trust strong {
  margin-bottom: 4px;

  color: var(--mayu-brown);

  font-size: 0.9rem;
}


.product-trust span {
  color: var(--mayu-muted);

  font-size: 0.82rem;

  line-height: 1.4;
}


/* =========================================
   PRODUCTOS RELACIONADOS
========================================= */

.related-products {
  padding:
    68px
    0
    85px;

  background:
    #ffffff;
}


/* =========================================
   CABECERA RELACIONADOS
========================================= */

.related-heading {
  max-width: 670px;

  margin-bottom: 30px;
}


.related-heading h2 {
  margin:
    5px
    0
    10px;

  color: var(--mayu-brown);

  font-size: clamp(
    1.7rem,
    3vw,
    2.6rem
  );
}


.related-heading p {
  margin: 0;

  color: var(--mayu-muted);

  line-height: 1.65;
}


/* =========================================
   GRID RELACIONADOS - DESKTOP
========================================= */

.related-grid {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      minmax(0, 1fr)
    );

  gap: 18px;
}


/* =========================================
   TARJETA RELACIONADA
========================================= */

.related-card {
  display: flex;

  flex-direction: column;

  min-width: 0;

  min-height: 170px;

  padding: 22px;

  color: inherit;

  text-decoration: none;

  border:
    1px solid
    var(--mayu-line);

  border-radius: 22px;

  background:
    var(--mayu-bg);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}


.related-card:hover {
  transform:
    translateY(-3px);

  border-color:
    rgba(
      53,
      22,
      34,
      0.22
    );

  box-shadow:
    0 16px 34px
    rgba(
      53,
      22,
      34,
      0.08
    );
}


/* Categoría */

.related-card small {
  display: block;

  margin-bottom: 6px;

  color: var(--mayu-muted);

  font-size: 0.8rem;

  line-height: 1.4;
}


/* Nombre */

.related-card h3 {
  margin:
    0
    0
    8px;

  color: var(--mayu-brown);

  font-size: 1.15rem;

  line-height: 1.25;
}


/* Precio */

.related-card strong {
  display: block;

  margin-bottom: 14px;

  color: var(--mayu-wine);

  font-size: 1rem;
}


/* CTA automático */
.related-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 22px 0px;
}

.related-card::after {
  content: "Ver sabor →";

  display: block;

  margin-top: 14px;

  padding:
    0
    22px
    22px;

  color: var(--mayu-wine);

  font-size: 0.82rem;
  font-weight: 700;

  transition: transform 0.2s ease;
}

.related-card:hover::after {
  transform: translateX(3px);
}

/* =========================================
   CARRITO DEL HEADER
========================================= */

.product-cart-link {
  position: relative;
}


.product-cart-count {
  min-width: 20px;
  height: 20px;

  display: inline-grid;

  place-items: center;

  padding:
    0
    5px;

  border-radius: 999px;

  background:
    var(--mayu-cream);

  color:
    var(--mayu-brown);

  font-size: 0.72rem;

  font-weight: 800;
}


/* =========================================
   TOAST
========================================= */

.product-toast {
  position: fixed;

  left: 50%;

  bottom: 28px;

  z-index: 9999;

  transform:
    translate(
      -50%,
      24px
    );

  padding:
    12px
    18px;

  border-radius: 999px;

  background:
    var(--mayu-brown);

  color:
    #ffffff;

  opacity: 0;

  pointer-events: none;

  transition:
    0.2s ease;
}


.product-toast.show {
  opacity: 1;

  transform:
    translate(
      -50%,
      0
    );
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 1000px) {

  .product-detail-grid {
    grid-template-columns:
      minmax(320px, 420px)
      minmax(330px, 1fr);

    gap: 38px;
  }


  .product-detail-media {
    max-width: 420px;
  }


  .product-detail-copy h1 {
    font-size: clamp(
      2rem,
      4.5vw,
      3.2rem
    );
  }

}


/* =========================================
   TABLET / CELULAR
========================================= */

@media (max-width: 850px) {

  /* ===============================
     PRODUCTO
  =============================== */

  .product-detail {
    padding:
      24px
      0
      55px;
  }


  .product-detail-grid {
    grid-template-columns:
      1fr;

    gap: 32px;
  }


  .product-detail-media {
    width: 100%;

    max-width: 520px;

    aspect-ratio: 4 / 5;

    margin:
      0
      auto;
  }


  .product-detail-media img {
    width: 100%;
    height: 100%;
  }


  .product-detail-copy {
    max-width: 100%;
  }


  .product-detail-copy h1 {
    max-width: 100%;

    font-size: clamp(
      2rem,
      9vw,
      3rem
    );
  }


  /* ===============================
     BOTONES
  =============================== */

  .product-actions {
    display: grid;

    grid-template-columns:
      1fr;

    gap: 10px;
  }


  .product-primary,
  .product-secondary {
    width: 100%;
  }


  /* ===============================
     DATOS
  =============================== */

  .product-trust {
    grid-template-columns:
      1fr;

    margin-top: 28px;
  }


  .product-trust div {
    padding:
      14px
      0;

    border-bottom:
      1px solid
      var(--mayu-line);
  }


  .product-trust div:last-child {
    border-bottom: 0;
  }


  /* ===============================
     PRODUCTOS RELACIONADOS
  =============================== */

  .related-products {
    padding:
      52px
      0
      65px;

    overflow: hidden;
  }


  .related-heading {
    margin-bottom: 24px;
  }


  /*
    Carrusel horizontal.
    Se muestra una tarjeta completa
    y parte de la siguiente.
  */

  .related-grid {
    display: flex;

    gap: 14px;

    overflow-x: auto;
    overflow-y: hidden;

    padding:
      0
      24px
      14px
      0;

    scroll-snap-type:
      x mandatory;

    scroll-padding-left:
      0;

    -webkit-overflow-scrolling:
      touch;

    scrollbar-width:
      none;
  }


  .related-grid::-webkit-scrollbar {
    display: none;
  }


  .related-card {
    flex:
      0
      0
      72%;

    min-width: 0;

    min-height: 180px;

    padding: 20px;

    scroll-snap-align:
      start;
  }

}


/* =========================================
   CELULAR
========================================= */

@media (max-width: 520px) {

  /* ===============================
     BREADCRUMB
  =============================== */

  .product-breadcrumb {
    padding-top: 18px;

    font-size: 0.76rem;
  }


  /* ===============================
     FOTO
  =============================== */

  .product-detail-media {
    max-width: 100%;

    aspect-ratio:
      4 / 5;
  }


  /* ===============================
     TÍTULO / PRECIO
  =============================== */

  .product-detail-copy h1 {
    font-size: 2.1rem;
  }


  .product-price {
    font-size: 1.65rem;
  }


  .product-description {
    font-size: 0.95rem;
  }


  /* ===============================
     TAGS
  =============================== */

  .product-tags {
    gap: 7px;

    margin:
      20px
      0
      24px;
  }


  .product-tags span {
    padding:
      7px
      11px;

    font-size:
      0.76rem;
  }


  /* ===============================
     RELACIONADOS
  =============================== */

  .related-products {
    padding:
      46px
      0
      58px;
  }


  .related-heading h2 {
    font-size:
      1.75rem;
  }


  .related-heading p {
    font-size:
      0.95rem;
  }


  .related-grid {
    gap: 12px;

    padding-right:
      18px;
  }


  /*
    Una tarjeta casi completa
    + parte de la siguiente
  */

  .related-card {
    flex-basis:
      78%;

    min-height:
      175px;

    padding:
      18px;

    border-radius:
      20px;
  }


  .related-card h3 {
    font-size:
      1.08rem;
  }


  .related-card strong {
    font-size:
      0.95rem;
  }

}


/* =========================================
   CELULARES PEQUEÑOS
========================================= */

@media (max-width: 380px) {

  .related-card {
    flex-basis:
      82%;
  }

}