/* Girl's Boutique — Components
   Button, product card, badge, input. Read from tokens.css. */

/* ======================= Buttons ======================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 46px;
  padding: 0 var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}

/* No scaling/lift on hover — feedback comes from the outline→fill swap */

.btn--primary {
  background: transparent;
  border-color: var(--c-bg);
  color: var(--c-bg);
}

.btn--primary:hover {
  background: var(--c-pink);
  border-color: var(--c-pink); /* outline matches fill — clean all-pink pill, no white ring */
  color: var(--c-ink); /* dark text + arrow (currentColor) read on the pink fill */
}

/* Chunky arrow icon inside buttons (replaces the thin → glyph).
   Knobs: --arrow-w (width) and the SVG stroke-width. */
.btn__arrow {
  width: 38px;   /* 28px + 10px */
  height: 16px;
  flex: none;
  margin-left: 0.1em;
}

/* Shrink the chunky arrow so it doesn't dominate buttons on small screens */
@media (max-width: 480px) {
  .btn__arrow { width: 28px; height: 12px; }
}

/* fase 6a: was a weak "blush tint" hover (background: var(--c-blush-soft))
   that barely read as feedback. Now matches the same outline→fill swap as
   .btn--primary — pink outline fills solid pink, text flips to ink. */
.btn--outline {
  background: transparent;
  border-color: var(--c-pink);
  color: var(--c-pink);
}

.btn--outline:hover {
  background: var(--c-pink);
  border-color: var(--c-pink);
  color: var(--c-ink);
}

.btn--ink {
  background: var(--c-ink);
  color: var(--c-white);
}

.btn--ink:hover {
  background: oklch(0.12 0.02 358);
}

.btn--ghost {
  background: transparent;
  color: var(--c-ink);
}

.btn--ghost:hover {
  background: var(--c-blush-soft);
}

.btn--lg {
  min-height: 54px;
  font-size: var(--fs-base);
  padding: 0 var(--space-6);
}

.btn--sm {
  min-height: 36px;
  font-size: var(--fs-xs);
  padding: 0 var(--space-4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ======================= Product card ======================= */
/* Card is a padded frame; the photo lives in an inner rounded frame and
   scales on hover (the frame itself stays put). */
.card {
  position: relative;
  background: var(--c-bg);
  border: 0.5px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-blush-soft);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease-out-expo);
}

/* Only the photo scales, contained by the inner frame */
.card:hover .card__media img {
  transform: scale(1.15);
}

.card__body {
  padding: var(--space-3) var(--space-1) var(--space-1);
}

/* Hierarchy: name (lead) > price > brand (least) */
.card__name {
  font-family: var(--font-ui);
  font-weight: var(--fw-black); /* +200 from --fw-bold (600 → 800) */
  font-size: var(--fs-card-name);
  margin-block: 0 var(--space-1);
  letter-spacing: -0.01em;
}

.card__price {
  display: block;
  font-size: 16px;
  font-weight: var(--fw-bold);
  color: var(--c-ink);
}

.card__price--old {
  text-decoration: line-through;
  color: var(--c-ink-soft);
  font-weight: var(--fw-regular);
  font-size: 14px;
  margin-left: var(--space-2);
}

.card__brand {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--c-ink-soft);
  text-transform: lowercase;
  letter-spacing: 0.01em;
  margin-top: var(--space-1);
}

/* Inner link wraps media + body; wishlist button is its sibling */
.card__link { display: block; color: inherit; }
.card__link:hover { text-decoration: none; }

/* Wishlist toggle, top-right inside the media zone */
.card__wishlist {
  position: absolute;
  top: calc(var(--space-3) + 10px);
  right: calc(var(--space-3) + 10px);
  z-index: 2;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-pill);
  background: oklch(0.99 0.002 358 / 0.85);
  color: var(--c-ink);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}

.card__wishlist:hover { color: var(--c-pink); } /* heart turns pink only — keep the resting translucent chip */
.card__wishlist svg { width: 20px; height: 20px; }
.card__wishlist[aria-pressed="true"] { color: var(--c-pink); }
.card__wishlist[aria-pressed="true"] svg { fill: var(--c-pink); }

