/* Tata letak dasar sertifikat — kanvas A4 lanskap 1123 x 794 px */
.cert-frame { position: relative; width: 100%; overflow: hidden; }
.cert-scaler { position: absolute; top: 0; left: 0; width: 1123px; height: 794px; transform-origin: 0 0; }

.cert-page {
  position: relative;
  width: 1123px;
  height: 794px;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body), Georgia, serif;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}
.cert-page *, .cert-page *::before, .cert-page *::after { box-sizing: border-box; }
.cert-orn { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cert-bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cert-wm { position: absolute; left: 50%; top: 50%; width: 380px; height: 380px; object-fit: contain; transform: translate(-50%, -46%); }

.cert-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Kop surat */
.cert-kop { display: flex; align-items: center; gap: 18px; color: var(--c-primary); }
.cert-kop .kop-logo { width: calc(78px * var(--kop-k) * var(--k)); height: calc(78px * var(--kop-k) * var(--k)); flex: none; display: flex; align-items: center; justify-content: center; }
.cert-kop .kop-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cert-kop .kop-text { flex: 1; text-align: center; line-height: 1.25; font-family: var(--f-body), serif; letter-spacing: .3px; }
.kop-rule { margin-top: calc(8px * var(--k)); height: 5px; border-top: 3px solid var(--c-primary); border-bottom: 1px solid var(--c-primary); flex: none; }

.cert-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 0;
  padding: calc(6px * var(--k)) 10px;
}
.cert-title {
  font-family: var(--f-title), serif;
  color: var(--c-primary);
  line-height: 1.05;
  text-transform: uppercase;
}
.cert-subtitle {
  font-family: var(--f-title), serif;
  color: var(--c-accent);
  font-size: calc(19px * var(--k));
  letter-spacing: 7px;
  text-transform: uppercase;
  margin-top: calc(4px * var(--k));
}
.cert-number { font-size: calc(14px * var(--k)); margin-top: calc(8px * var(--k)); letter-spacing: .6px; opacity: .9; }
.cert-given { font-size: calc(16px * var(--k)); margin-top: calc(14px * var(--k)); font-style: italic; opacity: .9; }
.cert-name {
  font-family: var(--f-name), cursive;
  color: var(--c-primary);
  line-height: 1.2;
  margin-top: calc(4px * var(--k));
  white-space: nowrap;
  max-width: 100%;
  padding: 0 12px;
}
.cert-rule { display: flex; align-items: center; gap: 10px; width: 520px; max-width: 80%; margin-top: calc(2px * var(--k)); }
.cert-rule span { flex: 1; height: 1.5px; background: linear-gradient(90deg, transparent, var(--c-accent)); }
.cert-rule span:last-child { background: linear-gradient(90deg, var(--c-accent), transparent); }
.cert-rule i { width: 9px; height: 9px; background: var(--c-accent); transform: rotate(45deg); flex: none; }
.cert-inst { font-size: calc(18px * var(--k)); font-weight: 600; margin-top: calc(8px * var(--k)); letter-spacing: .4px; }
.cert-body { margin-top: calc(12px * var(--k)); line-height: 1.55; max-width: 820px; }
.cert-body b { color: var(--c-primary); }

/* Kaki: QR + penanda tangan */
.cert-foot { display: flex; align-items: flex-end; gap: 22px; flex: none; }
.cert-foot.qr-right { flex-direction: row-reverse; }
.cert-qr { width: 104px; flex: none; text-align: center; font-size: 9px; line-height: 1.25; }
.cert-qr img, .cert-qr .qr-ph { width: 86px; height: 86px; display: block; margin: 0 auto 4px; padding: 5px; background: #fff; border-radius: 4px; image-rendering: pixelated; }
.cert-qr .qr-ph { border: 1px dashed #aaa; color: #aaa; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.cert-qr .qr-code { font-family: 'Courier New', monospace; font-size: 9px; letter-spacing: 1px; opacity: .75; margin-top: 1px; }

.cert-signers { flex: 1; display: flex; gap: 26px; justify-content: flex-end; }
.align-center .cert-signers { justify-content: center; }
.align-spread .cert-signers { justify-content: space-around; }
.qr-right .cert-signers { justify-content: flex-start; }
.qr-right.align-center .cert-signers { justify-content: center; }
.qr-right.align-spread .cert-signers { justify-content: space-around; }
.signer { width: 270px; text-align: center; font-size: calc(14px * var(--k)); line-height: 1.3; }
.cert-signers.n3 .signer, .cert-signers.n4 .signer { width: 230px; font-size: calc(13px * var(--k)); }
.cert-signers.n4 { gap: 12px; }
.cert-signers.n4 .signer { width: 200px; }
.s-date { margin-bottom: 2px; }
.s-title { font-weight: 600; min-height: 1.3em; }
.s-sign { position: relative; height: calc(84px * var(--k)); display: flex; align-items: center; justify-content: center; }
.s-sig { max-height: 100%; max-width: 200px; object-fit: contain; position: relative; z-index: 2; }
.s-stamp { position: absolute; left: 50%; top: 50%; width: calc(104px * var(--k)); height: calc(104px * var(--k)); object-fit: contain; transform: translate(-95%, -50%) rotate(-8deg); opacity: .88; z-index: 1; }
.s-name { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.s-nip { font-size: .9em; margin-top: 1px; }
