.template-library,
.template-detail {
  overflow-x: hidden;
  background: #fff;
  color: #111827;
}

.template-library__hero,
.template-detail__hero {
  padding: 5rem 0;
  border-bottom: 1px solid #e2e8f0;
  background:
    radial-gradient(circle, rgba(148, 163, 184, 0.24) 1px, transparent 1px) 0 0 / 18px 18px,
    #f8fafc;
}

.template-library__hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.7fr);
  align-items: end;
  gap: 4rem;
}

.template-library__eyebrow {
  margin: 0 0 0.7rem;
  color: #2563eb;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.template-library__hero h1,
.template-detail__hero h1 {
  max-width: 52rem;
  margin: 0;
  color: #0f172a;
  font-size: clamp(2.45rem, 5vw, 4.5rem);
  font-weight: 700;
  line-height: 1.02;
}

.template-detail__hero h1 {
  font-size: clamp(2.4rem, 4.2vw, 3.75rem);
}

.template-library__lead,
.template-detail__lead {
  max-width: 48rem;
  margin: 1.35rem 0 0;
  color: #475569;
  font-size: 1.2rem;
  line-height: 1.6;
}

.template-library__hero-note {
  display: flex;
  gap: 1rem;
  padding: 1.2rem;
  border: 1px solid #dbeafe;
  border-radius: 0.9rem;
  background: #fff;
}

.template-library__hero-note i {
  display: inline-flex;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: #eff6ff;
  color: #2563eb;
}

.template-library__hero-note strong,
.template-library__hero-note span {
  display: block;
}

.template-library__hero-note span {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
}

.template-library__collection,
.template-library__steps,
.template-detail__section {
  padding: 5rem 0;
}

.template-library__section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3rem;
  margin-bottom: 2rem;
}

.template-library__section-heading h2,
.template-detail__section h2 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
}

.template-library__section-heading > p {
  max-width: 34rem;
  margin: 0;
  color: #64748b;
}

.template-library__section-heading--narrow {
  max-width: 42rem;
}

.template-card {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.template-card__topline,
.template-detail__preview-header,
.template-detail__preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
}

.template-card__topline {
  padding: 0 0.25rem 0.75rem;
}

.template-card__topline span:first-child {
  color: #2563eb;
}

.template-preview {
  display: grid;
  min-height: 12rem;
  align-content: center;
  gap: 1.15rem;
  padding: 1.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  background:
    radial-gradient(circle, var(--preview-dot, rgba(148, 163, 184, 0.35)) 1px, transparent 1px) 0 0 / 14px 14px,
    #f8fafc;
}

