/* ============================================
   Templates4Make — Global stylesheet
   ============================================ */

:root {
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  --ink-900: #0a0a0a;
  --ink-700: #404040;
  --ink-500: #737373;
  --ink-300: #d4d4d4;
  --ink-200: #e5e5e5;
  --ink-100: #f5f5f5;
  --ink-50: #fafafa;

  --green-50: #ecfdf5;
  --green-600: #059669;
  --red-50: #fef2f2;
  --red-700: #b91c1c;
  --amber-50: #fffbeb;
  --amber-700: #b45309;
  --purple-50: #faf5ff;
  --purple-700: #7e22ce;
  --blue-50: #eff6ff;
  --blue-700: #1d4ed8;

  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --max-width: 72rem;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: white;
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

img { max-width: 100%; display: block; }

::selection { background: var(--brand-100); color: var(--brand-700); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-100);
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--ink-900); }

.logo-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand-600);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

.nav { display: none; gap: 2rem; }
.nav a { font-size: 14px; color: var(--ink-700); }
.nav a:hover { color: var(--ink-900); }

.header-cta { display: flex; align-items: center; gap: 0.75rem; }
.header-cta-link { display: none; font-size: 14px; font-weight: 500; color: var(--ink-700); }
.header-cta-link:hover { color: var(--ink-900); }

@media (min-width: 768px) {
  .nav { display: flex; }
  .header-cta-link { display: block; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary { background: var(--ink-900); color: white; }
.btn-primary:hover { background: var(--ink-700); }

.btn-secondary { background: white; color: var(--ink-900); border-color: var(--ink-200); }
.btn-secondary:hover { background: var(--ink-50); border-color: var(--ink-300); }

.btn-light { background: white; color: var(--ink-900); }
.btn-light:hover { background: var(--ink-100); }

/* Hero */
.hero { text-align: center; padding: 5rem 1.5rem 4rem; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.5rem;
}

.hero-badge-dot {
  width: 6px; height: 6px;
  background: var(--brand-600);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
  color: var(--ink-900);
}

.hero h1 .muted { color: var(--ink-500); }

@media (min-width: 768px) {
  .hero h1 { font-size: 3.75rem; }
}

.hero-description {
  font-size: 1.125rem;
  color: var(--ink-500);
  max-width: 36rem;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-cta {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 0.75rem;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 5rem;
}

@media (min-width: 768px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

.stat { background: var(--ink-50); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--ink-900); }
.stat-label { font-size: 0.875rem; color: var(--ink-500); margin-top: 0.25rem; }

/* Section */
.section { margin-bottom: 5rem; }

.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}

.section-title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.015em; color: var(--ink-900); }
.section-subtitle { font-size: 0.875rem; color: var(--ink-500); margin-top: 0.25rem; }

.section-link { font-size: 0.875rem; font-weight: 500; color: var(--brand-600); }
.section-link:hover { color: var(--brand-700); }

/* Grids */
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

.cards-grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 768px) { .cards-grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* Template card */
.tpl-card {
  display: block;
  background: white;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.15s ease;
}

.tpl-card:hover { border-color: var(--ink-300); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

.tpl-apps { display: flex; align-items: center; gap: 0.375rem; margin-bottom: 0.75rem; }

.tpl-app-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.tpl-card-title { font-weight: 600; color: var(--ink-900); margin-bottom: 0.25rem; font-size: 1rem; }
.tpl-card:hover .tpl-card-title { color: var(--brand-600); }

.tpl-card-desc {
  font-size: 0.875rem;
  color: var(--ink-500);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tpl-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; color: var(--ink-500); }
.tpl-card-pricing { font-weight: 500; }
.tpl-card-pricing.free { color: var(--green-600); }
.tpl-card-pricing.pro { color: var(--brand-600); }

/* App icon colors */
.app-gmail { background: var(--red-50); color: var(--red-700); }
.app-slack { background: var(--purple-50); color: var(--purple-700); }
.app-airtable { background: var(--amber-50); color: var(--amber-700); }
.app-notion { background: var(--ink-100); color: var(--ink-700); }
.app-openai { background: var(--green-50); color: var(--green-600); }
.app-wordpress { background: var(--blue-50); color: var(--blue-700); }
.app-pipedrive { background: var(--green-50); color: var(--green-600); }
.app-default { background: var(--ink-100); color: var(--ink-700); }

/* Category card */
.cat-card { display: block; border: 1px solid var(--ink-100); border-radius: var(--radius-lg); padding: 1rem; transition: border-color 0.15s ease; }
.cat-card:hover { border-color: var(--ink-300); }
.cat-card-title { font-weight: 500; color: var(--ink-900); }
.cat-card:hover .cat-card-title { color: var(--brand-600); }
.cat-card-meta { font-size: 0.75rem; color: var(--ink-500); margin-top: 0.25rem; }

/* Comparison card */
.cmp-card { display: block; border: 1px solid var(--ink-100); border-radius: var(--radius-lg); padding: 1.25rem; transition: border-color 0.15s ease; }
.cmp-card:hover { border-color: var(--ink-300); }
.cmp-card-title { font-weight: 600; color: var(--ink-900); margin-bottom: 0.5rem; }
.cmp-card:hover .cmp-card-title { color: var(--brand-600); }
.cmp-card-desc { font-size: 0.875rem; color: var(--ink-500); line-height: 1.5; }

/* CTA section */
.cta-section {
  background: var(--ink-900);
  color: white;
  border-radius: var(--radius-xl);
  padding: 4rem 2rem;
  text-align: center;
  margin-bottom: 5rem;
}

.cta-section h2 { font-size: 1.875rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 1rem; }
@media (min-width: 768px) { .cta-section h2 { font-size: 2.25rem; } }
.cta-section p { color: var(--ink-300); max-width: 36rem; margin: 0 auto 2rem; }

/* Article (templates / guides / comparisons / apps) */
.article { max-width: 48rem; margin: 0 auto; padding: 4rem 1.5rem; }
.article-back { font-size: 0.875rem; color: var(--ink-500); margin-bottom: 2rem; display: inline-block; }
.article-back:hover { color: var(--ink-900); }

.article-header { margin-bottom: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--ink-100); }

.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.article-tag { font-size: 0.75rem; font-weight: 500; background: var(--ink-100); color: var(--ink-700); padding: 0.25rem 0.625rem; border-radius: var(--radius-full); }

.article-category { font-size: 0.75rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

.article h1 { font-size: 2.25rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink-900); margin-bottom: 1rem; }
@media (min-width: 768px) { .article h1 { font-size: 2.5rem; } }

.article-description { font-size: 1.125rem; color: var(--ink-500); line-height: 1.6; }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.5rem; font-size: 0.875rem; color: var(--ink-500); }
.article-meta strong { color: var(--ink-900); font-weight: 500; }

