:root {
  --navy: #071d3b;
  --navy-deep: #03152d;
  --gold: #9a760a;
  --gold-light: #c9a033;
  --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-page {
  display: flex;
  justify-content: center;
  padding: 24px;
}

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

.certificate-fit {
  background: #f5f7fa;
  overflow: hidden;
}

.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;
  overflow: hidden;
  padding: 23mm 22mm 32mm;
  box-shadow: 0 8px 26px rgba(7, 18, 35, .16);
  transform: scale(var(--certificate-fit-scale, .45));
  transform-origin: top left;
}

.certificate-fit .certificate-sheet::before {
  inset: 3mm;
}

.certificate-fit .certificate-sheet::after {
  inset: 7mm;
}

.certificate-fit .ornamental-border {
  display: block;
}

.certificate-fit .certificate-header h1 {
  font-size: 56pt;
  line-height: .9;
  text-shadow: 2px 5px 0 rgba(0, 0, 0, .28);
  word-break: normal;
}

.certificate-fit .certificate-kicker {
  margin: 4mm 0 0;
  font-size: 23pt;
  text-shadow: 2px 4px 0 rgba(0, 0, 0, .25);
}

.certificate-fit .certificate-type {
  margin: 12mm 0 8mm;
  font-size: 23pt;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, .28);
}

.certificate-fit .certificate-details {
  table-layout: fixed;
}

.certificate-fit .certificate-details thead th {
  font-size: 15pt;
  padding: 2.7mm 5mm;
  white-space: normal;
}

.certificate-fit .certificate-details tbody th,
.certificate-fit .certificate-details tbody td {
  font-size: 14pt;
  height: 9.4mm;
  line-height: 1.15;
  padding: 1.7mm 4mm;
  text-shadow: 1px 2px 0 rgba(0, 0, 0, .18);
  overflow-wrap: anywhere;
  white-space: normal;
}

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

.certificate-fit .certificate-note {
  margin: 5mm 1mm 0;
  font-size: 13.5pt;
}

.certificate-fit .certificate-verification {
  margin-top: 2mm;
}

.certificate-fit .qr-slot {
  width: 29mm;
  height: 29mm;
}

.certificate-fit .seal {
  width: 31mm;
  height: 31mm;
}

.certificate-fit .certificate-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 27mm;
  margin: 0;
  padding: 3mm 18mm 4mm;
}

.certificate-fit .certificate-footer::before {
  height: 2mm;
}

.certificate-fit .footer-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12mm;
  font-size: 15pt;
}

.certificate-fit .footer-title strong {
  white-space: nowrap;
}

.certificate-fit .footer-title span {
  display: block;
}

.certificate-fit .footer-grid {
  grid-template-columns: 1.55fr .75fr .9fr;
  gap: 5mm;
  margin-top: 3.5mm;
}

.certificate-fit .footer-item {
  gap: 4mm;
}

.certificate-fit .footer-item p {
  font-size: 11.5pt;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.certificate-fit .footer-item.email {
  grid-column: 2 / 4;
  justify-self: center;
  margin-top: -1.5mm;
}

.certificate-fit .footer-icon {
  flex-basis: 8.5mm;
  width: 8.5mm;
  height: 8.5mm;
}

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

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

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

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

.certificate-header {
  position: relative;
  text-align: center;
  text-transform: uppercase;
  z-index: 1;
}

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

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

.certificate-type {
  margin: 12mm 0 8mm;
  color: var(--gold);
  font-size: 23pt;
  font-weight: 900;
  line-height: 1.12;
  text-transform: none;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, .28);
}

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

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

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

.certificate-details tbody th,
.certificate-details tbody td {
  border-top: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 14pt;
  height: 9.4mm;
  line-height: 1.15;
  padding: 1.7mm 4mm;
  text-align: left;
  text-shadow: 1px 2px 0 rgba(0, 0, 0, .18);
  vertical-align: middle;
}

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

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

.certificate-note {
  position: relative;
  z-index: 1;
  margin: 5mm 1mm 0;
  font-size: 13.5pt;
  font-weight: 700;
  line-height: 1.3;
}

.certificate-verification {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 2mm;
}

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

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

.seal {
  width: 31mm;
  height: 31mm;
  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;
  min-height: 27mm;
  padding: 3mm 18mm 4mm;
  background: linear-gradient(180deg, var(--navy) 0, var(--navy-deep) 100%);
  color: #fff;
}

.certificate-footer::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2mm;
  content: "";
  background: var(--gold);
}
.footer-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12mm;
  font-size: 15pt;
  line-height: 1;
  text-align: center;
}

.footer-title span {
  height: 1.4px;
  background: var(--gold);
}

.footer-title strong {
  font-weight: 400;
  white-space: nowrap;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.55fr .75fr .9fr;
  gap: 5mm;
  align-items: center;
  margin-top: 3.5mm;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 4mm;
  min-width: 0;
}

.footer-item p {
  margin: 0;
  font-size: 11.5pt;
  line-height: 1.18;
}

.footer-item:not(.address):not(.email) p {
  white-space: nowrap;
}

.footer-item.email {
  grid-column: 2 / 4;
  justify-self: center;
  margin-top: -1.5mm;
}

