/* ════════════════════════════════════════════
   PRINTCRAFT – templates.css + blog.css
   ════════════════════════════════════════════ */

/* ─── Templates Hero ─────────────────────────── */
.templates-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 4rem 0 3rem;
}
.templates-hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}
.templates-hero__text h1 { font-size: clamp(1.8rem,4vw,2.8rem); margin-bottom: .75rem; }
.templates-hero__text p  { opacity: .85; margin-bottom: 1.5rem; font-size: 1.05rem; }

.hero-search-box {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: .6rem 1.1rem;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
}
.hero-search-box i { color: var(--gray-400); flex-shrink: 0; }
.hero-search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--gray-900);
}
.popular-searches {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .75rem;
  flex-wrap: wrap;
  font-size: .82rem;
  opacity: .85;
}
.pop-tag {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: var(--white);
  padding: .2rem .7rem;
  border-radius: var(--radius-full);
  font-size: .78rem;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}
.pop-tag:hover { background: rgba(255,255,255,.3); }

.preview-stack { position: relative; width: 160px; height: 120px; }
.preview-card {
  position: absolute;
  width: 120px;
  height: 80px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

/* ─── Category Bar ───────────────────────────── */
.tpl-category-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.tpl-cats-scroll {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: .5rem 0;
}
.tpl-cats-scroll::-webkit-scrollbar { display: none; }
.tpl-cat-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-full);
  font-size: .83rem;
  font-weight: 500;
  color: var(--gray-600);
  white-space: nowrap;
  border: 1.5px solid transparent;
  transition: all var(--transition);
}
.tpl-cat-btn:hover { color: var(--red); background: #fff5f5; }
.tpl-cat-btn.active { color: var(--red); border-color: var(--red); background: #fff5f5; font-weight: 600; }
.tpl-cat-btn i { font-size: .8rem; }

/* ─── Main Layout ────────────────────────────── */
.templates-main { padding: 2rem 0 5rem; background: var(--gray-50); }
.templates-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}

/* ─── Filter Sidebar (reuse from category.css) ── */
.tpl-filters {
  position: sticky;
  top: calc(var(--nav-height) + 56px + 1rem);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tpl-filters__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 1.1rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.tpl-filters__header h3 { font-size: .95rem; }

.color-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
  padding: 0 1.1rem .9rem;
}
.color-filter-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  justify-self: center;
}
.color-filter-dot:hover, .color-filter-dot.active { border-color: var(--red); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(230,57,70,.2); }

.tpl-sidebar-cta {
  margin: .5rem;
  padding: 1.1rem;
  background: linear-gradient(135deg, #fff5f5, #ffe3e3);
  border-radius: var(--radius-sm);
  border: 1px solid #ffa8a8;
  text-align: center;
}
.tpl-sidebar-cta__icon { font-size: 1.75rem; color: var(--red); margin-bottom: .5rem; }
.tpl-sidebar-cta h4 { font-size: .9rem; margin-bottom: .3rem; }
.tpl-sidebar-cta p  { font-size: .78rem; color: var(--gray-600); margin-bottom: .75rem; }

/* ─── Toolbar ────────────────────────────────── */
.tpl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.tpl-result-count { font-size: .88rem; color: var(--gray-500); }
.tpl-toolbar__right { display: flex; align-items: center; gap: .5rem; }

/* ─── Template Grid ──────────────────────────── */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.tpl-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.tpl-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.tpl-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--red); }

