:root {
  --dark: #333333;
  --orange: #ef762b;
  --grey: #8a8a8a;
  --offwhite: #f1f2f2;
  --line: rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--offwhite);
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--dark);
}

/* ---- top bar ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand img { height: 26px; display: block; }

.topbar-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grey);
}

main {
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem 1rem 3rem;
}

.card {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
}

.form-card {
  max-width: 480px;
  padding: 2.25rem;
}

.result-card {
  max-width: 760px;
  overflow: hidden;
}

.form-card h1 {
  font-family: "Fredoka", sans-serif;
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.muted { color: var(--grey); font-size: 0.9rem; margin: 0 0 1.5rem; line-height: 1.5; }

#verify-form { display: flex; gap: 0.5rem; }

#cert-id {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  font-family: "Poppins", monospace;
  font-size: 0.9rem;
  min-width: 0;
}

#cert-id:focus { outline: 2px solid var(--orange); outline-offset: 1px; }

button {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 1.3rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { opacity: 0.92; }
button:disabled { opacity: 0.6; cursor: default; }

.error {
  color: #b3401a;
  font-size: 0.85rem;
  margin: 1rem 0 0;
}

/* ---- result: status banner ---- */

.result-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.2rem 2.25rem;
}

.result-header.valid { background: var(--dark); }
.result-header.invalid { background: var(--grey); }

.badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex: none;
  font-size: 0.95rem;
}

.result-header.valid .badge { background: var(--orange); }
.result-header.invalid .badge { background: #6b6b6b; }

.result-header p { color: #fff; font-size: 0.92rem; font-weight: 500; margin: 0; }

/* ---- result: body ---- */

.result-body { padding: 2.25rem; }

/* ---- result: the certificate, live HTML (this IS the content - no separate field list, no image) ---- */

.cert-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.cert-preview-head p {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--grey);
  margin: 0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--orange);
  background: none;
  text-decoration: none;
  border: 1px solid var(--orange);
  border-radius: 7px;
  padding: 0.4rem 0.8rem;
  font-family: "Poppins", sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.download-btn:hover { background: var(--orange); color: #fff; }
.download-btn:disabled { opacity: 0.6; cursor: default; }

/* Fixed-pixel design (1100x850 = 11:8.5, same ratio as the emailed PDF) so
   html2canvas (which doesn't understand container-query units) captures it
   faithfully. Scaled down to fit on screen via a JS transform, see script.js. */

.cert-scale-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 11 / 8.5;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--line);
  background: #fff;
}

.cert {
  position: absolute;
  top: 0;
  left: 0;
  width: 1100px;
  height: 850px;
  display: flex;
  transform-origin: top left;
}

.cert-panel-dark {
  width: 374px;
  flex: none;
  background: var(--dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
  text-align: center;
}

.cert-logo { width: 196px; margin-bottom: 14px; }
.cert-tagline { font-size: 15px; letter-spacing: 0.18em; color: var(--offwhite); margin: 0 0 22px; }
.cert-rule { width: 80px; height: 2px; background: var(--orange); margin-bottom: 22px; }
.cert-kicker {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  color: var(--orange);
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 24px;
}

.cert-qr-wrap {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  line-height: 0;
}

.cert-scan-label { font-size: 13px; color: var(--offwhite); margin: 10px 0 2px; }

.cert-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
  text-decoration: underline;
}

.cert-id-text { font-size: 10px; color: var(--grey); margin: 8px 0 0; word-break: break-all; }
.cert-issued-text { font-size: 10px; color: var(--grey); margin: 2px 0 0; }

.cert-panel-light {
  width: 726px;
  flex: none;
  background: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
}

.cert-eyebrow { font-size: 17px; color: var(--grey); font-weight: 500; letter-spacing: 0.04em; margin: 0 0 10px; }

.cert-name {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 52px;
  color: var(--dark);
  margin: 0 0 28px;
  border-bottom: 3px solid var(--orange);
  display: inline-block;
  padding-bottom: 10px;
}

.cert-field { margin-bottom: 20px; }
.cert-label { display: block; font-size: 15px; font-weight: 600; color: var(--orange); letter-spacing: 0.03em; }
.cert-value { display: block; font-size: 20px; color: var(--dark); margin-top: 4px; line-height: 1.45; }

.cert-sig { margin-top: auto; padding-top: 24px; }
.cert-sig-line { width: 260px; border-top: 1px solid var(--dark); margin-bottom: 14px; }
.cert-signer { font-weight: 600; font-size: 21px; color: var(--dark); margin: 0; }
.cert-signer-title { font-size: 16px; color: var(--grey); margin: 3px 0 0; }

/* ---- dynamic verification statement (Udemy-style, below the certificate) ---- */

.cert-statement {
  margin-top: 1.5rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--grey);
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--grey);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: "Poppins", sans-serif;
}

.footer {
  margin-top: 2.5rem;
  font-size: 0.8rem;
  color: var(--grey);
  text-align: center;
}

.footer a { color: var(--grey); }

@media (max-width: 560px) {
  .topbar { padding: 1rem 1.25rem; }
  .topbar-label { display: none; }
  main { padding: 2.25rem 1rem 2.5rem; }
  .form-card, .result-body { padding: 1.5rem; }
  .result-header { padding: 1rem 1.5rem; }
  #verify-form { flex-direction: column; }
  button { padding: 0.75rem; }
}
