.templates-page {
  background:
    linear-gradient(180deg, rgba(255, 248, 243, .92), rgba(255, 255, 255, .95) 18%),
    var(--bg);
}

.templates-hero {
  padding: 34px 0 16px;
  text-align: center;
}

.templates-hero h1 {
  margin: 10px 0 0;
  color: var(--ink-heading);
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.12;
}

.template-category {
  padding: 24px 0 34px;
}

.template-category + .template-category {
  border-top: 1px solid rgba(234, 216, 207, .55);
}

.template-category-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.template-category-head h2 {
  margin: 8px 0 0;
  color: var(--ink-heading);
  font-size: clamp(26px, 2.5vw, 34px);
  line-height: 1.15;
}

.template-showcase-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  overflow: visible;
}

.templates-page .product-card {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  gap: 10px;
  border-radius: 20px;
  overflow: visible;
}

.templates-page .product-media {
  width: 100%;
  padding: 8px;
  overflow: visible;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffdfb, #fff4f8);
}

.templates-page .product-card.sticker .product-media,
.templates-page .product-card.storybook .product-media {
  aspect-ratio: 1 / 1.18;
}

.templates-page .product-card.name-slip .product-media {
  aspect-ratio: 16 / 10;
}

.templates-page .product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.templates-page .product-card h3 {
  margin: 0;
  color: var(--ink-heading);
  font-size: 16px;
  line-height: 1.22;
  text-align: center;
  overflow-wrap: anywhere;
}

.templates-page .card-actions {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: auto;
}

.templates-page .card-actions .btn {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

.templates-view-all {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.templates-view-all .btn {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 28px rgba(229, 111, 142, .2);
}

.templates-coming-soon {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 22px;
  border: 1px dashed rgba(229, 111, 142, .48);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(255, 241, 247, .58));
  text-align: center;
}

.templates-coming-soon span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(229, 111, 142, .12);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 900;
}

.templates-coming-soon strong {
  color: var(--ink-heading);
  font-size: 24px;
  line-height: 1.15;
}

.templates-coming-soon p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1023px) {
  .template-showcase-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .templates-page .product-card {
    padding: 9px;
    border-radius: 17px;
  }

  .templates-page .product-card h3 {
    font-size: 14px;
  }

  .templates-page .card-actions .btn {
    min-height: 36px;
    font-size: 12px;
  }
}

@media (max-width: 767px) {
  .templates-hero {
    padding: 26px 0 10px;
  }

  .template-category {
    padding: 20px 0 28px;
  }

  .template-category-head {
    margin-bottom: 14px;
  }

  .template-showcase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .templates-page .product-media {
    padding: 6px;
    border-radius: 13px;
  }
}