.template-preview__row {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.template-preview__row + .template-preview__row::before {
  position: absolute;
  top: -1.15rem;
  left: 50%;
  width: 1px;
  height: 1.15rem;
  background: var(--preview-border, #cbd5e1);
  content: "";
}

.template-preview__row span {
  display: inline-flex;
  min-width: 4.2rem;
  min-height: 2.15rem;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--preview-border, #bfdbfe);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--preview-accent, #2563eb);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.template-preview__row:first-child span {
  border-color: var(--preview-accent, #2563eb);
  background: var(--preview-soft, #eff6ff);
}

.template-preview__row:nth-child(2) span {
  background: var(--preview-soft, #eff6ff);
}

.template-preview__row--3 span {
  min-width: 0;
  flex: 0 1 5.7rem;
}

.template-card__body {
  flex: 1;
  padding: 1.15rem 0.25rem;
}

.template-card__body h3 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.template-card__body p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.55;
}

.template-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.template-step {
  height: 100%;
  padding: 1.5rem;
  border-top: 2px solid #bfdbfe;
  background: #f8fafc;
}

.template-step > span {
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 700;
}

.template-step h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.template-step p {
  margin: 0;
  color: #64748b;
  font-size: 0.92rem;
}

.template-library__steps,
.template-detail__section--soft {
  background: #f8fafc;
}

.template-library__cta,
.template-detail__cta {
  padding: 4rem 0;
  border-top: 1px solid #e2e8f0;
}

.template-library__cta-inner,
.template-detail__cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
}

.template-library__cta h2,
.template-detail__cta h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 700;
}

.template-library__cta p:last-child,
.template-detail__cta p:last-child {
  max-width: 45rem;
  margin: 0.65rem 0 0;
  color: #64748b;
}

.template-detail__back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 2.5rem;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.template-detail__back:hover {
  color: #2563eb;
}

.template-detail__note {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1.3rem 0 0;
  color: #475569;
  font-size: 0.85rem;
}

.template-detail__note i {
  color: #10b981;
}

.template-detail__preview-panel,
.template-detail__position-panel {
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.template-detail__preview-header,
.template-detail__preview-footer {
  padding: 0.8rem 1rem;
}

.template-detail__preview-header span:first-child {
  color: #0f172a;
  font-size: 0.85rem;
}

.template-preview--large {
  min-height: 23rem;
  border-width: 1px 0;
  border-radius: 0;
}

.template-preview--large .template-preview__row {
  gap: 1rem;
}

.template-preview--large .template-preview__row span {
  min-width: 7.5rem;
  min-height: 3.5rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.82rem;
}

.template-preview--large .template-preview__row--3 span {
  min-width: 0;
  flex: 0 1 9rem;
}

.template-detail__use-cases {
  display: grid;
  gap: 0.85rem;
  padding: 0;
  margin: 1.5rem 0 0;
  list-style: none;
}

.template-detail__use-cases li {
  display: flex;
  gap: 0.7rem;
  color: #334155;
}

.template-detail__use-cases i {
  margin-top: 0.25rem;
  color: #2563eb;
}

.template-detail__position-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.template-detail__position-heading h2 {
  font-size: 1.25rem;
}

.template-detail__position-heading > span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.template-detail__positions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.template-detail__positions article {
  display: flex;
  min-height: 5.3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.template-detail__positions article > div {
  min-width: 0;
}

.template-detail__positions article:nth-child(odd) {
  border-right: 1px solid #e2e8f0;
}

.template-detail__positions h3 {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 700;
}

.template-detail__positions p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
}

.template-detail__positions article > span {
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
}

.template-detail__faq .accordion-item {
  border-color: #dbe3ef;
}

.template-detail__faq .accordion-button {
  color: #0f172a;
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .template-library__hero,
  .template-detail__hero {
    padding: 3.75rem 0;
  }

  .template-library__hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .template-library__section-heading {
    display: block;
  }

  .template-library__section-heading > p {
    margin-top: 0.75rem;
  }
}

@media (max-width: 767.98px) {
  .template-library__hero h1,
  .template-detail__hero h1 {
    font-size: 2.5rem;
  }

  .template-library__collection,
  .template-library__steps,
  .template-detail__section {
    padding: 3.5rem 0;
  }

  .template-library__cta-inner,
  .template-detail__cta-inner {
    display: block;
  }

  .template-library__cta-inner .btn,
  .template-detail__cta-inner .btn {
    width: 100%;
    margin-top: 1.5rem;
  }

  .template-preview--large {
    min-height: 18rem;
  }

  .template-preview--large .template-preview__row {
    gap: 0.5rem;
  }

  .template-preview--large .template-preview__row span {
    min-width: 5rem;
    min-height: 3rem;
    font-size: 0.7rem;
  }

  .template-detail__positions {
    grid-template-columns: 1fr;
  }

  .template-detail__positions article:nth-child(odd) {
    border-right: 0;
  }
}

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

  .template-preview__row span {
    min-width: 3.6rem;
  }

  .template-preview--large .template-preview__row span {
    min-width: 0;
    flex: 1;
    padding: 0.45rem 0.25rem;
    font-size: 0.62rem;
  }
}
