/* ================================================
   POLINO — Catalog Page Styles
   ================================================ */

@import './variables.css';

/* Page hero bar */
.catalog-page { padding-top: calc(var(--header-height) + var(--space-16)); }

.catalog-hero {
  text-align: center;
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--paper);
  margin-bottom: var(--space-12);
}

.catalog-hero h1 {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  color: var(--olive-dark);
  margin-top: var(--space-3);
}

.catalog-hero p {
  max-width: 50ch;
  margin-inline: auto;
  margin-top: var(--space-4);
}

/* Filter tabs */
.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-10);
}

.filter-btn {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--paper);
  color: var(--text-light);
  background: transparent;
  cursor: pointer;
  transition:
    background-color var(--duration-base) var(--ease-out),
    color            var(--duration-base) var(--ease-out),
    border-color     var(--duration-base) var(--ease-out);
}

.filter-btn:hover {
  border-color: var(--terra);
  color: var(--terra);
}

.filter-btn.active {
  background: var(--olive-deep);
  border-color: var(--olive-deep);
  color: var(--white-mosaic);
}

/* Product grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1024px) { .catalog-grid { grid-template-columns: repeat(2, 1fr); } }
/* The phone layout lives at the foot of this file — the card rules below set
   their own `display`, and an override up here loses to them on source order. */

/* Product card */
.catalog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--card-accent, var(--olive-dark));
  box-shadow: var(--shadow-sm);
  transition:
    transform   var(--duration-base) var(--ease-out),
    box-shadow  var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
  opacity: 0;
  transform: translateY(20px);
}

.catalog-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity    var(--duration-slow) var(--ease-out),
    transform  var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.catalog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--card-accent, var(--terra)) 24%, transparent);
  border-color: var(--card-border);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .catalog-card:hover { box-shadow: var(--shadow-lg); }
}

.catalog-card__img-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  flex: none;            /* keep the square crop even when the body runs tall */
}

/* Tessera swatch — mini 2x2 tile chip, the category's color signature */
.catalog-card__swatch {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  width: 30px;
  height: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: rgba(247, 241, 230, 0.92);
  border: 1px solid rgba(38, 48, 31, 0.08);   /* holds its edge over any photo */
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  transition: transform var(--duration-base) var(--ease-spring);
}
.catalog-card__swatch span { background: var(--card-accent, var(--olive-dark)); border-radius: 1px; }
.catalog-card__swatch span:nth-child(1) { opacity: 1;    }
.catalog-card__swatch span:nth-child(2) { opacity: 0.65; }
.catalog-card__swatch span:nth-child(3) { opacity: 0.45; }
.catalog-card__swatch span:nth-child(4) { opacity: 0.85; }

.catalog-card:hover .catalog-card__swatch { transform: scale(1.12) rotate(-4deg); }

.catalog-card__category {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--card-accent, var(--teal-deep));
  margin-bottom: var(--space-2);
}

.catalog-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slower) var(--ease-out);
  display: block;
}

.catalog-card:hover .catalog-card__img { transform: scale(1.06); }

.catalog-card__placeholder {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(
    from 0deg,
    color-mix(in srgb, var(--card-accent, var(--olive-dark)) 16%, var(--card-bg)) 0deg 90deg,
    color-mix(in srgb, var(--card-accent, var(--olive-dark)) 8%, var(--card-bg)) 90deg 180deg
  );
  background-size: 34px 34px;
}

.catalog-card__placeholder span {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: color-mix(in srgb, var(--card-accent, var(--olive-dark)) 60%, var(--olive-dark));
  background: rgba(247, 241, 230, 0.9);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .catalog-card__placeholder { background: var(--paper); }
  .catalog-card__placeholder span { color: var(--text-light); }
}

.catalog-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.catalog-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--olive-dark);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
  /* Etsy titles are long and keyword-stuffed. Clamp to two lines and reserve
     that height so every card in a row keeps the same rhythm. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * var(--text-xl) * var(--leading-snug));
}

.catalog-card__desc {
  font-size: var(--text-sm);
  color: var(--text-light);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;          /* pins prices to one line across the whole row */
  padding-top: var(--space-4);
}

.catalog-card__price {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--olive-dark);
  /* Cormorant ships old-style figures — prices need aligned lining numerals. */
  font-variant-numeric: lining-nums tabular-nums;
  background: rgba(38, 48, 31, 0.06);
  padding: 3px var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.catalog-card__link {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--card-accent, var(--olive));
  transition: opacity var(--duration-base);
  text-decoration: none;
  padding: var(--space-3) 0;   /* transparent padding — a real tap target */
  text-align: right;
}

.catalog-card__link:hover { opacity: 0.75; }

/* The title is the card's real link; the photo above it repeats the same
   destination, so only this one and the CTA take a tab stop. */
.catalog-card__title-link {
  color: inherit;
  text-decoration: none;
}

.catalog-card__title-link:hover { color: var(--card-accent, var(--terra)); }

/* Keyboard focus — the card's links had no visible indicator */
.catalog-card__img-wrap:focus-visible,
.catalog-card__title-link:focus-visible,
.catalog-card__link:focus-visible {
  outline: 2px solid var(--card-accent, var(--terra));
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Empty state */
.catalog-empty {
  text-align: center;
  padding: var(--space-24) var(--space-8);
  grid-column: 1 / -1;
}

.catalog-empty h1,
.catalog-empty h3 { color: var(--olive-dark); margin-bottom: var(--space-3); }
.catalog-empty .btn { margin-top: var(--space-4); }

/* Loading skeleton */
.catalog-skeleton {
  background: linear-gradient(90deg, var(--paper) 25%, var(--white-mosaic) 50%, var(--paper) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer { from{background-position:200% 0} to{background-position:-200% 0} }
.skeleton-img  { aspect-ratio:1/1; }
.skeleton-body { padding:var(--space-5); display:flex; flex-direction:column; gap:var(--space-3); }
.skeleton-line { height:14px; border-radius:var(--radius-sm); }
.skeleton-line.short { width:40%; }
.skeleton-line.medium{ width:65%; }

/* ================================================
   PHONE LAYOUT
   Two up rather than one. Sixty-two products in a single column ran to nearly
   45 screens of scroll, and it broke the rhythm too: the homepage preview is
   two up, so tapping through to the full catalogue changed the shape of the
   grid under the reader. Placed last on purpose — the card rules above set
   their own `display`, and at equal specificity source order decides.
   ================================================ */
@media (max-width: 480px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }

  .catalog-card__body { padding: var(--space-3); }
  .catalog-card__title {
    font-size: var(--text-base);
    min-height: calc(2 * var(--text-base) * var(--leading-snug));
  }
  /* At roughly 155px wide a clipped two-line blurb is noise, not information;
     the photo and title carry the card and the product page has the copy. */
  .catalog-card__desc { display: none; }
  /* Price and link side by side would squeeze both at this width. */
  .catalog-card__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    padding-top: var(--space-3);
  }
  .catalog-card__link {
    text-align: left;
    display: flex;
    align-items: center;
    min-height: 44px;        /* the tightened padding left it at 41px */
  }
  .catalog-card__swatch {
    width: 24px; height: 24px;
    top: var(--space-2); left: var(--space-2);
  }
}
