.templates-page .templates-hero {
  padding: 52px 0 28px;
  text-align: center;
}

.templates-page .templates-hero .section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 12px;
}

.templates-page .templates-lead {
  max-width: 640px;
  margin: 0.85rem auto 0;
  color: var(--slate-gray);
}

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

.templates-page .templates-filters-section .filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.templates-page .templates-grid-section {
  padding-top: 0;
  padding-bottom: 48px;
}

.templates-page .templates-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.templates-page .tmpl-card,
.templates-page .template-item {
  margin: 0;
  padding: 0;
  list-style: none;
}

.templates-page .tmpl-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--transition-1),
    box-shadow var(--transition-1),
    border-color var(--transition-1);
}

.templates-page .tmpl-card-link:is(:hover, :focus-visible) {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border-color: rgba(90, 88, 233, 0.22);
}

.templates-page .tmpl-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eef0f6;
}

.templates-page .tmpl-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.45s ease;
}

.templates-page .tmpl-card-link:is(:hover, :focus-visible) .tmpl-media img {
  transform: scale(1.04);
}

.templates-page .tmpl-media img.preview-loading {
  opacity: 0;
}

.templates-page .tmpl-media img.is-loaded {
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.templates-page .tmpl-media:has(img.preview-loading)::after,
.templates-page .tmpl-media.preview-refreshing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(225, 229, 234, 0.45),
    rgba(247, 248, 253, 0.95),
    rgba(225, 229, 234, 0.45)
  );
  background-size: 200% 100%;
  animation: tmpl-shimmer 1.2s ease-in-out infinite;
}

.templates-page .tmpl-live-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 1.15rem;
  font-weight: var(--fw-700);
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  transition: background var(--transition-1), transform var(--transition-1);
}

.templates-page .tmpl-card-link:is(:hover, :focus-visible) .tmpl-live-btn {
  background: var(--majorelle-blue);
  transform: translateY(-1px);
}

.templates-page .tmpl-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 20px;
}

.templates-page .tmpl-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: var(--fw-700);
  color: var(--raisin-black-1);
  line-height: 1.25;
}

.templates-page .tmpl-desc {
  margin: 0;
  color: var(--slate-gray);
  font-size: 1.3rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio-status {
  text-align: center;
  margin: 0 0 1.2rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-10);
  background: var(--ghost-white);
  color: var(--slate-gray);
  font-size: 1.35rem;
}

.portfolio-status--error {
  background: rgba(255, 97, 97, 0.1);
  color: #9f2d2d;
}

.portfolio-status--empty {
  background: rgba(255, 221, 97, 0.18);
  color: var(--raisin-black-1);
}

.templates-page .github-skeleton .tmpl-card-link {
  pointer-events: none;
}

.github-skeleton .tmpl-media {
  background: linear-gradient(
    90deg,
    rgba(225, 229, 234, 0.5),
    rgba(247, 248, 253, 0.95),
    rgba(225, 229, 234, 0.5)
  );
  background-size: 200% 100%;
  animation: tmpl-shimmer 1.2s ease-in-out infinite;
}

.github-skeleton .skeleton-title,
.github-skeleton .skeleton-text {
  background: linear-gradient(
    90deg,
    rgba(225, 229, 234, 0.5),
    rgba(247, 248, 253, 0.95),
    rgba(225, 229, 234, 0.5)
  );
  background-size: 200% 100%;
  animation: tmpl-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.github-skeleton .skeleton-title {
  height: 20px;
  width: 62%;
}

.github-skeleton .skeleton-text {
  height: 36px;
  width: 100%;
}

@keyframes tmpl-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.templates-cta {
  padding-top: 8px;
}

.templates-cta-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem;
  border-radius: var(--radius-20);
  background: linear-gradient(135deg, rgba(90, 88, 233, 0.08), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(90, 88, 233, 0.12);
}

.templates-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

@media (max-width: 700px) {
  .templates-page .templates-hero {
    padding: calc(72px + env(safe-area-inset-top)) 0 1rem;
  }

  .templates-page .templates-hero .section-title {
    font-size: clamp(1.45rem, 6vw, 2rem);
    line-height: 1.2;
  }

  .templates-page .templates-lead {
    font-size: 0.9rem;
    line-height: 1.55;
  }

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

  .templates-page .tmpl-card-link {
    border-radius: 24px;
    border: none;
    box-shadow: none;
    background: #efefef;
  }

  .templates-page .tmpl-media {
    border-radius: 24px;
  }

  .templates-page .templates-filters-section .filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .templates-page .filter-btn {
    flex: 0 0 auto;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 0.15rem;
    border-radius: 0;
    border: none;
    background: none;
    box-shadow: none;
    min-height: auto;
  }

  .templates-page .filter-btn.active {
    font-weight: 700;
  }

  .templates-cta-inner {
    padding: 1.25rem;
  }

  .templates-cta-actions {
    width: 100%;
    flex-direction: column;
  }

  .templates-cta-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
