/* HTML-атрибут hidden должен скрывать элемент даже если у него
   display: flex/grid через класс (в проекте у button-big-gray так). */
.templates-page [hidden] {
  display: none !important;
}

/* Тот же градиентный фон, что и на body.int-landing (детальной интеграций).
   Дублируем здесь, чтобы не тянуть весь integrations-landing.css на разводящую. */
body.int-landing {
  --header-h: 96px;
  --header-edge: 20px;
  color: #fff;
  background:
    radial-gradient(60% 60% at 80% 8%, rgba(79, 70, 229, 0.16) 0%, transparent 60%),
    radial-gradient(50% 50% at 18% 30%, rgba(40, 148, 236, 0.12) 0%, transparent 60%),
    #0b0b10;
  background-attachment: fixed;
}

/* ====== Layout ====== */
.templates-page {
  color: var(--text-color);
  min-height: 100vh;
}

.templates-page section {
  padding: 80px 0;
}

.templates-page .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .templates-page section {
    padding: 48px 0;
  }
  .templates-page .container {
    padding: 0 16px;
  }
}

/* ====== Hero — в стиле /integrations (int-cat-hero) ====== */
/* selector .templates-page .templates-hero повышает specificity,
   чтобы перебить общее .templates-page section { padding: 80px 0 } */
.templates-page .templates-hero {
  --th-header-h: 96px;
  --th-header-edge: 20px;
  position: relative;
  overflow: hidden;
  padding: calc(var(--th-header-h) + var(--th-header-edge) + 56px) 24px 72px;
  text-align: center;
}

@media (max-width: 768px) {
  .templates-page .templates-hero {
    padding: calc(var(--th-header-h) + var(--th-header-edge) + 32px) 16px 48px;
  }
}

.templates-hero__inner {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 48px;
  background: var(--hero-gradient-12, linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(40, 148, 236, 0.08)));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 24px 80px -32px rgba(8, 10, 22, 0.7);
}

@media (max-width: 768px) {
  .templates-hero__inner { padding: 28px 24px; }
}

.templates-hero__title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: #fff;
}

.templates-hero__subtitle {
  font-size: 18px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 32px;
}

.templates-hero__metric {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.templates-hero__metric-num {
  font-size: 22px;
  font-weight: 600;
  background: linear-gradient(90deg, #4F46E5 0%, #2894EC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.templates-hero__metric-num--soft {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: rgba(255, 255, 255, 0.7);
}

.templates-hero__metric-sep {
  color: rgba(255, 255, 255, 0.3);
  margin: 0 4px;
}

.templates-hero__metric-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

/* ====== Hero — фоновая карусель ======
   Центрирована по вертикали через top: 50% + translateY(-50%). */
.templates-hero__carousel {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
  overflow: hidden;
}

.templates-hero__carousel-track {
  display: flex;
  gap: 20px;
  animation: templates-carousel 60s linear infinite;
  width: max-content;
  padding: 24px 0;
}

.templates-hero__carousel-item {
  width: 280px;
  height: 158px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Цветные плитки-плейсхолдеры для карусели (когда нет cover.png) */
.templates-hero__carousel-item[data-i="0"]  { background-color: rgba(79, 70, 229, 0.45);  background-image: radial-gradient(circle at 30% 30%, rgba(168, 85, 247, 0.6), rgba(79, 70, 229, 0.3)); }
.templates-hero__carousel-item[data-i="1"]  { background-color: rgba(40, 148, 236, 0.45); background-image: radial-gradient(circle at 70% 40%, rgba(34, 197, 94, 0.5), rgba(40, 148, 236, 0.3)); }
.templates-hero__carousel-item[data-i="2"]  { background-color: rgba(255, 140, 66, 0.4);  background-image: radial-gradient(circle at 40% 60%, rgba(234, 179, 8, 0.5), rgba(255, 140, 66, 0.3)); }
.templates-hero__carousel-item[data-i="3"]  { background-color: rgba(6, 182, 212, 0.45); background-image: radial-gradient(circle at 60% 30%, rgba(40, 148, 236, 0.5), rgba(6, 182, 212, 0.3)); }
.templates-hero__carousel-item[data-i="4"]  { background-color: rgba(168, 85, 247, 0.45); background-image: radial-gradient(circle at 30% 70%, rgba(79, 70, 229, 0.5), rgba(168, 85, 247, 0.3)); }
.templates-hero__carousel-item[data-i="5"]  { background-color: rgba(234, 179, 8, 0.4);  background-image: radial-gradient(circle at 70% 60%, rgba(255, 140, 66, 0.5), rgba(234, 179, 8, 0.3)); }
.templates-hero__carousel-item[data-i="6"]  { background-color: rgba(34, 197, 94, 0.4);  background-image: radial-gradient(circle at 40% 30%, rgba(6, 182, 212, 0.5), rgba(34, 197, 94, 0.3)); }
.templates-hero__carousel-item[data-i="7"]  { background-color: rgba(79, 70, 229, 0.45); background-image: radial-gradient(circle at 60% 60%, rgba(40, 148, 236, 0.5), rgba(79, 70, 229, 0.3)); }
.templates-hero__carousel-item[data-i="8"]  { background-color: rgba(255, 140, 66, 0.4);  background-image: radial-gradient(circle at 30% 40%, rgba(168, 85, 247, 0.5), rgba(255, 140, 66, 0.3)); }
.templates-hero__carousel-item[data-i="9"]  { background-color: rgba(40, 148, 236, 0.45); background-image: radial-gradient(circle at 70% 30%, rgba(34, 197, 94, 0.5), rgba(40, 148, 236, 0.3)); }
.templates-hero__carousel-item[data-i="10"] { background-color: rgba(168, 85, 247, 0.45); background-image: radial-gradient(circle at 30% 60%, rgba(234, 179, 8, 0.5), rgba(168, 85, 247, 0.3)); }
.templates-hero__carousel-item[data-i="11"] { background-color: rgba(6, 182, 212, 0.45); background-image: radial-gradient(circle at 60% 40%, rgba(255, 140, 66, 0.5), rgba(6, 182, 212, 0.3)); }

@keyframes templates-carousel {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - 10px)); }
}

