/* Certificate Maker — layout + the self-hosted script fonts used for the
   recipient name on the certificate canvas. The fonts are the same Google
   Fonts latin subsets (SIL OFL 1.1) already self-hosted for the Signature
   Maker, so previews work offline and no name is sent to a font server. */

@font-face {
  font-family: "Great Vibes";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/great-vibes-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Alex Brush";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/alex-brush-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Allura";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/allura-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/dancing-script-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Sacramento";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/sacramento-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/caveat-latin.woff2") format("woff2");
}

/* Trust bar (same pattern as the Signature Maker) */
.cm-trust {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 0 0 16px; padding: 10px 14px;
  background: var(--ok-bg); color: var(--ok);
  border: 1px solid var(--line); border-radius: 12px;
  font-size: .92rem; font-weight: 600;
}

/* Template picker — card grid with live mini renders (mirrors the CV
   Maker picker pattern) */
.cm-tpl-grid {
  display: grid; gap: 12px; margin: 8px 0 4px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
@media (max-width: 640px) { .cm-tpl-grid { grid-template-columns: 1fr 1fr; gap: 9px; } }
.cm-tpl-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px; border: 2px solid var(--line-strong); border-radius: 12px;
  background: var(--input-bg); color: var(--ink);
  font: inherit; cursor: pointer; text-align: left;
  position: relative;
}
.cm-tpl-card:hover { border-color: var(--accent, #7c3aed); }
.cm-tpl-card.selected {
  border-color: var(--accent, #7c3aed);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #7c3aed) 35%, transparent);
}
.cm-tpl-card.selected::after {
  content: "✓ In use";
  position: absolute; top: 14px; right: 14px;
  background: var(--accent, #7c3aed); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.cm-tpl-mini {
  display: block; width: 100%; height: auto; border-radius: 6px;
  border: 1px solid var(--line); background: #fff;
}
.cm-tpl-card-name { font-weight: 700; font-size: .95rem; }
.cm-tpl-card-desc { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.cm-tpl-card-view { color: var(--accent, #7c3aed); font-size: .8rem; font-weight: 600; }

/* Template preview modal (mirrors the CV Maker modal) */
.cm-tpl-modal {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
}
.cm-tpl-modal[hidden] { display: none !important; }
.cm-tpl-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 15, 26, .66); }
.cm-tpl-modal-box {
  position: relative;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  width: min(94vw, 880px); max-height: 92vh;
  display: flex; flex-direction: column;
  padding: 16px; gap: 10px;
}
.cm-tpl-modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cm-tpl-modal-head h2 { margin: 0; font-size: 1.25rem; }
.cm-tpl-modal-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.cm-tpl-modal-stage {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; overflow: auto; flex: 1; min-height: 0;
}
.cm-tpl-modal-stage canvas {
  display: block; width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); background: #fff;
}
.cm-tpl-modal-note { margin: 0; color: var(--muted); font-size: .88rem; }
.cm-tpl-modal-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
body.cm-modal-lock { overflow: hidden; }

/* Live preview */
.cm-preview-wrap {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; background: var(--surface-muted, rgba(127, 127, 127, .06));
}
.cm-preview-wrap canvas {
  display: block; width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); background: #fff;
}
.cm-verify-link { word-break: break-all; font-size: .85rem; }

/* Verification result (verify-certificate.html) */
.cv-result { text-align: center; padding: 10px 4px 4px; }
.cv-badge {
  display: inline-block; padding: 8px 20px; border-radius: 999px;
  font-weight: 700; font-size: 1.05rem; margin-bottom: 14px;
}
.cv-badge.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }
.cv-badge.bad { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.cv-table { margin: 0 auto; text-align: left; border-collapse: collapse; }
.cv-table th, .cv-table td { padding: 7px 14px 7px 0; vertical-align: top; }
.cv-table th { color: var(--faint); font-weight: 600; white-space: nowrap; }
