/* Templates hub — Athenous indigo catalog UX */
.tpl-page {
  --tpl-ink: var(--midnight, #0f172a);
  --tpl-muted: var(--color-text-secondary, #64748b);
  --tpl-line: rgba(15, 23, 42, 0.1);
  --tpl-accent: var(--color-primary, #6366f1);
  --tpl-accent-strong: var(--color-primary-hover, #4f46e5);
  --tpl-soft: var(--sand, #f8fafc);
  --tpl-card: #ffffff;
  font-family: "Inter", "Sora", system-ui, sans-serif;
  color: var(--tpl-ink);
}

.tpl-page .landing-main {
  background:
    radial-gradient(900px 420px at 14% -8%, rgba(99, 102, 241, 0.1), transparent 55%),
    radial-gradient(720px 360px at 90% 4%, rgba(79, 70, 229, 0.06), transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #ffffff 38%, #ffffff 100%);
}

.tpl-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: rgba(255, 255, 255, 0.9);
  color: var(--tpl-accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tpl-kicker--inline {
  margin-bottom: 10px;
}

.tpl-kicker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tpl-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* —— Hero (one job: brand + promise + CTA) —— */
.tpl-hero {
  padding: 48px 24px 28px;
}

.tpl-hero-inner {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

.tpl-title {
  margin: 0 0 0.85rem;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--tpl-ink);
  text-wrap: balance;
}

.tpl-lead {
  margin: 0 auto 1.35rem;
  max-width: 32rem;
  font-size: clamp(1.02rem, 2vw, 1.15rem);
  line-height: 1.5;
  color: var(--tpl-muted);
  font-weight: 500;
}

.tpl-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.tpl-hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tpl-hero-stats li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--tpl-muted);
}

.tpl-hero-stats strong {
  font-family: "Sora", sans-serif;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--tpl-ink);
  letter-spacing: -0.02em;
}

/* —— Popular strip —— */
.tpl-featured {
  padding: 0 24px 20px;
}

.tpl-featured-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--tpl-line);
  backdrop-filter: blur(8px);
}

.tpl-featured-label {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tpl-muted);
  text-align: center;
}

.tpl-featured-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tpl-featured-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tpl-line);
  text-decoration: none;
  color: var(--tpl-ink);
  font-size: 0.88rem;
  font-weight: 650;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.tpl-featured-chip:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.tpl-featured-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--tpl-accent-strong);
  background: rgba(99, 102, 241, 0.1);
}

.tpl-featured-ico svg { width: 14px; height: 14px; }
.tpl-featured-ico[data-cat="content"] { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.tpl-featured-ico[data-cat="campaign"] { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.tpl-featured-ico[data-cat="rules"] { background: rgba(16, 185, 129, 0.12); color: #047857; }
.tpl-featured-ico[data-cat="post_ad"] { background: rgba(236, 72, 153, 0.12); color: #be185d; }

/* —— Sticky toolbar —— */
.tpl-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 24px;
  background: rgba(248, 250, 252, 0.88);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
}

.tpl-toolbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.tpl-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--tpl-line);
  background: #fff;
  color: #94a3b8;
  max-width: 420px;
}

.tpl-search input {
  border: none;
  outline: none;
  width: 100%;
  padding: 11px 0;
  background: transparent;
  color: var(--tpl-ink);
  font: inherit;
}

.tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tpl-filter {
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.04);
  color: var(--tpl-muted);
  font-size: 0.82rem;
  font-weight: 650;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.tpl-filter:hover {
  color: var(--tpl-ink);
  background: rgba(15, 23, 42, 0.07);
}

.tpl-filter.is-active {
  background: var(--tpl-accent);
  color: #fff;
  border-color: var(--tpl-accent);
}

.tpl-count {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tpl-muted);
}

/* —— Sections —— */
.tpl-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 20px;
}

.tpl-section--library {
  padding-top: 28px;
}