@media (prefers-reduced-motion: reduce) {
  .templates-hero__carousel-track { animation: none; }
}

@media (max-width: 768px) {
  .templates-hero__carousel { display: none; }
}


/* ====== Поиск (теперь в секции «Все шаблоны») ====== */
.templates-all__search {
  margin: 0 0 24px 0;
  max-width: 560px;
}

.templates-all__search-input {
  width: 100%;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(225, 241, 255, 0.12);
  border-radius: 12px;
  color: var(--text-color);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.templates-all__search-input:focus {
  border-color: rgba(79, 70, 229, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

/* ====== Template Card — стиль карточек тарифов (.ppage-card) ====== */
.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(225, 241, 255, 0.03);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), opacity 0.5s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.3s ease;
}

/* Двойной класс (.template-card.template-card) поднимает specificity до
   (0,2,0), чтобы перебить .fade-in.is-visible { transform: translateY(0) }. */
.template-card.template-card--featured {
  border-color: #54B2FF;
  box-shadow: 0 0 0 2px rgba(84, 178, 255, 0.35), 0 22px 50px rgba(40, 148, 236, 0.25);
  transform: translateY(-6px);
}

@media (hover: hover) and (min-width: 1025px) {
  .template-card.template-card:hover {
    transform: translateY(-8px);
    border-color: rgba(225, 241, 255, 0.22);
    background: rgba(225, 241, 255, 0.06);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
  }
  .template-card.template-card--featured:hover {
    transform: translateY(-14px);
    border-color: #54B2FF;
    box-shadow: 0 0 0 2px rgba(84, 178, 255, 0.5), 0 28px 60px rgba(40, 148, 236, 0.35);
  }
}

/* Бейдж «Рекомендуем» — над карточкой по центру, как у .ppage-card__badge */
.template-card__badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7C6AFF, #54B2FF);
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(124, 106, 255, 0.4);
  z-index: 2;
}

.template-card__cover-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
}

.template-card__cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: rgba(79, 70, 229, 0.15);
}

.template-card__body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.template-card__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-card__category {
  --accent: rgba(40, 148, 236, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-align: center;
  line-height: 1.3;
}

.template-card__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  margin: 4px 0 0 0;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.template-card__description {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(225, 241, 255, 0.6);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

/* Ценник (price tag) — серый, со скруглением справа и «дырочкой» слева */
.template-card__price {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px 4px 18px;
  background: rgba(225, 241, 255, 0.07);
  border: 1px solid rgba(225, 241, 255, 0.14);
  border-radius: 3px 12px 12px 3px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(225, 241, 255, 0.78);
  white-space: nowrap;
}

.template-card__price::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(19, 19, 23, 0.95);
  box-shadow: 0 0 0 1px rgba(225, 241, 255, 0.18);
  transform: translateY(-50%);
}

/* Счётчик скачиваний рядом с CTA */
.template-card__installs {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(225, 241, 255, 0.5);
  white-space: nowrap;
}

/* Кнопка «Открыть» — акцентная primary */
.template-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, #4F46E5, #2894EC);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.32);
  transition: background 0.2s ease;
}

