:root {
  --navy: #071d3b;
  --gold: #9a760a;
  --ink: #061a35;
  --line: rgba(5, 22, 45, .58);
  --paper: #f7f5ef;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #dfe3e8;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.certificate-download-control {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 5px;
  background: var(--navy);
  box-shadow: 0 8px 24px rgba(7, 18, 35, .24);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 12px 16px;
  text-decoration: none;
}

.certificate-download-control:hover,
.certificate-download-control:focus-visible {
  background: #0b5ea8;
}

.certificate-export .certificate-download-control,
.certificate-pdf-mode .certificate-download-control {
  display: none;
}

.certificate-page {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.certificate-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  overflow: hidden;
  padding: 12mm 20mm 58mm;
  background:
    linear-gradient(90deg, rgba(154, 118, 10, .14), transparent 12mm, transparent calc(100% - 12mm), rgba(154, 118, 10, .14)),
    radial-gradient(circle at 52% 26%, rgba(255, 255, 255, .9), rgba(255, 255, 255, .14) 36%, transparent 62%),
    repeating-linear-gradient(88deg, rgba(7, 29, 59, .015) 0, rgba(7, 29, 59, .015) 1px, transparent 1px, transparent 9px),
    var(--paper);
  box-shadow: 0 18px 55px rgba(7, 18, 35, .22);
}

.certificate-sheet::before,
.certificate-sheet::after,
.ornamental-border {
  pointer-events: none;
  position: absolute;
  content: "";
  z-index: 5;
}

.certificate-sheet::before {
  inset: 3mm;
  border: 1px solid rgba(154, 118, 10, .45);
}

.certificate-sheet::after {
  inset: 7mm;
  border: 1px solid rgba(7, 29, 59, .11);
}

.ornamental-border {
  inset: 9mm;
  border-left: 6px double rgba(7, 29, 59, .07);
  border-right: 6px double rgba(7, 29, 59, .07);
}

.certificate-watermark {
  position: absolute;
  top: 51%;
  left: 50%;
  z-index: 0;
  width: 118mm;
  max-height: 78mm;
  object-fit: contain;
  opacity: .12;
  filter: grayscale(1);
  transform: translate(-50%, -50%);
}

.certificate-header,
.certificate-details,
.certificate-note,
.certificate-verification {
  position: relative;
  z-index: 2;
}

.certificate-header {
  text-align: center;
  text-transform: uppercase;
}

.certificate-brand-logo {
  display: block;
  width: 58mm;
  max-height: 20mm;
  margin: 0 auto 1.5mm;
  object-fit: contain;
}

.certificate-header h1 {
  margin: 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46pt;
  font-weight: 700;
  line-height: .9;
  text-shadow: 2px 4px 0 rgba(0, 0, 0, .24);
}

.certificate-kicker {
  margin: 2.5mm 0 0;
  color: var(--navy);
  font-size: 19pt;
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 3px 0 rgba(0, 0, 0, .2);
}

.certificate-type {
  margin: 6mm 0 5mm;
  color: var(--gold);
  font-size: 19pt;
  font-weight: 900;
  line-height: 1.12;
  text-transform: none;
  text-shadow: 1px 2px 0 rgba(0, 0, 0, .2);
}

.certificate-details {
  width: 100%;
  border: 2px solid rgba(5, 22, 45, .66);
  border-collapse: collapse;
  table-layout: fixed;
  background: rgba(255, 255, 255, .5);
  box-shadow: 0 2px 4px rgba(5, 22, 45, .15);
}

.certificate-details col:first-child,
.certificate-details th:first-child {
  width: 40%;
}

.certificate-details thead th {
  padding: 2mm 4mm;
  background: var(--navy);
  color: #fff;
  font-size: 13pt;
  font-weight: 900;
  text-align: center;
}

.certificate-details tbody th,
.certificate-details tbody td {
  height: 7.7mm;
  padding: 1.2mm 3mm;
  border-top: 1.4px solid var(--line);
  color: var(--ink);
  font-size: 11.5pt;
  line-height: 1.15;
  text-align: left;
  vertical-align: middle;
}

.certificate-details tbody th {
  border-right: 1.4px solid var(--line);
  font-weight: 800;
}

.certificate-details tbody td {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.certificate-note {
  margin: 3.5mm 1mm 0;
  font-size: 10.5pt;
  font-weight: 700;
  line-height: 1.3;
}

.certificate-verification {
  position: absolute;
  right: 20mm;
  bottom: 27mm;
  left: 20mm;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 29mm;
}

.qr-slot {
  display: grid;
  place-items: center;
  width: 27mm;
  height: 27mm;
  overflow: hidden;
  border: 1.5px solid #111;
  background: #fff;
  color: rgba(7, 29, 59, .5);
  font-size: 8pt;
  font-weight: 700;
}

.qr-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.seal {
  width: 29mm;
  height: 29mm;
  border-radius: 50%;
  object-fit: cover;
  object-position: 42% 48%;
  filter: saturate(.92) contrast(1.06);
}

.certificate-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  height: 23.7mm;
  overflow: hidden;
  background: #fff;
}

.certificate-footer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.certificate-fit {
  min-height: 100vh;
  overflow: hidden;
  background: #f5f7fa;
}

.certificate-fit .certificate-page {
  display: block;
  position: relative;
  width: var(--certificate-fit-width, 360px);
  height: var(--certificate-fit-height, 510px);
  min-height: var(--certificate-fit-height, 510px);
  margin: 0 auto;
  overflow: visible;
  padding: 0;
}

.certificate-fit .certificate-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  box-shadow: 0 8px 26px rgba(7, 18, 35, .16);
  transform: scale(var(--certificate-fit-scale, .45));
  transform-origin: top left;
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  .certificate-download-control {
    display: none;
  }

  body {
    background: #fff;
  }

  .certificate-page {
    display: block;
    padding: 0;
  }

  .certificate-sheet {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    box-shadow: none;
  }
}

@media screen and (max-width: 860px) {
  body {
    background: #f5f7fa;
  }

  .certificate-page {
    padding: 8px;
  }
}
