.template-library-hero,
.template-directory,
.template-method,
.template-library-next,
.freelance-template-hero,
.template-use,
.template-workspace,
.template-safety,
.template-related {
  --template-ink: #101a3a;
  --template-copy: #50607e;
  --template-accent: #007c72;
  --template-accent-deep: #00645d;
  --template-rule: #d7e2ee;
  --template-paper: #f7fbff;
  --template-paper-warm: #fff9e9;
  --template-radius: 22px;
  color: var(--template-ink);
}

.template-library-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(58px, 8vw, 94px) 0 clamp(66px, 8vw, 102px);
  border-bottom: 1px solid var(--template-rule);
  background:
    radial-gradient(circle at 82% 15%, rgba(244, 200, 90, .3), transparent 25%),
    radial-gradient(circle at 68% 92%, rgba(102, 216, 202, .26), transparent 30%),
    linear-gradient(135deg, #f1fbff, #f7f4ff 56%, #fff8e3);
}

.template-library-hero::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: -120px;
  width: 430px;
  height: 430px;
  border: 1px dashed rgba(0, 124, 114, .2);
  border-radius: 50%;
  pointer-events: none;
}

.template-library-hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: clamp(48px, 8vw, 104px);
  align-items: center;
}

.template-library-hero__copy { max-width: 760px; }

.template-eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--template-accent-deep);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.template-library-hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3rem, 5.5vw, 5.45rem);
  line-height: .99;
  letter-spacing: -.055em;
}

.template-library-hero__copy > p {
  max-width: 650px;
  margin: 26px 0 0;
  color: var(--template-copy);
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  line-height: 1.62;
}

.template-library-hero .hero-actions { margin-top: 32px; }

.template-library-hero__visual {
  position: relative;
  min-height: 430px;
  margin: 0;
  display: grid;
  place-items: center;
}

.template-library-hero__visual img {
  position: relative;
  z-index: 3;
  width: min(72%, 280px);
  height: auto;
  transform: translate(34px, 24px);
  filter: drop-shadow(0 20px 24px rgba(16, 26, 58, .16));
}

.template-paper-stack {
  position: absolute;
  inset: 22px 44px 58px 0;
  z-index: 1;
}

.template-paper-stack span {
  position: absolute;
  width: 240px;
  height: 300px;
  padding: 25px;
  border: 1px solid rgba(16, 26, 58, .15);
  border-radius: 16px;
  color: var(--template-ink);
  background:
    linear-gradient(var(--template-rule), var(--template-rule)) 25px 72px / 70% 1px no-repeat,
    linear-gradient(var(--template-rule), var(--template-rule)) 25px 91px / 55% 1px no-repeat,
    #fff;
  box-shadow: 0 24px 54px rgba(31, 50, 88, .11);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.template-paper-stack span:nth-child(1) { left: 6%; top: 18%; transform: rotate(-9deg); background-color: #fff6d9; }
.template-paper-stack span:nth-child(2) { left: 24%; top: 8%; transform: rotate(3deg); background-color: #eaf3ff; }
.template-paper-stack span:nth-child(3) { left: 40%; top: 22%; transform: rotate(11deg); background-color: #e7faf5; }

.template-library-hero__visual figcaption {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 6px;
  max-width: 260px;
  padding: 14px 18px;
  border: 1px solid rgba(0, 124, 114, .25);
  border-radius: 14px;
  color: var(--template-ink);
  background: #e7faf5;
  box-shadow: 0 14px 32px rgba(16, 26, 58, .1);
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.4;
}

.template-heading { max-width: 790px; margin-bottom: 38px; }
.template-heading--compact { margin-bottom: 24px; }
.template-heading h2 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.3rem); line-height: 1.08; letter-spacing: -.042em; }
.template-heading p { margin: 16px 0 0; color: var(--template-copy); font-size: 1.07rem; line-height: 1.65; }

.template-directory { background: #fff; }
.template-bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(250px, auto)); gap: 20px; }

.template-card {
  position: relative;
  padding: clamp(24px, 3vw, 34px);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  overflow: hidden;
  border: 1px solid var(--template-rule);
  border-radius: var(--template-radius);
  color: var(--template-ink);
  background: #f4f9ff;
  text-decoration: none;
  box-shadow: 0 16px 42px rgba(27, 47, 88, .07);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), border-color .22s ease, box-shadow .22s ease;
}