.article-cta { margin-top: 1.5rem; }

/* Article body */
.article-body { font-size: 1.0625rem; line-height: 1.75; color: var(--ink-700); }
.article-body h2 { font-size: 1.5rem; font-weight: 600; color: var(--ink-900); margin-top: 2.5rem; margin-bottom: 1rem; letter-spacing: -0.015em; }
.article-body h3 { font-size: 1.25rem; font-weight: 600; color: var(--ink-900); margin-top: 2rem; margin-bottom: 0.75rem; }
.article-body p { margin-bottom: 1.25rem; }
.article-body ul, .article-body ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.article-body li { margin-bottom: 0.5rem; }
.article-body code { background: var(--ink-100); padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.875em; font-family: 'SF Mono', Monaco, monospace; }
.article-body pre { background: var(--ink-900); color: white; padding: 1rem; border-radius: var(--radius-md); overflow-x: auto; margin-bottom: 1.25rem; }
.article-body pre code { background: transparent; padding: 0; color: white; }
.article-body strong { color: var(--ink-900); font-weight: 600; }
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; font-size: 0.9375rem; }
.article-body th, .article-body td { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--ink-100); }
.article-body th { font-weight: 600; color: var(--ink-900); background: var(--ink-50); }
.article-body blockquote { border-left: 3px solid var(--brand-500); padding-left: 1rem; margin: 1.5rem 0; color: var(--ink-700); font-style: italic; }

/* Listing pages */
.listing-header { max-width: var(--max-width); margin: 0 auto; padding: 4rem 1.5rem 2.5rem; }
.listing-header h1 { font-size: 2.5rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-900); margin-bottom: 0.75rem; }
.listing-header p { font-size: 1.125rem; color: var(--ink-500); max-width: 36rem; }

.listing-content { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem 4rem; }

.empty-state { background: var(--ink-50); border-radius: var(--radius-xl); padding: 3rem; text-align: center; }
.empty-state h2 { font-size: 1.25rem; font-weight: 600; color: var(--ink-900); margin-bottom: 0.5rem; }
.empty-state p { color: var(--ink-500); max-width: 28rem; margin: 0 auto; }

.guide-list { display: flex; flex-direction: column; gap: 1rem; }
.guide-list-item { display: block; border: 1px solid var(--ink-100); border-radius: var(--radius-lg); padding: 1.5rem; transition: border-color 0.15s ease; }
.guide-list-item:hover { border-color: var(--ink-300); }
.guide-list-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.75rem; color: var(--ink-500); }
.guide-list-title { font-size: 1.25rem; font-weight: 600; color: var(--ink-900); margin-bottom: 0.5rem; }
.guide-list-item:hover .guide-list-title { color: var(--brand-600); }
.guide-list-desc { color: var(--ink-500); line-height: 1.6; }

/* Footer */
.footer { border-top: 1px solid var(--ink-100); background: var(--ink-50); margin-top: 6rem; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; padding: 4rem 1.5rem; }

.footer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; margin-bottom: 3rem; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }

.footer-brand { grid-column: span 2; }
@media (min-width: 768px) { .footer-brand { grid-column: span 1; } }

.footer-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--ink-900); }
.footer-tagline { font-size: 0.875rem; color: var(--ink-500); line-height: 1.6; }

.footer h3 { font-size: 0.875rem; font-weight: 600; color: var(--ink-900); margin-bottom: 0.75rem; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer li a { font-size: 0.875rem; color: var(--ink-500); }
.footer li a:hover { color: var(--ink-900); }

.footer-bottom { border-top: 1px solid var(--ink-100); padding-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.75rem; color: var(--ink-500); }
@media (min-width: 640px) { .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; } }
