:root {
  --accent: var(--majorelle-blue, #5b53e9);
  --muted: #6b6b73;
  --card-bg: #fff;
  --radius: 12px;
  --text: var(--raisin-black-1, #111);
}
main {
  margin-top: 80px;
}
/* Scope to templates page */
.templates-page .templates-hero {
  padding: 64px 0 18px;
  text-align: center;
}
.templates-page .templates-filters {
  padding: 18px 0;
}
.templates-page .filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.templates-page .filter-btn {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid rgba(10, 10, 10, 0.06);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.templates-page .filter-btn.active {
  background: linear-gradient(
    90deg,
    rgba(91, 83, 233, 0.08),
    rgba(91, 83, 233, 0.02)
  );
  box-shadow: 0 10px 30px rgba(91, 83, 233, 0.06);
  transform: translateY(-2px);
}

/* ===== Uniform, compact 2-up grid + ordered sections =====
   - Desktop: 2 cards per row
   - Mobile: 1 card per row
   - Site templates (landing + ecommerce) are shown first (top)
   - Flyers / Logos / other services are smaller and pushed to the bottom
*/
.templates-page .templates-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 per row */
  gap: 16px;
  align-items: start;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  max-width: 1100px;
}

/* Cancel previous spanning rules so all cards are uniform */
.templates-page .templates-grid > .template-item,
.templates-page .templates-grid > .template-item.featured,
.templates-page .templates-grid > .template-item.small {
  grid-column: auto !important;
}

/* Order: show site templates first, push non-site to the end */
.templates-page .template-item[data-category="ecommerce"],
.templates-page .template-item[data-category="landing"] {
  order: 1; /* top */
}
.templates-page .template-item[data-category="flyer"],
.templates-page .template-item[data-category="logo"],
.templates-page .template-item[data-category="service"] {
  order: 2; /* bottom */
}

/* Card container: compact, no heavy shadow, subtle border */
.templates-page .template-item {
  background: var(--card-bg, #fff);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  border: 1px solid rgba(15, 23, 42, 0.04);
  transition: transform 0.12s ease;
  will-change: transform;
}

/* Slight, subtle hover */
.templates-page .template-item:hover {
  transform: translateY(-4px);
}

/* Figures: differentiate sizes by type */
.templates-page .template-figure.site {
  aspect-ratio: 16/9; /* primary site preview size */
  border-radius: 8px;
  overflow: hidden;
  background: #f6f7fb;
  margin-bottom: 8px;
}

.templates-page .template-figure.service {
  aspect-ratio: 4/3; /* rectangular service preview, smaller visual footprint */
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.templates-page .template-figure.flyer {
  aspect-ratio: 3/4; /* vertical flyer but reduced size */
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* Logos: small square cards, keep compact and centered */
.templates-page .template-figure.logo {
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #fff;
  border: 1px dashed rgba(15, 23, 42, 0.06);
  margin-bottom: 8px;
}
.templates-page .template-figure.logo img {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* Text: compact & clear */
.templates-page .template-body,
.templates-page .tmpl-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.templates-page .template-title,
.templates-page .tmpl-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.templates-page .template-desc,
.templates-page .tmpl-desc {
  margin: 0;
  color: #6b7280;
  font-size: 13.5px;
  line-height: 1.45;
}

/* Live demo: visible but unobtrusive */
.templates-page .template-figure .live-btn,
.templates-page .tmpl-figure .live-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

/* ===== Responsive: single column on smaller devices ===== */
@media (max-width: 900px) {
  .templates-page .templates-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 0 16px;
  }

  /* Increase logo image a little for touch devices */
  .templates-page .template-figure.logo img {
    max-width: 140px;
    max-height: 140px;
  }

  /* Slightly larger text on medium/small screens */
  .templates-page .template-title {
    font-size: 16px;
  }
  .templates-page .template-desc {
    font-size: 14px;
  }
}

/* Very small screens: reduce paddings */
@media (max-width: 420px) {
  .templates-page .template-item {
    padding: 10px;
  }
  .templates-page .template-figure.logo img {
    max-width: 96px;
    max-height: 96px;
  }
  .templates-page .template-title {
    font-size: 15px;
  }
  .templates-page .template-desc {
    font-size: 13px;
  }
}

/* Accessibility focus */
.templates-page .template-link:focus {
  outline: 3px solid rgba(91, 83, 233, 0.12);
  outline-offset: 3px;
  border-radius: 10px;
}

/* Small helper */
.templates-page .card-text {
  font-size: 1rem;
  color: var(--muted);
}

/* If you don't have the sample images, these filenames are expected in images/:
   - images/template-ecom-1.jpg
   - images/template-ecom-2.jpg
   - images/template-landing-1.jpg
   - images/template-landing-2.jpg
   - images/logo-placeholder-1.png
   - images/logo-placeholder-2.png
   Replace with your own images or update paths in templates.html */
