/* ==========================================================================
   TEMPLATE LAYOUT - Overrides & additions scoped to .template-page
   Loads AFTER article.css; reuses design tokens from design-system.css
   ========================================================================== */

/* ---------- Keyframes ---------- */
@keyframes successFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Template Type Badge ---------- */
.template-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #059669;
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.15);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 24px;
  transition: background 0.2s ease;
}

.template-type-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
  flex-shrink: 0;
}

/* ---------- Hero Section ---------- */
.template-page .article-header-section {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(5, 150, 105, 0.06) 0%, transparent 60%),
    var(--bg-dark);
  border-bottom: none;
  padding-bottom: 80px;
}

.template-page .article-header-section h1 {
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}

/* ---------- Hero Subtitle ---------- */
.template-hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 40px;
  font-weight: 400;
  line-height: 1.6;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Hero Email Form ---------- */
.template-hero-form {
  max-width: 460px;
  margin: 0 auto;
  padding: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.template-hero-form-row {
  display: flex;
  gap: 5px;
  margin-bottom: 0;
}

.template-hero-input {
  flex: 1;
  min-width: 0;
  padding: 13px 18px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  transition:
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.template-hero-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.3);
}

.template-hero-input::placeholder {
  color: var(--text-light);
  font-size: 0.85rem;
}

.template-hero-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 13px 24px;
  font-size: 0.88rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: #059669;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.template-hero-btn:hover {
  background: #047857;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

.template-hero-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.template-hero-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.template-hero-note {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  margin: 10px 0 0;
  letter-spacing: 0.02em;
}

/* ---------- Hero Form Success State ---------- */
.template-hero-form.submitted .template-hero-form-row {
  display: none;
}
.template-hero-form.submitted .template-hero-note {
  display: none;
}
.template-hero-form.submitted {
  background: none;
  border-color: transparent;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.template-hero-form.submitted::after {
  content: attr(data-success);
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #34d399;
  padding: 18px 0;
  animation: successFadeIn 0.4s ease-out;
}

/* ---------- Template Meta ---------- */
.template-meta {
  display: none;
}

/* ---------- Article Content Override ---------- */
.template-page .article-content {
  max-width: 720px;
}

/* ---------- Feature List Cards ---------- */
.template-page .features-list {
  gap: 12px;
}

.template-page .feature-item {
  border: 1px solid var(--border-light);
  padding: 28px 28px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.template-page .feature-item:hover {
  border-color: #d1d5db;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 4px 16px -2px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.template-page .feature-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--text-main);
}

.template-page .feature-item p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.template-page .feature-item p:last-child {
  margin-bottom: 0;
}

.template-page .feature-item strong {
  color: var(--text-main);
  font-weight: 600;
}

/* ---------- CTA Box Override ---------- */
.template-page .cta-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-color: var(--border-light);
  position: relative;
  overflow: hidden;
  padding: 48px 40px;
}

.template-page .cta-box::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(5, 150, 105, 0.03);
  pointer-events: none;
}

.template-page .cta-box::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(5, 150, 105, 0.02);
  pointer-events: none;
}

.template-page .cta-box h3 {
  color: var(--text-main);
  position: relative;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.template-page .cta-box p {
  position: relative;
  font-size: 1rem;
  color: var(--text-muted);
}

.template-page .cta-box .btn-primary {
  position: relative;
  background: #059669;
  padding: 14px 32px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(5, 150, 105, 0.15);
}

.template-page .cta-box .btn-primary:hover {
  background: #047857;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 14px rgba(5, 150, 105, 0.25);
}

.template-page .cta-box .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.12);
}

/* ---------- Feature Image Polish ---------- */
.template-page .feature-image {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 4px 12px -4px rgba(15, 23, 42, 0.06);
  transition:
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.template-page .feature-image:hover {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 10px 28px -6px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.template-page .feature-image img {
  transition: transform 0.3s ease;
}

.template-page .feature-image:hover img {
  transform: scale(1.02);
}

/* ---------- Document Preview Enhancement (RFP Template) ---------- */
.template-page .template-preview-large {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 8px 24px -8px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.25s ease;
}

.template-page .template-preview-large:hover {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 12px 32px -8px rgba(15, 23, 42, 0.12);
}

/* ---------- Download Box & Icon ---------- */
.template-download-box {
  position: relative;
  overflow: hidden;
}

.template-download-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.1);
  border-radius: 12px;
  color: #059669;
  margin: 0 auto 20px;
}

/* ---------- Body Email Form ---------- */
.template-email-form {
  max-width: 440px;
  margin: 0 auto;
}

.template-email-row {
  display: flex;
  gap: 8px;
}

.template-email-input {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.template-email-input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.08);
}

.template-email-input::placeholder {
  color: var(--text-light);
  font-size: 0.85rem;
}

.template-email-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 13px 22px;
  font-size: 0.88rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: #ffffff;
  background: #059669;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.template-email-btn:hover {
  background: #047857;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
  transform: translateY(-1px);
}

.template-email-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.template-email-note {
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 0;
}

/* Body form success state */
.template-email-form.submitted .template-email-row {
  display: none;
}

.template-email-form.submitted::after {
  content: attr(data-success);
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #059669;
  padding: 18px 0;
  animation: successFadeIn 0.4s ease-out;
}

/* ---------- Sidebar - Template Overrides ---------- */
.template-page .resource-tag {
  color: #059669;
  background: rgba(5, 150, 105, 0.06);
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.template-page .related-item a {
  border-color: var(--border-light);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.template-page .related-item a:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .template-page .article-header-section {
    padding-bottom: 56px;
  }

  .template-page .article-header-section h1 {
    margin-bottom: 10px;
  }

  .template-hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 28px;
  }

  .template-hero-form {
    padding: 4px;
  }

  .template-hero-form-row {
    flex-direction: column;
    gap: 4px;
  }

  .template-hero-btn {
    width: 100%;
    min-height: 48px;
  }

  .template-page .cta-box {
    padding: 36px 24px;
  }

  .template-page .cta-box::before,
  .template-page .cta-box::after {
    display: none;
  }

  .template-download-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin-bottom: 16px;
  }

  .template-download-icon svg {
    width: 22px;
    height: 22px;
  }

  .template-page .feature-item {
    padding: 22px 20px;
  }
}

@media (max-width: 480px) {
  .template-hero-form {
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .template-hero-form-row {
    gap: 8px;
  }

  .template-hero-btn {
    min-height: 48px;
  }

  .template-page .cta-box {
    padding: 28px 20px;
  }

  .template-email-row {
    flex-direction: column;
  }

  .template-email-btn {
    width: 100%;
    padding: 13px;
    min-height: 48px;
  }
}