.template-card:hover .template-card__cta {
  background: linear-gradient(90deg, #6259EB, #3DA1F0);
}

/* Карточки без landing-страницы — некликабельные «скоро».
   Дублирование класса в селекторах поднимает specificity до (0,3,1),
   чтобы перебить .template-card.template-card:hover из секции выше. */
.template-card--soon {
  cursor: default;
  opacity: 0.7;
}
.template-card.template-card--soon.template-card--soon:hover {
  transform: none;
  border-color: rgba(225, 241, 255, 0.08);
  background: rgba(225, 241, 255, 0.03);
  box-shadow: none;
}
.template-card--soon .template-card__cta {
  background: rgba(225, 241, 255, 0.08);
  color: rgba(225, 241, 255, 0.65);
  box-shadow: none;
}
.template-card--soon:hover .template-card__cta {
  background: rgba(225, 241, 255, 0.08);
}

/* ====== Section title ====== */
.templates-section-title {
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 600;
  margin: 0 0 32px 0;
  color: var(--text-color);
}

/* ====== Popular ====== */
.templates-popular__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1100px) {
  .templates-popular__grid { grid-template-columns: repeat(2, 1fr); }
}

/* На мобиле — горизонтальный слайдер с scroll-snap (стиль .json-editors).
   Карточка занимает 86% ширины — справа видно «peek» следующей карточки. */
@media (max-width: 720px) {
  .templates-popular__grid {
    display: flex;
    grid-template-columns: none;
    gap: 12px;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 16px 4px;
    margin: 0 -4px;
  }
  .templates-popular__grid::-webkit-scrollbar { display: none; }
  .templates-popular__grid > .template-card {
    flex: 0 0 86%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
  /* На мобиле гасим свечение у featured — иначе оно клипается границей
     overflow:auto и выглядит обрезанным. Обводку оставляем. */
  .templates-popular__grid > .template-card.template-card--featured {
    box-shadow: 0 0 0 2px rgba(84, 178, 255, 0.35);
  }
}

/* Точки под слайдером — стиль .json-editors__dot с главной */
.templates-popular__dots {
  display: none;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.templates-popular__dots .nav-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  background: rgba(225, 241, 255, 0.2);
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.25s ease, width 0.25s ease, transform 0.25s ease;
}

.templates-popular__dots .nav-dot.active {
  background: linear-gradient(90deg, #4F46E5, #2894EC);
  width: 24px;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.45);
  transform: none;
}

@media (max-width: 720px) {
  .templates-popular__dots { display: flex; }
}

/* ====== Categories ====== */
.templates-categories__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 1279px) {
  .templates-categories__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .templates-categories__grid { grid-template-columns: 1fr; }
}

.category-tile {
  --accent: #2894EC;
  display: flex;
  flex-direction: column;
  padding: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), opacity 0.5s ease, border-color 0.25s ease, box-shadow 0.3s ease;
  min-height: 220px;
}

.category-tile.category-tile:hover {
  transform: translateY(-8px);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.3), 0 16px 48px -16px color-mix(in srgb, var(--accent) 35%, transparent);
}

.category-tile__icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.category-tile__icon img {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 40%, transparent));
}

.category-tile__title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-color);
}

.category-tile__description {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(225, 241, 255, 0.55);
  margin: 0 0 24px 0;
  flex: 1;
}

.category-tile__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-tile__count {
  color: rgba(225, 241, 255, 0.5);
}

.category-tile__arrow {
  color: var(--accent);
  font-size: 20px;
  transition: transform 0.2s ease;
}

.category-tile:hover .category-tile__arrow {
  transform: translateX(4px);
}

/* ====== All Templates — табы + грид в общем фрейме (по образцу int-cat-tabbed) ====== */
.templates-section-title + .templates-tabbed {
  margin-top: 32px;
}

.templates-tabbed {
  width: 100%;
}

/* Ряд табов */
.templates-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-bottom: -1px;
  position: relative;
  z-index: 2;
}

/* Контейнер с контентом — общий фон, к которому «прикреплены» табы */
.templates-grid-wrap {
  background: rgba(17, 20, 31, 0.6);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-radius: 0 16px 16px 16px;
  padding: 28px;
  backdrop-filter: blur(8px);
}

/* === TAB === */
.templates-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 10px;
  background: rgba(13, 16, 25, 0.4);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-bottom: none;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(225, 241, 255, 0.4);
  cursor: pointer;
  text-align: center;
  transition: color 0.2s, background 0.2s, border-color 0.2s, flex 0.25s ease;
}

.templates-tab:hover {
  color: rgba(225, 241, 255, 0.7);
  background: rgba(17, 20, 31, 0.5);
}