.tpl-card__preview {
  aspect-ratio: 3/2;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.tpl-card__preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.tpl-card:hover .tpl-card__preview img { transform: scale(1.05); }

.tpl-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.tpl-card:hover .tpl-card__overlay { opacity: 1; }
.tpl-card__overlay .btn { padding: .5rem 1.1rem; font-size: .82rem; }

.tpl-card__pro {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: var(--yellow);
  color: var(--black);
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.tpl-card__new {
  position: absolute;
  top: .5rem;
  left: .5rem;
  background: var(--red);
  color: var(--white);
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.tpl-card__body { padding: .7rem; }
.tpl-card__name { font-size: .82rem; font-weight: 600; display: block; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-card__cat  { font-size: .7rem; color: var(--gray-500); }
.tpl-card__fav {
  position: absolute;
  bottom: .6rem;
  right: .6rem;
  width: 26px;
  height: 26px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--gray-400);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity var(--transition);
}
.tpl-card:hover .tpl-card__fav { opacity: 1; }
.tpl-card__fav:hover { color: var(--red); }

/* ─── Template Modal ─────────────────────────── */
.tpl-modal-inner {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: calc(100vw - 3rem);
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
}
.tpl-modal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--gray-100);
  min-height: 320px;
}
.tpl-modal-preview img { max-width: 100%; border-radius: 8px; box-shadow: var(--shadow-lg); }
.tpl-modal-info { padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.tpl-modal-cat { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); }
.tpl-modal-info h2 { font-size: 1.4rem; }
.tpl-modal-info p  { color: var(--gray-600); font-size: .9rem; }
.tpl-modal-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.tpl-modal-meta .chip { font-size: .72rem; }
.tpl-modal-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.tpl-modal-nav {
  display: flex;
  justify-content: space-between;
  padding-top: .5rem;
  border-top: 1px solid var(--gray-100);
  font-size: .82rem;
  color: var(--gray-500);
}
.tpl-modal-nav button { display: flex; align-items: center; gap: .35rem; transition: color var(--transition); }
.tpl-modal-nav button:hover { color: var(--red); }

/* ─── CTA Banner ─────────────────────────────── */
.tpl-cta-banner {
  background: var(--red);
  color: var(--white);
  padding: 3rem 0;
}
.tpl-cta-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.tpl-cta-banner h2 { font-size: 1.6rem; margin-bottom: .3rem; }
.tpl-cta-banner p  { opacity: .85; }
.tpl-cta-banner .btn--primary { background: var(--white); color: var(--red); border-color: var(--white); }
.tpl-cta-banner .btn--primary:hover { background: var(--gray-100); }

/* ══════════════════════════════════
   BLOG STYLES
   ══════════════════════════════════ */

/* Blog Hero */
.blog-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: var(--white);
  padding: 4rem 0;
}
.blog-hero h1 { font-size: clamp(2rem,4vw,3rem); margin-bottom: .5rem; }
.blog-hero p  { opacity: .8; font-size: 1.05rem; }

/* Blog Layout */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
  padding: 3rem 0 5rem;
}

/* Featured Post */
.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  transition: box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
}
.featured-post:hover { box-shadow: var(--shadow-xl); }
.featured-post__img  { aspect-ratio: 1; overflow: hidden; }
.featured-post__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.featured-post:hover .featured-post__img img { transform: scale(1.04); }
.featured-post__body { padding: 2rem; display: flex; flex-direction: column; gap: .75rem; }
.featured-post__tag  { display: inline-block; background: var(--red); color: var(--white); font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); }
.featured-post__body h2 { font-size: 1.4rem; line-height: 1.3; }
.featured-post__body p  { color: var(--gray-600); font-size: .9rem; line-height: 1.7; flex: 1; }
.featured-post__meta { display: flex; align-items: center; gap: .75rem; font-size: .78rem; color: var(--gray-500); }
.featured-post__meta img { width: 28px; height: 28px; border-radius: 50%; }
.featured-post__read { display: inline-flex; align-items: center; gap: .35rem; color: var(--red); font-weight: 600; font-size: .85rem; margin-top: auto; }

/* Blog Grid */
.blog-posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.blog-post-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  display: block;
  color: inherit;
  text-decoration: none;
}
.blog-post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.blog-post-card__img { aspect-ratio: 16/9; overflow: hidden; position: relative; }
.blog-post-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.blog-post-card:hover .blog-post-card__img img { transform: scale(1.06); }
.blog-post-card__tag { position: absolute; top: .6rem; left: .6rem; background: var(--red); color: var(--white); font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-full); }
.blog-post-card__body { padding: 1rem 1.1rem; }
.blog-post-card__body h3 { font-size: .95rem; line-height: 1.3; margin-bottom: .4rem; }
.blog-post-card__body p  { font-size: .82rem; color: var(--gray-600); margin-bottom: .6rem; line-height: 1.6; }
.blog-post-card__meta { font-size: .75rem; color: var(--gray-400); display: flex; align-items: center; gap: .5rem; }
.blog-post-card__meta i { font-size: .65rem; }

/* Blog Sidebar */
.blog-sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-widget { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.sidebar-widget__header { padding: .9rem 1.1rem; border-bottom: 1px solid var(--gray-100); background: var(--gray-50); font-size: .9rem; font-weight: 700; }
.sidebar-widget__body { padding: 1rem 1.1rem; }

/* Categories Widget */
.cat-list { display: flex; flex-direction: column; gap: .35rem; }
.cat-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  color: var(--gray-700);
  padding: .3rem 0;
  border-bottom: 1px solid var(--gray-100);
  transition: color var(--transition);
}
.cat-list a:hover { color: var(--red); }
.cat-list a span  { background: var(--gray-100); color: var(--gray-500); font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; }

