/* ========== TEMPLATES PAGE ========== */

/* Page header */
.page-header {
  padding: 50px 40px 30px;
  text-align: center;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.ph-blob {
  position: absolute;
  top: -40px; right: 10%;
  width: 300px; height: 300px;
  background: var(--c-yellow);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  pointer-events: none;
}
.ph-blob-2 {
  position: absolute;
  bottom: -80px; left: 15%;
  width: 350px; height: 350px;
  background: var(--c-green-soft);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  pointer-events: none;
}
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: white;
  background: var(--g-hero);
  padding: 7px 16px;
  border-radius: 100px;
  font-weight: 600;
  margin-bottom: 20px;
  box-shadow: var(--glow-green);
  position: relative;
  z-index: 2;
}
.page-header h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
  position: relative;
  z-index: 2;
}
.page-header h1 em {
  font-style: italic;
  background: var(--g-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 400;
}
.page-header p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(17px, 1.8vw, 21px);
  color: var(--c-ink-soft);
  line-height: 1.4;
  max-width: 640px;
  margin: 0 auto;
  font-weight: 300;
  position: relative;
  z-index: 2;
}

/* Toolbar */
.toolbar-wrap {
  max-width: 1280px;
  margin: 30px auto 0;
  padding: 0 40px;
  position: sticky;
  top: 90px;
  z-index: 50;
}
.toolbar {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 28px;
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--c-bg);
  border: 1.5px solid rgba(15,37,21,0.08);
  border-radius: 100px;
  transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--c-green); }
.search-box .si { color: var(--c-muted); font-size: 16px; }
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--c-ink);
}
.search-box input::placeholder { color: var(--c-muted); }
.filter-pills {
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--c-bg);
  padding: 4px;
  border-radius: 100px;
}
.pill {
  padding: 8px 14px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-ink-soft);
  transition: all .2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.pill.active { background: var(--g-hero); color: white; box-shadow: var(--glow-green); }
.pill:not(.active):hover { background: rgba(45,90,61,0.08); color: var(--c-green); }
.sort-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--c-bg);
  border: 1.5px solid rgba(15,37,21,0.08);
  border-radius: 100px;
  font-size: 13px;
  color: var(--c-ink-soft);
  cursor: pointer;
  font-weight: 500;
  position: relative;
  white-space: nowrap;
}
.sort-select strong { color: var(--c-ink); font-weight: 600; }
.sort-select select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* Category tabs */
.category-tabs {
  max-width: 1280px;
  margin: 20px auto 0;
  padding: 0 40px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: white;
  border: 1.5px solid rgba(15,37,21,0.1);
  border-radius: 100px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--c-ink-soft);
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.cat-pill .count { font-family: var(--font-mono); font-size: 11px; color: var(--c-muted); font-weight: 600; }
.cat-pill.active { background: var(--c-ink); color: white; border-color: var(--c-ink); }
.cat-pill.active .count { color: rgba(255,255,255,0.55); }
.cat-pill:hover:not(.active) { border-color: var(--c-green); color: var(--c-green); }

/* Templates section & grid */
.templates-section {
  max-width: 1280px;
  margin: 36px auto 0;
  padding: 0 40px 80px;
}
.tpl-grid-main { grid-template-columns: repeat(5, 1fr); gap: 20px; }

/* Card */
.tpl-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all .35s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
  position: relative;
  display: block;
}
.tpl-card:hover { transform: translateY(-8px); box-shadow: 0 30px 60px -15px rgba(15,37,21,0.22); }

.tpl-preview {
  aspect-ratio: 8.5/16;
  position: relative;
  overflow: hidden;
  background: var(--c-bg-soft);
}
.tpl-preview img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.tpl-card:hover .tpl-preview img { transform: scale(1.04); }

.tpl-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  font-weight: 500;
  color: white;
}
.tpl-ph-1 { background: var(--g-hero); }
.tpl-ph-2 { background: var(--g-deep); }
.tpl-ph-3 { background: var(--g-sunshine); color: var(--c-ink); }
.tpl-ph-4 { background: var(--g-purple); }

/* Hover overlay */
.tpl-actions {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,28,16,0.96) 0%, rgba(10,28,16,0.6) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 16px 18px;
  gap: 12px;
  opacity: 0;
  transition: opacity .3s;
  z-index: 10;
}
.tpl-card:hover .tpl-actions { opacity: 1; }

.tpl-overlay-info {
  transform: translateY(8px);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.tpl-card:hover .tpl-overlay-info { transform: translateY(0); }

.tpl-overlay-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: white;
  line-height: 1.2;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-overlay-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
}

.tpl-overlay-btns {
  display: flex;
  flex-direction: column;
  gap: 7px;
  transform: translateY(8px);
  transition: transform .3s cubic-bezier(.2,.8,.2,1) .06s;
}
.tpl-card:hover .tpl-overlay-btns { transform: translateY(0); }

.tpl-actions a {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform .2s;
  white-space: nowrap;
}
.tpl-actions a:hover { transform: translateY(-2px); }
.tpl-actions .use {
  background: var(--g-sunshine);
  color: var(--c-ink);
  box-shadow: var(--glow-yellow);
  border: none;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tpl-actions .preview {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(6px);
}

/* Badge */
.tpl-badge {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--g-hero);
  color: white;
  padding: 5px 11px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: var(--glow-green);
  z-index: 5;
}
.tpl-badge.free { background: var(--g-sunshine); color: var(--c-ink); box-shadow: var(--glow-yellow); }
.tpl-badge.new { background: var(--g-lime); color: var(--c-ink); box-shadow: var(--glow-lime); }
.tpl-badge.pro { background: var(--c-ink); box-shadow: 0 10px 20px -8px rgba(15,37,21,0.5); }

/* Info */
.tpl-info {
  padding: 18px 22px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.tpl-info h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.tpl-info h3 em { font-style: italic; color: var(--c-green); font-weight: 400; }
.tpl-info .meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
}
.tpl-info .meta .sep { color: rgba(15,37,21,0.2); }
.tpl-info .meta .likes { color: var(--c-green); }
.tpl-price {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  font-weight: 500;
  color: var(--c-green);
  line-height: 1;
  white-space: nowrap;
}
.tpl-price.free { color: var(--c-olive); }

.load-more-wrap { text-align: center; margin-top: 50px; display: flex; justify-content: center; }
.tpl-empty { text-align: center; color: var(--c-muted); font-style: italic; padding: 60px 0; font-family: var(--font-display); font-size: 20px; }

/* Responsive */
@media (max-width: 1024px) {
  .toolbar { grid-template-columns: 1fr; gap: 12px; }
  .filter-pills { overflow-x: auto; scrollbar-width: none; }
  .filter-pills::-webkit-scrollbar { display: none; }
  .toolbar-wrap, .category-tabs { padding: 0 24px; }
  .templates-section { padding: 0 24px 60px; }
  .page-header { padding: 40px 24px 24px; }
  .tpl-grid-main { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (max-width: 640px) {
  .toolbar-wrap { padding: 0 14px; top: 60px; }
  .toolbar { padding: 14px; border-radius: 22px; gap: 10px; }
  .category-tabs { padding: 0 14px; gap: 6px; margin-top: 14px; }
  .templates-section { padding: 0 14px 48px; margin-top: 24px; }
  .page-header { padding: 28px 16px 14px; }
  .tpl-grid-main { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tpl-actions { opacity: 1; }
  .tpl-overlay-info, .tpl-overlay-btns { transform: none; }
}