.footer-icon {
  flex: 0 0 8.5mm;
  width: 8.5mm;
  height: 8.5mm;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* .footer-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12mm;
  font-size: 15pt;
  line-height: 1;
  text-align: center;
}

.footer-title span {
  height: 1.4px;
  background: var(--gold);
}

.footer-title strong {
  font-weight: 400;
  white-space: nowrap;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.55fr .75fr .9fr;
  gap: 5mm;
  align-items: center;
  margin-top: 3.5mm;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 4mm;
  min-width: 0;
}

.footer-item p {
  margin: 0;
  font-size: 11.5pt;
  line-height: 1.18;
}

.footer-item:not(.address):not(.email) p {
  white-space: nowrap;
}

.footer-item.email {
  grid-column: 2 / 4;
  justify-self: center;
  margin-top: -1.5mm;
}

.footer-icon {
  position: relative;
  flex: 0 0 8.5mm;
  width: 8.5mm;
  height: 8.5mm;
  border-radius: 50%;
  background: var(--gold);
}

.footer-icon::before,
.footer-icon::after {
  position: absolute;
  content: "";
} */

/* .location-icon {
  background: transparent;
  border: 2px solid #fff;
  border-top: 0;
  border-radius: 0 0 50% 50%;
}

.location-icon::before {
  top: -4mm;
  left: 2.1mm;
  width: 5mm;
  height: 5mm;
  border-radius: 50% 50% 50% 0;
  background: var(--gold);
  transform: rotate(-45deg);
}

.location-icon::after {
  top: -2.3mm;
  left: 3.65mm;
  width: 1.8mm;
  height: 1.8mm;
  border-radius: 50%;
  background: #fff;
}

.phone-icon::before {
  inset: 2.1mm;
  border: 1.4px solid #fff;
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.phone-icon::after {
  right: 1.9mm;
  bottom: 1.6mm;
  width: 2.5mm;
  height: 1.5mm;
  border-radius: 1mm;
  background: #fff;
  transform: rotate(42deg);
}

.mobile-icon::before {
  top: 1.7mm;
  left: 3.1mm;
  width: 2.8mm;
  height: 5.6mm;
  border: 1.2px solid #fff;
  border-radius: .8mm;
}

.mobile-icon::after {
  bottom: 2.2mm;
  left: 4.2mm;
  width: .7mm;
  height: .7mm;
  border-radius: 50%;
  background: #fff;
}

.mail-icon::before {
  top: 2.6mm;
  left: 2mm;
  width: 5mm;
  height: 3.8mm;
  border: 1.3px solid #fff;
  border-radius: .4mm;
}

.mail-icon::after {
  top: 2.8mm;
  left: 2.2mm;
  width: 4.6mm;
  height: 3mm;
  border-right: 1.3px solid #fff;
  border-bottom: 1.3px solid #fff;
  transform: rotate(45deg) skew(-8deg, -8deg);
} */

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

@media print {
  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 {
    justify-content: center;
    overflow-x: hidden;
    padding: 8px;
  }

  .certificate-sheet {
    width: 100%;
    min-height: auto;
    padding: 16px 12px 0;
    box-shadow: 0 8px 26px rgba(7, 18, 35, .16);
    overflow: hidden;
  }

  .certificate-sheet::before {
    inset: 6px;
  }

  .certificate-sheet::after {
    inset: 11px;
  }

  .ornamental-border {
    display: none;
  }

  .certificate-header h1 {
    font-size: clamp(22px, 9vw, 42px);
    line-height: 1;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    text-shadow: 1px 3px 0 rgba(0, 0, 0, .22);
  }

  .certificate-kicker {
    margin-top: 8px;
    font-size: clamp(18px, 6vw, 26px);
    text-shadow: 1px 2px 0 rgba(0, 0, 0, .18);
  }

  .certificate-type {
    margin: 18px 0 14px;
    font-size: clamp(16px, 5vw, 23px);
    text-shadow: 1px 2px 0 rgba(0, 0, 0, .18);
  }

  .certificate-details thead th {
    font-size: 11px;
    padding: 7px 4px;
    word-break: break-word;
    white-space: normal;
  }
  .certificate-details tbody th,
  .certificate-details tbody td {
    font-size: 11px;
    height: auto;
    line-height: 1.25;
    padding: 6px 5px;
    text-shadow: none;
    word-break: break-word;
    white-space: normal;
  }

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

  .certificate-note {
    margin: 14px 2px 0;
    font-size: 12px;
  }

  .certificate-verification {
    margin-top: 10px;
  }

  .qr-slot,
  .seal {
    width: 74px;
    height: 74px;
  }

  .certificate-footer {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    min-height: auto;
    margin: 16px -12px 0;
    padding: 10px 12px 12px;
  }

  .certificate-footer::before {
    height: 4px;
  }

  .footer-title {
    display: block;
    font-size: 13px;
  }

  .footer-title strong {
    white-space: normal;
  }

  .footer-title span {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 9px;
  }

  .footer-item {
    gap: 7px;
  }

  .footer-item p {
    font-size: 10px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .footer-item.email {
    grid-column: auto;
    justify-self: start;
    margin-top: 0;
  }

  .footer-icon {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
  }
}
