.template-picker {
  margin: 4px 0;
  padding: 0;
  border: 0;
}
.template-picker legend {
  margin-bottom: 7px;
  color: #31465a;
  font-size: 13px;
  font-weight: 900;
}
.template-picker > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.template-card {
  position: relative;
  display: grid;
  min-height: 178px;
  align-content: start;
  gap: 8px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--template-accent) 45%, #d8e2e4);
  box-shadow: 0 12px 24px rgba(19, 36, 58, .08);
}
.template-card:has(input:checked) {
  border-color: var(--template-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--template-accent) 14%, transparent);
}
.template-card input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}
.template-card-check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--template-accent);
  font-size: 12px;
  font-weight: 900;
}
.template-card:has(input:checked) .template-card-check { display: grid; }
.template-swatch {
  width: 34px;
  height: 6px;
  margin-bottom: 6px;
  border-radius: 99px;
  background: var(--template-accent);
}
.template-card strong { padding-right: 24px; font-size: 16px; line-height: 1.25; }
.template-card small { color: var(--template-accent); font-weight: 800; }
.template-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.5; }
.template-preview-link {
  align-self: end;
  margin-top: 4px;
  color: var(--template-accent);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--template-accent) 40%, transparent);
  text-underline-offset: 4px;
}
.template-gallery-hero { align-items: center; }
.template-gallery { display: grid; gap: 26px; }
.template-showcase {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(19, 36, 58, .07);
}
.template-showcase > header,
.template-showcase > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
}
.template-showcase > header { border-bottom: 1px solid var(--line); }
.template-showcase > header > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 12px; }
.template-showcase > header .template-swatch { grid-row: 1 / 3; margin: 0; width: 8px; height: 48px; }
.template-showcase h2 { margin: 0; font-size: 24px; }
.template-showcase header p,
.template-showcase footer p { margin: 0; color: var(--muted); line-height: 1.5; }
.template-showcase header p { font-size: 12px; }
.template-showcase footer { border-top: 1px solid var(--line); }
.template-showcase footer p { max-width: 720px; }
.template-live-preview {
  position: relative;
  height: min(480px, 38vw);
  min-height: 320px;
  overflow: hidden;
  background: #e9eef0;
}
.template-live-preview iframe {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1440px;
  height: 920px;
  border: 0;
  background: #fff;
  transform: translateX(-50%) scale(.52);
  transform-origin: top center;
  pointer-events: none;
}
@media (max-width: 900px) {
  .template-live-preview { height: 400px; }
  .template-live-preview iframe { transform: translateX(-50%) scale(.44); }
}
@media (max-width: 680px) {
  .template-grid { grid-template-columns: 1fr; }
  .template-showcase > header,
  .template-showcase > footer { align-items: stretch; flex-direction: column; }
  .template-live-preview { height: 310px; min-height: 310px; }
  .template-live-preview iframe { transform: translateX(-50%) scale(.34); }
}
