:root {
  --ink: #0d1524;
  --muted: #5a6577;
  --blue: #1427ee;
  --navy: #071a38;
  --cyan: #00a7c7;
  --green: #17a673;
  --amber: #f1a41f;
  --line: #dfe6f1;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: #eef3f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

.toolbar {
  max-width: 1120px;
  margin: 18px auto;
  padding: 0 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  font-family: Arial, Helvetica, sans-serif;
}

.toolbar button,
.toolbar a {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.page {
  width: min(1120px, calc(100% - 36px));
  aspect-ratio: 1.414 / 1;
  margin: 18px auto 36px;
  padding: 34px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(13, 21, 36, 0.18);
}

.certificate {
  position: relative;
  height: 100%;
  padding: 42px 54px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 8px solid var(--navy);
}

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

.certificate::before {
  inset: 18px;
  border: 2px solid var(--blue);
}

.certificate::after {
  right: -120px;
  bottom: -150px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(20, 39, 238, 0.14) 0 34%, transparent 35%),
    conic-gradient(from 20deg, rgba(23, 166, 115, 0.18), rgba(0, 167, 199, 0.18), rgba(241, 164, 31, 0.18), rgba(23, 166, 115, 0.18));
}

.header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
}

.logo {
  width: 255px;
}

.certificate-id {
  text-align: right;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.content {
  position: relative;
  z-index: 1;
  align-self: center;
  text-align: center;
}

.kicker {
  margin: 0 0 14px;
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.95;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.presented {
  margin: 30px 0 9px;
  color: var(--muted);
  font-size: 21px;
}

.name {
  display: inline-block;
  min-width: 520px;
  padding: 7px 18px 10px;
  border-bottom: 3px solid var(--navy);
  color: var(--blue);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.05;
}

.body-copy {
  max-width: 780px;
  margin: 22px auto 0;
  color: #263348;
  font-size: 22px;
  line-height: 1.55;
}

.editable {
  border-radius: 4px;
  padding: 0 4px;
  background: rgba(20, 39, 238, 0.08);
  outline: none;
}

.editable:focus {
  box-shadow: 0 0 0 3px rgba(20, 39, 238, 0.18);
}

.footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  gap: 28px;
  align-items: end;
}

.signature {
  min-height: 72px;
  display: grid;
  align-content: end;
  gap: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

.signature-line {
  border-top: 2px solid var(--navy);
}

.signature strong {
  color: var(--navy);
  font-size: 15px;
}

.signature span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.seal {
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--navy);
  border: 5px solid var(--blue);
  background: radial-gradient(circle, #ffffff 0 53%, rgba(20, 39, 238, 0.1) 54% 100%);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

.achievement .certificate {
  border-color: #102c4d;
}

.achievement .kicker,
.achievement .name {
  color: #0f6e55;
}

.achievement .certificate::before {
  border-color: var(--green);
}

.participation .certificate {
  border-color: #263348;
}

.participation .kicker,
.participation .name {
  color: #9a6208;
}

.participation .certificate::before {
  border-color: var(--amber);
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  body {
    background: #ffffff;
  }

  .toolbar {
    display: none;
  }

  .page {
    width: 297mm;
    height: 210mm;
    margin: 0;
    padding: 10mm;
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  .page {
    aspect-ratio: auto;
  }

  .certificate {
    min-height: 760px;
    padding: 32px 24px;
  }

  .header,
  .footer {
    grid-template-columns: 1fr;
    display: grid;
    text-align: center;
  }

  .logo {
    margin: 0 auto;
  }

  .certificate-id {
    text-align: center;
  }

  .name {
    min-width: 0;
    width: 100%;
  }

  .seal {
    margin: 0 auto;
  }
}
