/* Shared product card component — used by Outwear and Home */
/* Color swatch colors live in styles.css so detail pages share them too */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-grid[hidden] {
  display: none;
}

.product-tile {
  min-width: 0;
}

.product-tile.is-quick-card {
  cursor: pointer;
}

.tile-media {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(25, 25, 20, 0.05);
  border-radius: var(--radius-md);
  background: #fff;
  transition: transform var(--motion-base) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out),
              border-color var(--motion-base) var(--ease-out);
}

.tile-media img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  transition: transform var(--motion-slow) var(--ease-out);
}

@media (prefers-reduced-motion: no-preference) {
  .tile-media img {
    animation: tile-fade-in 460ms var(--ease-out);
  }
}

@keyframes tile-fade-in {
  from {
    opacity: 0;
    transform: scale(1.015);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (hover: hover) {
  .product-tile:hover .tile-media {
    border-color: rgba(25, 25, 20, 0.08);
    box-shadow: 0 16px 40px rgba(28, 28, 24, 0.07);
    transform: translateY(-3px);
  }

  .product-tile:hover .tile-media img {
    transform: scale(1.035);
  }
}

.tile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.tile-link:focus-visible {
  outline-offset: -5px;
  border-radius: 12px;
}

.tile-link.is-quick {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.tile-quick {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border-radius: 14px;
  background: rgba(23, 23, 20, 0.88);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
  pointer-events: none;
}

@media (hover: hover) {
  .tile-link.is-quick:hover .tile-quick,
  .tile-link.is-quick:focus-visible .tile-quick {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.tile-link.is-quick.is-added .tile-quick {
  opacity: 1;
  transform: translate(-50%, 0);
  background: #35644d;
}

.tile-badge {
  position: absolute;
  top: 13px;
  left: 13px;
  z-index: 2;
}

.tile-favorite {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 3;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(30, 30, 26, 0.03);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #5f5f59;
  box-shadow: 0 5px 16px rgba(32, 32, 28, 0.05);
  backdrop-filter: blur(8px);
  transition: transform var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out);
}

.tile-favorite svg {
  width: 18px;
  height: 18px;
}

@media (hover: hover) {
  .tile-favorite:hover {
    transform: translateY(-1px);
    background: #fff;
  }
}

.tile-favorite:active {
  transform: scale(0.94);
}

.tile-favorite.active {
  color: var(--orange);
}

.tile-favorite.active svg {
  fill: currentColor;
}

.tile-info {
  padding: 13px 4px 0;
}

.tile-category {
  color: #a0a099;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.tile-name {
  margin: 5px 0 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.tile-name-link {
  display: inline-block;
}

@media (hover: hover) {
  .tile-name-link:hover .tile-name {
    text-decoration: underline;
    text-decoration-color: #c7c7c1;
    text-underline-offset: 3px;
  }
}

.tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.tile-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tile-price {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.tile-colors {
  display: flex;
  gap: 5px;
}

.tile-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(20, 20, 16, 0.08);
}

.tile-add {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  color: #55554f;
  font-size: 10px;
  font-weight: 600;
  transition: color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
}

.tile-add svg {
  width: 13px;
  height: 13px;
}

@media (hover: hover) {
  .tile-add:hover {
    border-color: var(--ink);
    color: #fff;
    background: var(--ink);
  }
}

.tile-add:active {
  transform: scale(0.95);
}

.tile-add.is-added {
  border-color: #35644d;
  color: #fff;
  background: #35644d;
}

@media (max-width: 860px) {
    .product-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 26px 18px;
    }
}

@media (max-width: 560px) {
    .product-grid {
      gap: 22px 12px;
    }

    .tile-media {
      border-radius: 14px;
    }

    .tile-badge {
      top: 9px;
      left: 9px;
      height: 22px;
      padding: 0 9px;
      font-size: 9px;
    }

    .tile-favorite {
      top: 7px;
      right: 7px;
      width: 44px;
      height: 44px;
    }

    .tile-info {
      padding: 11px 1px 0;
    }

    .tile-name {
      font-size: 13px;
    }

    .tile-meta {
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
    }

    .tile-add {
      height: 44px;
      min-width: 62px;
      justify-content: center;
      padding: 0 12px;
      border-radius: 22px;
      font-size: 11px;
    }

    .tile-add svg {
      width: 14px;
      height: 14px;
    }
}

@media (max-width: 380px) {
    .product-grid {
      gap: 20px 10px;
    }

    .tile-add span {
      display: none;
    }

    .tile-add {
      min-width: 44px;
      width: 44px;
      padding: 0;
    }

    .tile-colors {
      display: none;
    }
}