/* Popular Posts */
.popular-post-item { display: flex; gap: .75rem; margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); }
.popular-post-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.popular-post-item__img { width: 60px; height: 48px; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.popular-post-item__img img { width: 100%; height: 100%; object-fit: cover; }
.popular-post-item__text a { font-size: .82rem; font-weight: 600; color: var(--gray-800); line-height: 1.3; display: block; margin-bottom: .2rem; transition: color var(--transition); }
.popular-post-item__text a:hover { color: var(--red); }
.popular-post-item__text span { font-size: .72rem; color: var(--gray-400); }

/* Tags Cloud */
.tags-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-link { display: inline-block; padding: .25rem .7rem; background: var(--gray-100); color: var(--gray-600); border-radius: var(--radius-full); font-size: .75rem; transition: all var(--transition); }
.tag-link:hover { background: var(--red); color: var(--white); }

/* Newsletter Widget */
.newsletter-widget input { width: 100%; padding: .6rem .9rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-size: .88rem; outline: none; margin-bottom: .5rem; }
.newsletter-widget input:focus { border-color: var(--red); }

/* Blog Article */
.article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; padding: 2.5rem 0 5rem; align-items: start; }
.article-header { margin-bottom: 2rem; }
.article-header__tags { display: flex; gap: .5rem; margin-bottom: 1rem; }
.article-header h1 { font-size: clamp(1.6rem,4vw,2.4rem); margin-bottom: 1rem; }
.article-header__meta { display: flex; align-items: center; gap: 1rem; font-size: .85rem; color: var(--gray-500); flex-wrap: wrap; }
.article-header__meta img { width: 40px; height: 40px; border-radius: 50%; }
.article-header__meta strong { color: var(--gray-800); }
.article-hero-img { width: 100%; border-radius: var(--radius-lg); margin-bottom: 2rem; aspect-ratio: 16/9; object-fit: cover; }
.article-content { font-size: .97rem; line-height: 1.8; color: var(--gray-700); }
.article-content h2 { font-size: 1.4rem; color: var(--gray-900); margin: 2rem 0 .75rem; }
.article-content h3 { font-size: 1.1rem; color: var(--gray-900); margin: 1.5rem 0 .5rem; }
.article-content p  { margin-bottom: 1.25rem; }
.article-content ul, .article-content ol { margin-left: 1.5rem; margin-bottom: 1.25rem; }
.article-content li { margin-bottom: .4rem; }
.article-content blockquote { border-left: 4px solid var(--red); padding: 1rem 1.5rem; background: #fff5f5; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic; margin: 1.5rem 0; color: var(--gray-600); }
.article-content img { border-radius: var(--radius-md); margin: 1rem 0; }
.article-content .highlight-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 1.25rem; margin: 1.5rem 0; }
.article-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 2rem 0; padding-top: 1.5rem; border-top: 1px solid var(--gray-200); }
.article-share { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; }
.article-share span { font-size: .85rem; color: var(--gray-500); }

/* Table of Contents */
.toc-widget { position: sticky; top: calc(var(--nav-height) + 1rem); }
.toc-list { display: flex; flex-direction: column; gap: .35rem; }
.toc-link { font-size: .83rem; color: var(--gray-600); padding: .25rem 0 .25rem .75rem; border-left: 2px solid var(--gray-200); display: block; transition: all var(--transition); }
.toc-link:hover, .toc-link.active { color: var(--red); border-left-color: var(--red); }
.toc-link.h3 { padding-left: 1.5rem; font-size: .78rem; }

/* Related Articles */
.related-articles h2 { font-size: 1.3rem; margin-bottom: 1.25rem; padding-top: 2rem; border-top: 1px solid var(--gray-200); }
.related-articles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 1100px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  {
  .templates-layout  { grid-template-columns: 1fr; }
  .tpl-filters       { position: static; }
  .tpl-grid          { grid-template-columns: repeat(2, 1fr); }
  .blog-layout       { grid-template-columns: 1fr; }
  .article-layout    { grid-template-columns: 1fr; }
  .tpl-modal-inner   { grid-template-columns: 1fr; }
  .related-articles-grid { grid-template-columns: 1fr 1fr; }
  .templates-hero__inner { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .tpl-grid  { grid-template-columns: repeat(2, 1fr); }
  .blog-posts-grid { grid-template-columns: 1fr; }
  .featured-post { grid-template-columns: 1fr; }
  .related-articles-grid { grid-template-columns: 1fr; }
}