/* Badge overlaid on media (top-left) */
.card__media .badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 1;
}

/* ======================= Product grid ======================= */
.product-grid {
  display: grid;
  gap: var(--space-7) var(--space-6);
  grid-template-columns: repeat(2, 1fr); /* phones: two per row */
}

@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Phone 2-col layout: shorter photo frame (~25px less card height) and
   tighter spacing between cards (the desktop 48px row gap is too airy here). */
@media (max-width: 639px) {
  .product-grid { gap: var(--space-5) var(--space-4); }
  .product-grid .card__media { aspect-ratio: 1 / 1.05; }

  /* Keep card bodies a consistent height (2-line name) so the heart anchors cleanly */
  .product-grid .card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Smaller sale badge so it never crowds the corner */
  .product-grid .card__media .badge {
    font-size: 11px;
    padding: 2px var(--space-2);
  }

  /* Heart: smaller and moved to the photo's bottom-right, clear of the top-left
     badge. Anchored to the PHOTO's geometry (not the card bottom) so it stays a
     constant 12px above the photo edge even when a card body is taller — e.g. a
     discount card whose old price wraps to a second line.
       photo height = card content width (100cqi) × 1.05 (the photo aspect)
       top = 12px card padding + photoHeight − 36px heart − 12px inset           */
  .product-grid .card { container-type: inline-size; }
  .product-grid .card__wishlist {
    top: calc(100cqi * 1.05 - 36px);
    bottom: auto;
    right: 18px;
    width: 36px;
    height: 36px;
  }
  .product-grid .card__wishlist svg { width: 18px; height: 18px; }
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1440px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

.card.is-hidden { display: none; }

/* Heart removed from cards: an item can only be added to the wishlist from the
   product detail page (where size + colour are chosen), so the card heart had
   no real action. Re-enable here if a quick-add flow is added later. */
.card__wishlist { display: none !important; }

/* ======================= Filter chips ======================= */
/* Canonical .chip — used on brand catalog pages (brand.css) and the
   "Ver todo" search page (contenido.css). Pressed state matches the ink-fill
   pattern shared by .size-chip / .af-chip / .brand-tab (was pink-fill, an
   inconsistency found in the fase 6a styleguide review). */
.chip {
  appearance: none;
  cursor: pointer;
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--c-line);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--c-ink);
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  transition: var(--transition);
}

.chip:hover { border-color: var(--c-ink); }

.chip[aria-pressed="true"] {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-white);
}

/* ======================= Badges ======================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: var(--fw-black); /* +200 from --fw-bold (600 → 800) */
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--brand {
  background: var(--c-pink);
  color: var(--c-ink);
}

.badge--sale {
  background: var(--c-pink);
  color: var(--c-ink);
}

.badge--low {
  background: oklch(0.95 0.06 75);
  color: var(--c-warn);
}

.badge--out {
  background: var(--c-line);
  color: var(--c-ink-soft);
}

/* ======================= Inputs ======================= */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--c-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder {
  color: var(--c-ink-soft);
}

.input:focus {
  outline: none;
  border-color: var(--c-pink);
  box-shadow: 0 0 0 3px var(--c-blush);
}

/* ======================= Sold-out state ======================= */
/* Maps to products.status = out_of_stock */
.card--soldout .card__media img {
  opacity: 0.5;
  filter: grayscale(0.35);
}

.card--soldout .card__name,
.card--soldout .card__price {
  color: var(--c-ink-soft);
}

.card__soldout {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}

.card__soldout span {
  padding: var(--space-2) var(--space-4);
  background: var(--c-ink);
  color: var(--c-white);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ======================= Empty state ======================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-9) var(--space-5);
  color: var(--c-ink-soft);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--c-pink);
}

.empty-state__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xl);
  color: var(--c-ink);
}

.empty-state p {
  max-width: 42ch;
}

/* ======================= Skeleton (loading) ======================= */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--c-blush-soft);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.55), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.skeleton-card .skeleton--media {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
}

.skeleton-line {
  height: 0.7em;
  margin-top: var(--space-2);
}

.skeleton-line.is-sm { width: 40%; }
.skeleton-line.is-lg { width: 75%; }

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}
