/* ZERO Freerunning — Open Dag Certificaat */

:root {
  --red: #C02026;
  --red-dark: #8E161B;
  --ink: #111111;
  --muted: #555555;
  --line: #e2e2e2;
  --white: #ffffff;
  --gold: #D4AF37;
  --bg: #e8e8e8;
  --panel: rgba(255, 255, 255, 0.96);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.no-print {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 12px;
}

.ui-header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.02em;
}

.ui-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
  margin-top: 16px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid-top {
  grid-template-columns: 1.4fr 1fr;
}

.form-grid-coach {
  grid-template-columns: 1fr 1.4fr;
  margin-top: 18px;
}

@media (max-width: 800px) {
  .form-grid-top,
  .form-grid-coach { grid-template-columns: 1fr; }
}

.field label,
.missions-fieldset legend {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: #333;
}

.optional,
.legend-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: #888;
  font-size: 0.78rem;
}

.field input[type="text"],
.field input[type="date"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-size: 0.98rem;
  background: #fff;
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: transparent;
}

.field-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-message { position: relative; }

.char-counter {
  margin-top: 4px;
  text-align: right;
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
}

.missions-fieldset {
  margin: 18px 0 0;
  padding: 14px 14px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.missions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 700px) {
  .missions-grid { grid-template-columns: repeat(2, 1fr); }
}

.mission-option {
  position: relative;
  display: flex;
  align-items: stretch;
  cursor: pointer;
  margin: 0;
}

.mission-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.mission-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  padding: 0.7rem 0.55rem;
  border-radius: 10px;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  color: #333;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
  line-height: 1.25;
  min-height: 48px;
}

.mission-option.is-checked .mission-chip {
  border-color: var(--red);
  background: rgba(192, 32, 38, 0.08);
  color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.mission-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mission-option:not(.is-disabled):hover .mission-chip {
  border-color: #bbb;
}

.missions-count {
  margin: 10px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.78rem 1.15rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 6px 16px rgba(192, 32, 38, 0.28);
}

.btn-primary:hover { background: var(--red-dark); }

.btn-secondary {
  background: #111;
  color: #fff;
}

.btn-secondary:hover { background: #000; }

.btn-ghost {
  background: #fff;
  color: #444;
  border: 1px solid var(--line);
  font-weight: 600;
}

.btn-ghost:hover { background: #f5f5f5; }

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.preview-label {
  margin: 24px 0 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #777;
}

.stage {
  display: flex;
  justify-content: center;
  padding: 0 12px 48px;
}

/* ===== Certificate ===== */

.certificate {
  position: relative;
  width: min(100%, 1000px);
  aspect-ratio: 297 / 210;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  container-name: cert;
}

.cert-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}



.content-panel {
  position: absolute;
  z-index: 3;
  left: 20%;
  width: 60%;
  top: 31%;
  height: 46%;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 1% 2% 0.5%;
  overflow: visible;
}

.cert-intro {
  margin: 0;
  font-size: clamp(9px, 1.55cqw, 15px);
  font-weight: 600;
  color: #333;
  letter-spacing: 0.01em;
}

.cert-name {
  margin: 0.35em 0 0.25em;
  width: 100%;
  font-size: clamp(16px, 5.1cqw, 52px);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-height: 2.4em;
  overflow: hidden;
  flex-shrink: 0;
  min-height: 1.15em;
}

.cert-name.is-placeholder {
  color: #bbb;
  font-weight: 700;
}

.cert-reason {
  margin: 0.15em 0 0;
  max-width: 34em;
  font-size: clamp(8px, 1.4cqw, 13.5px);
  font-weight: 600;
  color: #333;
  line-height: 1.35;
}

.missions-row {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  gap: 0.4em 0.7em;
  margin-top: 0.85em;
  width: 100%;
  max-width: 100%;
}

.missions-row[hidden] { display: none !important; }

.mission-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.28em 0.7em 0.28em 0.5em;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--badge-accent, var(--red));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  color: var(--badge-accent, var(--red));
  max-width: 100%;
  overflow: visible;
  line-height: 1.1;
}

.mission-badge-icon {
  width: clamp(10px, 1.55cqw, 16px);
  height: clamp(10px, 1.55cqw, 16px);
  display: inline-flex;
  flex-shrink: 0;
  overflow: visible;
}

.mission-badge-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  flex-shrink: 0;
  overflow: visible;
}