/* Активный таб «слит» с контейнером */
.templates-tab.is-active {
  flex: 0 0 auto;
  background: rgba(17, 20, 31, 0.6);
  border-color: rgba(124, 106, 255, 0.4);
  border-bottom-color: rgba(17, 20, 31, 0.6);
  color: #fff;
  z-index: 3;
  padding: 14px 22px;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.templates-tab.is-active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #4F46E5, transparent);
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.3);
}

.templates-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(17, 20, 31, 0.6);
}

.templates-tab__name {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.templates-tab.is-active .templates-tab__name {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.templates-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 0 6px;
  height: 18px;
  border-radius: 9px;
  background: rgba(225, 241, 255, 0.08);
  font-size: 10px;
  letter-spacing: 0;
  color: rgba(225, 241, 255, 0.6);
  flex-shrink: 0;
}

.templates-tab.is-active .templates-tab__count {
  background: rgba(124, 106, 255, 0.25);
  color: #fff;
}

/* === Toolbar (поиск + сортировка в один ряд) === */
.templates-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.templates-toolbar__search {
  position: relative;
  flex: 1 1 320px;
  min-width: 240px;
}

.templates-toolbar__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(225, 241, 255, 0.45);
  pointer-events: none;
}

.templates-toolbar__search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  background: rgba(13, 16, 25, 0.5);
  border: 1px solid rgba(225, 241, 255, 0.12);
  border-radius: 10px;
  color: var(--text-color);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.templates-toolbar__search-input::placeholder {
  color: rgba(225, 241, 255, 0.4);
}

.templates-toolbar__search-input:focus {
  border-color: rgba(124, 106, 255, 0.5);
  background: rgba(13, 16, 25, 0.7);
}

.templates-toolbar__sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(225, 241, 255, 0.5);
}

.templates-toolbar__sort-label {
  white-space: nowrap;
}

.templates-toolbar__sort-select {
  height: 42px;
  padding: 0 38px 0 14px;
  background-color: rgba(13, 16, 25, 0.5);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23E1F1FF' stroke-opacity='0.6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5l3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 12px;
  border: 1px solid rgba(225, 241, 255, 0.12);
  border-radius: 10px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.templates-toolbar__sort-select:hover {
  border-color: rgba(124, 106, 255, 0.4);
  background-color: rgba(13, 16, 25, 0.7);
}

.templates-toolbar__sort-select:focus {
  outline: none;
  border-color: rgba(124, 106, 255, 0.6);
}

.templates-toolbar__sort-select option {
  background: #131317;
  color: var(--text-color);
}

/* === GRID === */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1100px) {
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .templates-grid { grid-template-columns: 1fr; }
}

.templates-empty {
  text-align: center;
  padding: 64px 24px;
}

.templates-empty__img {
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
  opacity: 0.7;
}

.templates-empty__title {
  font-size: 18px;
  color: rgba(225, 241, 255, 0.7);
  margin: 0 0 24px 0;
}

.templates-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* Мобильная адаптация табов — паттерн int-cat-tabs: переносятся как pills */
@media (max-width: 768px) {
  .templates-tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
  }
  .templates-tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: rgba(13, 16, 25, 0.6);
    border: 1px solid rgba(225, 241, 255, 0.08);
    border-bottom: 1px solid rgba(225, 241, 255, 0.08);
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }
  .templates-tab:hover {
    background: rgba(17, 20, 31, 0.85);
  }
  .templates-tab.is-active {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(40, 148, 236, 0.18) 100%);
    border-color: rgba(124, 106, 255, 0.5);
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }
  /* Скрываем «вкладочные» декорации на мобиле */
  .templates-tab.is-active::before,
  .templates-tab.is-active::after { display: none; }

  /* Контейнер карточек на мобиле — без верхнего «прикрепления» */
  .templates-grid-wrap {
    border-radius: 16px;
    padding: 18px;
  }
}

/* ====== Footer CTA ====== */
.templates-footer-cta__box {
  padding: 64px 48px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(40, 148, 236, 0.12));
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 24px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.templates-footer-cta__title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--text-color);
}

.templates-footer-cta__description {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(225, 241, 255, 0.7);
  max-width: 560px;
  margin: 0 auto 32px;
}

.templates-footer-cta__button {
  font-size: 16px;
  padding: 16px 32px;
}

@media (max-width: 600px) {
  .templates-footer-cta__box { padding: 40px 24px; }
}

/* ====== Fade-in Animation ====== */
/* Только opacity, без transform — иначе .fade-in.is-visible { transform:
   translateY(0) } перебивает hover-translateY карточек. Transition уже
   объявлен в .template-card / .category-tile (включает opacity). */
.fade-in {
  opacity: 0;
}

.fade-in.is-visible {
  opacity: 1;
}
