.template-masthead {
  padding-bottom: clamp(26px, 3vw, 38px);
}

.template-library {
  width: min(100% - 48px, 1180px);
  margin-inline: auto;
  padding-bottom: clamp(72px, 9vw, 118px);
}

.template-library-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 22px;
  color: #ffffff;
  background: var(--document-teal);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 12px 30px rgba(7, 63, 59, 0.13);
}

.template-library-header p,
.template-library-header h2 {
  margin: 0;
}

.template-library-header p {
  color: var(--document-citron);
  font: 700 0.68rem/1.3 var(--document-utility);
  letter-spacing: 0.1em;
}

.template-library-header h2 {
  margin-top: 4px;
  font-size: 1rem;
  line-height: 1.4;
}

.template-library-header > span {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--document-teal-deep);
  background: var(--document-citron);
  border-radius: 999px;
  font: 700 0.76rem/1.35 var(--document-utility);
  font-variant-numeric: tabular-nums;
}

.template-list {
  margin: 0;
  padding: clamp(6px, 1vw, 12px) clamp(18px, 3vw, 34px);
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(7, 63, 59, 0.14);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  box-shadow:
    0 24px 52px rgba(7, 63, 59, 0.12),
    0 4px 10px rgba(7, 63, 59, 0.06);
}

.template-record {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(220px, 1fr) auto;
  gap: clamp(18px, 3vw, 38px);
  align-items: center;
  min-height: 132px;
  padding: 24px 4px 24px 18px;
  border-bottom: 1px solid var(--document-line);
}

.template-record:last-child {
  border-bottom: 0;
}

.template-record::before {
  content: "";
  position: absolute;
  top: 27px;
  bottom: 27px;
  left: 0;
  width: 5px;
  background: var(--template-accent);
  border-radius: 999px;
}

.template-code {
  margin: 0;
  color: var(--template-accent);
  font: 700 0.74rem/1.4 var(--document-utility);
  letter-spacing: 0.075em;
}

.template-copy h3,
.template-copy p {
  margin: 0;
}

.template-copy h3 {
  color: var(--document-teal-deep);
  font-size: clamp(1.05rem, 1.65vw, 1.3rem);
  line-height: 1.4;
  text-wrap: balance;
}

.template-copy p {
  margin-top: 6px;
  color: #607a76;
  font-size: 0.82rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.template-downloads {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.template-download {
  min-width: 172px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 8px 13px;
  color: var(--document-teal-deep);
  background: #ffffff;
  border: 1px solid rgba(10, 97, 91, 0.26);
  border-radius: 13px;
  text-decoration: none;
  box-shadow: 0 5px 14px rgba(7, 63, 59, 0.06);
  transition-property: color, background-color, border-color, box-shadow, transform;
  transition-duration: 160ms;
  transition-timing-function: ease-out;
}

.template-download:hover {
  color: var(--document-teal-deep);
  background: #f7faf8;
  border-color: var(--document-teal);
  box-shadow: 0 9px 20px rgba(7, 63, 59, 0.11);
  transform: translateY(-2px);
}

.template-download:active {
  transform: translateY(0) scale(0.96);
}

.template-download-icon {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  color: #ffffff;
  background: var(--document-purple);
  border-radius: 9px;
}

.template-download--pdf .template-download-icon {
  background: var(--document-teal);
}

.template-download strong,
.template-download small {
  display: block;
}

.template-download strong {
  font-size: 0.78rem;
  line-height: 1.35;
}

.template-download small {
  margin-top: 2px;
  color: #6c7f7c;
  font: 600 0.61rem/1.35 var(--document-utility);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .template-record {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .template-downloads {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .template-library {
    width: min(100% - 30px, 1180px);
  }

  .template-library-header {
    min-height: 0;
    padding: 15px 16px;
    border-radius: 16px 16px 0 0;
  }

  .template-library-header > span {
    display: none;
  }

  .template-list {
    padding: 4px 16px;
    border-radius: 0 0 16px 16px;
  }

  .template-record {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 22px 2px 22px 15px;
  }

  .template-code,
  .template-copy,
  .template-downloads {
    grid-column: 1;
  }

  .template-downloads {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 5px;
  }

  .template-download {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .template-download {
    transition: none;
  }

  .template-download:hover,
  .template-download:active {
    transform: none;
  }
}