.tpl-section-head {
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.tpl-section-head--left {
  text-align: left;
  margin-left: 0;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 8px 24px;
}

.tpl-section-head--left p {
  margin: 0;
  max-width: 28rem;
}

.tpl-section-head h2 {
  margin: 0 0 0.4rem;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--tpl-ink);
}

.tpl-section-head--left h2 {
  margin: 0;
}

.tpl-section-head p {
  margin: 0;
  color: var(--tpl-muted);
  line-height: 1.5;
}

/* —— Cards —— */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tpl-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--tpl-card);
  border: 1px solid var(--tpl-line);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 100%;
}

.tpl-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.tpl-card:hover .tpl-card-cta {
  gap: 10px;
}

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

.tpl-card-visual {
  position: relative;
  padding: 14px 14px 12px;
  min-height: 108px;
  background: linear-gradient(160deg, #f8fafc, #eef2ff 70%, #f8fafc);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.tpl-card-visual[data-cat="content"] { background: linear-gradient(160deg, #f0f9ff, #e0f2fe); }
.tpl-card-visual[data-cat="post_ad"] { background: linear-gradient(160deg, #fdf2f8, #fce7f3); }
.tpl-card-visual[data-cat="creatives"] { background: linear-gradient(160deg, #f5f3ff, #ede9fe); }
.tpl-card-visual[data-cat="campaign"] { background: linear-gradient(160deg, #fffbeb, #fef3c7); }
.tpl-card-visual[data-cat="rules"] { background: linear-gradient(160deg, #ecfdf5, #d1fae5); }
.tpl-card-visual[data-cat="analytics"] { background: linear-gradient(160deg, #eff6ff, #dbeafe); }
.tpl-card-visual[data-cat="lab"] { background: linear-gradient(160deg, #eef2ff, #e0e7ff); }

.tpl-card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--tpl-accent-strong);
  margin-bottom: 10px;
}

.tpl-card-icon svg {
  width: 16px;
  height: 16px;
}

.tpl-card-preview {
  display: grid;
  gap: 6px;
}

.tpl-card-line {
  display: block;
  width: var(--w, 80%);
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.05);
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 15px 16px;
  flex: 1;
}

.tpl-card-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.1);
  color: var(--tpl-accent-strong);
}

.tpl-card-tag[data-cat="content"] { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.tpl-card-tag[data-cat="campaign"] { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.tpl-card-tag[data-cat="rules"] { background: rgba(16, 185, 129, 0.12); color: #047857; }
.tpl-card-tag[data-cat="post_ad"] { background: rgba(236, 72, 153, 0.12); color: #be185d; }
.tpl-card-tag[data-cat="creatives"] { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
.tpl-card-tag[data-cat="analytics"] { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.tpl-card-tag[data-cat="lab"] { background: rgba(99, 102, 241, 0.12); color: #4338ca; }

.tpl-card h3 {
  margin: 0;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tpl-ink);
}

.tpl-card p {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--tpl-muted);
}

.tpl-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tpl-accent-strong);
  transition: gap 0.12s ease;
}

.tpl-empty {
  text-align: center;
  color: var(--tpl-muted);
  padding: 28px 16px;
  margin: 0 0 12px;
  border-radius: 14px;
  background: var(--tpl-soft);
  border: 1px dashed var(--tpl-line);
  display: none;
}

.tpl-empty.is-visible {
  display: block;
}

/* —— Product shot band —— */
.tpl-shot-band {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr);
  gap: 28px;
  align-items: center;
}

.tpl-shot-copy h2 {
  margin: 0 0 0.55rem;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.tpl-shot-copy p {
  margin: 0 0 1.1rem;
  color: var(--tpl-muted);
  line-height: 1.55;
  max-width: 28rem;
}

.tpl-shot {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--tpl-line);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
  background: #0f172a;
}

.tpl-shot-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: #1e293b;
}

.tpl-shot-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.tpl-shot-bar span:first-child { background: #f87171; }
.tpl-shot-bar span:nth-child(2) { background: #fbbf24; }
.tpl-shot-bar span:nth-child(3) { background: #34d399; }

.tpl-shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* —— Steps —— */
.tpl-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  counter-reset: none;
}

.tpl-steps li {
  padding: 1.15rem 1.2rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--tpl-line);
  display: grid;
  gap: 6px;
}

.tpl-step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tpl-accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 750;
  margin-bottom: 4px;
}

.tpl-steps strong {
  font-size: 1rem;
  color: var(--tpl-ink);
}

.tpl-steps span {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--tpl-muted);
}

/* —— FAQ / CTA —— */
.tpl-faq {
  max-width: 760px;
  margin: 8px auto 0;
  padding: 8px 24px 28px;
}

.tpl-faq details {
  border: 1px solid var(--tpl-line);
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.tpl-faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--tpl-ink);
  list-style: none;
}

.tpl-faq summary::-webkit-details-marker { display: none; }

.tpl-faq summary::after {
  content: "+";
  float: right;
  color: var(--tpl-muted);
  font-weight: 600;
}

.tpl-faq details[open] summary::after {
  content: "–";
}

.tpl-faq details p {
  margin: 10px 0 0;
  color: var(--tpl-muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.tpl-faq a {
  color: var(--tpl-accent-strong);
  font-weight: 650;
}

.tpl-cta {
  max-width: 900px;
  margin: 12px auto 64px;
  padding: 44px 28px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(145deg, #eef2ff, #f8fafc);
  border: 1px solid rgba(99, 102, 241, 0.22);
}

.tpl-cta h2 {
  margin: 0 0 0.5rem;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tpl-cta p {
  margin: 0 auto 1.25rem;
  max-width: 32rem;
  color: var(--tpl-muted);
  line-height: 1.55;
}

.tpl-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

@media (max-width: 960px) {
  .tpl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tpl-shot-band,
  .tpl-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tpl-hero {
    padding: 36px 16px 20px;
  }

  .tpl-featured,
  .tpl-toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tpl-grid {
    grid-template-columns: 1fr;
  }

  .tpl-section,
  .tpl-faq,
  .tpl-shot-band {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tpl-section-head--left {
    flex-direction: column;
    align-items: flex-start;
  }

  .tpl-cta {
    margin-left: 16px;
    margin-right: 16px;
    padding: 32px 18px;
  }

  .tpl-search {
    max-width: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .tpl-hero-inner {
    animation: tpl-rise 0.55s ease both;
  }

  .tpl-card {
    animation: tpl-rise 0.45s ease both;
  }

  .tpl-card:nth-child(1) { animation-delay: 0.02s; }
  .tpl-card:nth-child(2) { animation-delay: 0.04s; }
  .tpl-card:nth-child(3) { animation-delay: 0.06s; }
  .tpl-card:nth-child(4) { animation-delay: 0.08s; }
  .tpl-card:nth-child(5) { animation-delay: 0.1s; }
  .tpl-card:nth-child(6) { animation-delay: 0.12s; }
}

@keyframes tpl-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.tpl-crumb ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--tpl-muted);
}

.tpl-crumb a {
  color: var(--tpl-accent-strong);
  font-weight: 650;
  text-decoration: none;
}

.tpl-crumb a:hover { text-decoration: underline; }

.tpl-crumb li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
  color: #94a3b8;
}

.tpl-seo {
  max-width: 42rem;
  margin: 0 auto;
  padding: 4px 24px 18px;
  text-align: center;
}

.tpl-seo h2 {
  margin: 0 0 8px;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tpl-ink);
}

.tpl-seo p {
  margin: 0;
  color: var(--tpl-muted);
  line-height: 1.55;
}

.tpl-related {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 24px 28px;
  text-align: center;
}

.tpl-related h2 {
  margin: 0 0 12px;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--tpl-ink);
}

.tpl-related ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tpl-related a {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--tpl-line);
  background: #fff;
  color: var(--tpl-accent-strong);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.tpl-related a:hover {
  border-color: rgba(99, 102, 241, 0.4);
}