.template-card:nth-child(1) { grid-column: 1 / 8; grid-row: 1 / 3; }
.template-card:nth-child(2) { grid-column: 8 / 13; grid-row: 1; background: #e9faf6; }
.template-card:nth-child(3) { grid-column: 8 / 13; grid-row: 2; background: #fff7d9; }
.template-card:nth-child(4) { grid-column: 1 / 7; grid-row: 3; background: #fff0e9; }
.template-card:nth-child(5) { grid-column: 7 / 13; grid-row: 3; background: #f3efff; }

.template-card:hover {
  transform: translateY(-5px);
  border-color: #8bb8c5;
  box-shadow: 0 24px 52px rgba(27, 47, 88, .13);
}

.template-card:focus-visible { outline: 3px solid #386fe8; outline-offset: 4px; }

.template-card__mark {
  position: relative;
  z-index: 2;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--template-accent);
  font-size: .95rem;
  font-weight: 800;
}

.template-card__body { position: relative; z-index: 2; align-self: end; }
.template-card small { color: var(--template-accent-deep); font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.template-card h3 { margin: 13px 0 10px; font-size: clamp(1.35rem, 2.2vw, 1.9rem); line-height: 1.12; letter-spacing: -.035em; }
.template-card p { margin: 0; color: var(--template-copy); line-height: 1.58; }
.template-card strong { display: inline-block; margin-top: 20px; color: var(--template-accent-deep); font-size: .88rem; }

.template-card--featured {
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(145deg, #e6f2ff, #f7fbff 58%, #e5faf5);
}

.template-card--featured .template-card__body { grid-column: 1 / -1; }
.template-card--featured h3 { max-width: 560px; font-size: clamp(1.9rem, 3.4vw, 3.15rem); }
.template-card__paper {
  position: relative;
  justify-self: end;
  width: min(72%, 300px);
  min-height: 180px;
  padding: 38px 28px;
  border: 1px solid rgba(16, 26, 58, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 38px rgba(27, 47, 88, .1);
  transform: rotate(4deg);
}

.template-card__paper::before { content: "Project proposal"; display: block; margin-bottom: 20px; color: var(--template-ink); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.template-card__paper span { display: block; width: 100%; height: 7px; margin-top: 10px; border-radius: 2px; background: #dce7f1; }
.template-card__paper span:nth-child(2) { width: 76%; }
.template-card__paper span:nth-child(4) { width: 62%; }

.template-method { border-block: 1px solid var(--template-rule); background: #eff7ff; }
.template-method__grid { display: grid; grid-template-columns: .7fr 1.3fr; gap: clamp(52px, 8vw, 112px); align-items: start; }
.template-method__list { display: grid; gap: 14px; }
.template-method__list > div { display: grid; grid-template-columns: 100px 1fr; gap: 8px 24px; padding: 22px 24px; border-radius: 16px; background: #fff; box-shadow: 0 10px 28px rgba(27, 47, 88, .06); }
.template-method__list span { grid-row: 1 / 3; color: var(--template-accent-deep); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.template-method__list strong { font-size: 1.05rem; }
.template-method__list p { margin: 0; color: var(--template-copy); font-size: .92rem; line-height: 1.52; }

.template-library-next { padding-top: 22px; background: #fff; }
.template-library-next__panel { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; padding: 36px 42px; border-radius: var(--template-radius); background: linear-gradient(120deg, #e3faf5, #edf3ff 66%, #fff3cc); }
.template-library-next__panel img { width: 112px; height: auto; }
.template-library-next__panel h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.55rem); letter-spacing: -.035em; }
.template-library-next__panel p { max-width: 720px; margin: 9px 0 0; color: var(--template-copy); line-height: 1.58; }

.freelance-template-hero { padding: 50px 0 70px; border-bottom: 1px solid var(--template-rule); background: linear-gradient(135deg, #eaf3ff, #f8faff 62%, #e7faf5); }
.freelance-template-hero--teal { background: linear-gradient(135deg, #e4faf5, #f5fbff 62%, #fff8dc); }
.freelance-template-hero--yellow { background: linear-gradient(135deg, #fff6d9, #fffaf0 62%, #e9f9f5); }
.freelance-template-hero--coral { background: linear-gradient(135deg, #fff0e9, #fff8ee 62%, #e7f8f5); }
.freelance-template-hero--violet { background: linear-gradient(135deg, #f2eeff, #faf8ff 62%, #e7f8f5); }
.freelance-template-hero__grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(285px, .55fr); gap: clamp(44px, 7vw, 86px); align-items: end; }
.template-breadcrumbs { display: flex; gap: 9px; align-items: center; margin-bottom: 30px; color: var(--template-copy); font-size: .84rem; }
.template-breadcrumbs a { color: var(--template-accent-deep); }
.freelance-template-hero h1 { max-width: 900px; margin: 0; font-size: clamp(2.8rem, 4.6vw, 4.7rem); line-height: 1; letter-spacing: -.052em; }
.freelance-template-hero__copy > p { max-width: 760px; margin: 22px 0 0; color: var(--template-copy); font-size: 1.16rem; line-height: 1.62; }
.freelance-template-hero__copy > .button { margin-top: 26px; }
.freelance-template-hero__aside { padding: 28px; border: 1px solid rgba(0, 124, 114, .22); border-radius: 19px; background: rgba(255, 255, 255, .8); box-shadow: 0 20px 44px rgba(27, 47, 88, .09); }
.freelance-template-hero__mark { width: 50px; height: 50px; margin-bottom: 25px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--template-accent); font-weight: 800; }
.freelance-template-hero__aside h2 { margin: 0 0 13px; font-size: 1.12rem; }
.freelance-template-hero__aside ul { margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.freelance-template-hero__aside li { padding: 7px 10px; border: 1px solid var(--template-rule); border-radius: 8px; color: var(--template-copy); background: #fff; font-size: .78rem; font-weight: 700; }

.template-use { background: #fff; }
.template-use__grid { display: grid; grid-template-columns: .72fr 1.28fr; gap: clamp(50px, 8vw, 112px); align-items: start; }
.template-use h2 { margin: 0; font-size: clamp(2rem, 3.5vw, 3rem); letter-spacing: -.04em; }
.template-use p { margin: 16px 0 0; color: var(--template-copy); font-size: 1.04rem; line-height: 1.68; }
.template-use ol { margin: 0; padding: 0; display: grid; gap: 13px; list-style: none; counter-reset: template-use; }
.template-use li { position: relative; min-height: 74px; padding: 20px 22px 20px 68px; border: 1px solid var(--template-rule); border-radius: 15px; color: var(--template-copy); background: var(--template-paper); line-height: 1.55; counter-increment: template-use; }
.template-use li::before { content: counter(template-use); position: absolute; left: 20px; top: 18px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--template-accent); font-size: .8rem; font-weight: 800; }

.template-workspace { scroll-margin-top: 80px; border-block: 1px solid var(--template-rule); background: #eff7ff; }
.template-workspace__heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 26px; }
.template-workspace__heading h2 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.1rem); letter-spacing: -.04em; }
.template-workspace__heading p { margin: 10px 0 0; color: var(--template-copy); }
.template-workspace__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.template-workspace__document { max-width: 920px; margin-inline: auto; padding: clamp(24px, 5vw, 58px); border: 1px solid #cedbe8; border-radius: 18px; background: #fff; box-shadow: 0 26px 65px rgba(27, 47, 88, .12); }
.template-workspace__document label { display: block; margin-bottom: 14px; color: var(--template-accent-deep); font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.template-workspace textarea { width: 100%; min-height: 760px; padding: 0; resize: none; overflow: hidden; border: 0; outline: 0; color: #1f2b47; background: transparent; font: 500 .96rem/1.72 "Courier New", ui-monospace, monospace; }
.template-workspace textarea:focus { box-shadow: inset 4px 0 0 var(--template-accent); padding-left: 18px; }
.template-workspace__footer { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--template-rule); }
.template-workspace__footer p { margin: 0; color: var(--template-copy); font-size: .84rem; }
.template-workspace__footer button { border: 0; padding: 5px; color: var(--template-accent-deep); background: transparent; font: inherit; font-size: .84rem; font-weight: 800; text-decoration: underline; cursor: pointer; }
.template-workspace__footer button:focus-visible { outline: 3px solid #386fe8; outline-offset: 3px; }

.template-safety { background: #fff; }
.template-safety__panel { display: grid; grid-template-columns: auto 1fr; gap: 20px; max-width: 920px; padding: 28px 30px; border-left: 4px solid var(--template-accent); border-radius: 0 16px 16px 0; background: #eaf9f5; }
.template-safety__panel > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--template-accent); font-family: Georgia, serif; font-weight: 800; }
.template-safety h2 { margin: 2px 0 8px; font-size: 1.28rem; }
.template-safety p { margin: 0; color: var(--template-copy); line-height: 1.64; }

.template-related { padding-top: 24px; background: #fff; }
.template-related__grid { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 14px; }
.template-related__grid a { min-height: 112px; padding: 23px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; border: 1px solid var(--template-rule); border-radius: 16px; color: var(--template-ink); background: var(--template-paper); text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.template-related__grid a:hover { transform: translateY(-4px); border-color: #82b7bb; }
.template-related__mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--template-accent); font-size: .78rem; font-weight: 800; }
.template-related__grid b { color: var(--template-accent-deep); font-size: 1.18rem; }

@media (max-width: 940px) {
  .template-library-hero__grid,
  .freelance-template-hero__grid,
  .template-method__grid,
  .template-use__grid { grid-template-columns: 1fr; }
  .template-library-hero__visual { width: min(100%, 500px); margin-inline: auto; }
  .template-bento { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .template-card:nth-child(n) { grid-column: auto; grid-row: auto; min-height: 260px; }
  .template-card:nth-child(1) { grid-column: 1 / -1; min-height: 440px; }
  .template-library-next__panel { grid-template-columns: auto 1fr; }
  .template-library-next__panel .button { grid-column: 2; justify-self: start; }
  .template-workspace__heading { display: grid; align-items: start; }
  .template-workspace__actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .template-library-hero { padding-top: 46px; }
  .template-library-hero h1 { font-size: clamp(2.7rem, 13vw, 4rem); }
  .template-library-hero__visual { min-height: 340px; }
  .template-paper-stack { inset-inline: 0; }
  .template-paper-stack span { width: 200px; height: 250px; }
  .template-library-hero__visual figcaption { right: 8px; }
  .template-bento { grid-template-columns: 1fr; }
  .template-card:nth-child(1) { grid-column: auto; min-height: 380px; }
  .template-card { grid-template-columns: 1fr; }
  .template-card--featured { grid-template-rows: auto auto auto; }
  .template-card__paper { width: 72%; min-height: 135px; }
  .template-method__list > div { grid-template-columns: 1fr; }
  .template-method__list span { grid-row: auto; }
  .template-library-next__panel { grid-template-columns: 1fr; padding: 28px 24px; }
  .template-library-next__panel .button { grid-column: auto; }
  .freelance-template-hero { padding-top: 34px; }
  .freelance-template-hero h1 { font-size: clamp(2.5rem, 12vw, 3.7rem); }
  .template-workspace__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .template-workspace__actions .button:first-child { grid-column: 1 / -1; }
  .template-workspace__document { padding: 24px 18px; }
  .template-workspace textarea { font-size: .88rem; }
  .template-workspace__footer { align-items: flex-start; flex-direction: column; }
  .template-related__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .template-card,
  .template-related__grid a { transition: none; }
}

@media print {
  body.printing-template .site-header,
  body.printing-template .freelance-template-hero,
  body.printing-template .template-use,
  body.printing-template .template-workspace__heading,
  body.printing-template .template-workspace__footer,
  body.printing-template .template-safety,
  body.printing-template .template-related,
  body.printing-template .site-footer,
  body.printing-template .scroll-top,
  body.printing-template .ad-slot {
    display: none !important;
  }
  body.printing-template .template-workspace {
    padding: 0;
    border: 0;
    background: #fff;
  }
  body.printing-template .template-workspace__document {
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body.printing-template .template-workspace__document label { display: none; }
  body.printing-template .template-workspace textarea {
    min-height: 0;
    color: #101a3a;
    font-size: 10pt;
  }
}