.mission-badge-label {
  font-size: clamp(6px, 1.05cqw, 10.5px);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  padding-left: 0.1em;
  overflow: visible;
}

.cert-date {
  margin: 0.7em 0 0;
  font-size: clamp(8px, 1.25cqw, 12.5px);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coach-quote {
  margin: 0.55em 0 0;
  max-width: 32em;
  padding: 0;
  border: 0;
}

.coach-quote[hidden] { display: none !important; }

.coach-message {
  margin: 0;
  font-size: clamp(8px, 1.3cqw, 13px);
  font-weight: 600;
  font-style: italic;
  color: #222;
  line-height: 1.35;
}

.coach-by {
  margin-top: 0.25em;
  font-size: clamp(7px, 1.15cqw, 11.5px);
  font-weight: 800;
  color: var(--red);
  font-style: normal;
}


/* Bottom CTA band */
.cta-block {
  position: absolute;
  z-index: 4;
  left: 28%;
  right: 24%;
  bottom: 5%;
  height: auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.cta-copy {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-right: 0;
}

.cta-title {
  margin: 0 0 0.35em;
  font-size: clamp(9px, 1.55cqw, 15px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.cta-link {
  display: inline-block;
  font-size: clamp(8px, 1.3cqw, 13px);
  font-weight: 800;
  color: var(--red);
  text-decoration: none;
}

.cta-link:hover,
.cta-link:focus-visible {
  text-decoration: underline;
  outline: none;
}




/* Socials under gold L */
.social-block {
  position: absolute;
  z-index: 5;
  left: 13.35%;
  bottom: 3.4%;
  width: 14%;
  transform: translateX(-50%);
  text-align: center;
}

.social-caption {
  margin: 0 0 0.3em;
  font-size: clamp(5px, 0.85cqw, 8.5px);
  font-weight: 700;
  color: #666;
  line-height: 1.15;
}

.social-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
}

.social-icon {
  width: clamp(10px, 1.7cqw, 18px);
  height: clamp(10px, 1.7cqw, 18px);
  color: var(--red);
  display: inline-flex;
  text-decoration: none;
  transition: color .15s ease, transform .15s ease;
}

.social-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.social-icon:hover,
.social-icon:focus-visible {
  color: var(--red-dark);
  transform: translateY(-1px);
  outline: none;
}

.share-canvas {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1080px;
  height: 1920px;
  pointer-events: none;
  opacity: 0;
}



@container cert (max-width: 520px) {
  .content-panel {
    left: 16%;
    width: 68%;
    top: 22%;
    height: 58%;
    padding: 1.2% 2.2% 0.8%;
    justify-content: flex-start;
    gap: 0.12em;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }

  .cert-intro { margin: 0; }
  .cert-reason { margin-top: 0.08em; }
  .missions-row {
    margin-top: 0.4em;
    flex-shrink: 0;
  }
  .cert-meta { margin-top: 0.35em; flex-shrink: 0; }
  .coach-quote { margin-top: 0.25em; flex-shrink: 0; }

  .cta-block {
    left: 24%;
    right: 18%;
    width: auto;
    bottom: 3.5%;
    padding: 1.1% 1.4%;
    box-shadow: none;
  }

  .social-block {
    width: 20%;
    bottom: 2.4%;
  }
}

/* Mobile preview: keep certificate readable and fully in view */
@media (max-width: 700px) {
  .no-print {
    padding: 18px 14px 8px;
  }

  .form-card {
    padding: 16px;
    border-radius: 14px;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }

  .preview-label {
    margin: 18px 0 10px;
    padding: 0 14px;
  }

  .stage {
    padding: 0 10px 36px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .certificate {
    width: 100%;
    max-width: 100%;
    /* slightly taller hit area for taps on links/QR */
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  }

  .social-block {
    width: 18%;
    bottom: 2.6%;
  }

  .cta-block {
    gap: 0.55em;
    padding: 1.4% 1.8%;
  }
}

/* ===== Print ===== */

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

  html, body {
    background: #fff !important;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .share-canvas { display: none !important; }

  .stage {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
  }

  .certificate {
    width: 297mm;
    height: 210mm;
    max-width: none;
    box-shadow: none;
    aspect-ratio: auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .content-panel,
  .cta-block,
  .mission-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cta-link { color: var(--red) !important; }
  .social-icon { color: var(--red) !important; }
}
