/* =========================================================
   CertForge — design tokens
   Subject: X.509 certificates are, literally, formal documents.
   The whole UI leans into that: ink/parchment, a wax-seal that
   stamps down when a cert is issued, monospace for every token,
   fingerprint and key — because those ARE the content here.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #0a1120;
  --ink-2: #0e1729;
  --panel: #121d33;
  --panel-2: #17233c;
  --line: #263756;
  --line-soft: #1c2a45;
  --paper: #eef1f7;
  --paper-dim: #c7cfe0;
  --muted: #8492ac;

  --seal: #e3a93b;
  --seal-deep: #b9791f;
  --seal-ink: #3a2405;

  --verified: #4fd8b0;
  --verified-deep: #23a883;
  --danger: #ef6a6a;

  --radius: 14px;
  --radius-lg: 22px;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --shadow-lift: 0 20px 60px -20px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 12% -10%, #16223d 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #142036 0%, transparent 55%),
    var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- header ---------- */

header.site {
  padding: 28px 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.01em;
}

.brand .mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--seal);
}

/* ---------- hero ---------- */

.hero {
  padding: 40px 0 8px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 14px 0 14px;
}

.hero h1 em {
  font-style: italic;
  color: var(--seal);
}

.hero p.lede {
  max-width: 60ch;
  color: var(--paper-dim);
  font-size: 17px;
}

.staging-banner {
  margin-top: 22px;
  border: 1px dashed var(--seal-deep);
  background: linear-gradient(180deg, rgba(227, 169, 59, 0.1), rgba(227, 169, 59, 0.04));
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: #f0d9a6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.staging-banner strong { color: var(--seal); }
.staging-banner code { font-family: var(--font-mono); background: rgba(0,0,0,.25); padding: 1px 6px; border-radius: 5px; }

/* ---------- stepper ---------- */

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 36px 0 28px;
}

.step-node {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.step-node .dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  transition: all .25s ease;
}

.step-node .label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.step-node.active .dot {
  border-color: var(--seal);
  color: var(--seal);
  box-shadow: 0 0 0 4px rgba(227,169,59,0.12);
}
.step-node.active .label { color: var(--paper); }

.step-node.done .dot {
  background: var(--verified);
  border-color: var(--verified);
  color: #06231a;
}
.step-node.done .label { color: var(--paper-dim); }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--line);
  min-width: 16px;
}
.step-line.done { background: var(--verified-deep); }

/* ---------- panels / cards ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lift);
}

.panel + .panel { margin-top: 18px; }

.panel h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 6px;
}

.panel .hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}

label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--paper-dim);
  margin: 18px 0 8px;
}
label.field-label:first-child { margin-top: 0; }

textarea, input[type="text"], input[type="email"] {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--paper);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color .15s ease;
}
textarea::placeholder, input::placeholder { color: #56628a; font-family: var(--font-body); }
textarea:focus, input:focus { border-color: var(--seal); }
textarea { min-height: 84px; resize: vertical; }

.field-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
@media (max-width: 560px) { .choice-row { grid-template-columns: 1fr; } }

.choice {
  border: 1px solid var(--line);
  background: var(--ink-2);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--paper-dim); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected { border-color: var(--seal); background: rgba(227,169,59,0.08); }
.choice .t { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.choice .d { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.choice .tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .05em;
  background: var(--line-soft); color: var(--paper-dim); padding: 2px 6px; border-radius: 5px;
}

/* buttons */

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  border-radius: 10px;
  padding: 13px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-seal {
  background: linear-gradient(180deg, #f0bd5b, var(--seal) 60%, var(--seal-deep));
  color: var(--seal-ink);
  box-shadow: 0 10px 24px -10px rgba(227,169,59,0.55);
}
.btn-seal:hover:not(:disabled) { box-shadow: 0 14px 30px -10px rgba(227,169,59,0.7); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper-dim);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--paper-dim); color: var(--paper); }

.btn-row { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; align-items: center; }

/* ---------- challenge cards ---------- */

.domain-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.domain-tab {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--paper-dim);
  cursor: pointer;
}
.domain-tab.active { border-color: var(--seal); color: var(--seal); }
.domain-tab .ok-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--verified); margin-right: 6px; vertical-align: middle; opacity: 0; }
.domain-tab.verified .ok-dot { opacity: 1; }

.kv {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.kv .k {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.kv .v {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.copy-btn {
  flex: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  background: var(--line-soft);
  border: 1px solid var(--line);
  color: var(--paper-dim);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--seal); color: var(--seal); }
.copy-btn.copied { color: var(--verified); border-color: var(--verified-deep); }

.check-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.check-status { font-size: 13px; color: var(--muted); font-family: var(--font-mono); }
.check-status.ok { color: var(--verified); }
.check-status.bad { color: var(--danger); }

/* ---------- status / progress ---------- */

.progress-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--paper-dim);
  margin-top: 18px;
}
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--seal);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.failure-list { margin-top: 16px; }
.failure-item {
  border-left: 3px solid var(--danger);
  background: rgba(239,106,106,0.08);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
  font-size: 13.5px;
}
.failure-item b { color: var(--danger); font-family: var(--font-mono); }

/* ---------- issued certificate (the "parchment card") ---------- */

.cert-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0 4px;
}

.seal-wrap {
  width: 96px; height: 96px;
  margin-bottom: -30px;
  position: relative;
  z-index: 2;
  transform: scale(0.4) rotate(-18deg);
  opacity: 0;
}
.seal-wrap.stamp {
  animation: stamp-down 0.55s cubic-bezier(.2,1.6,.4,1) forwards;
}
@keyframes stamp-down {
  0% { transform: scale(2.2) rotate(-18deg) translateY(-40px); opacity: 0; }
  55% { transform: scale(0.92) rotate(-4deg) translateY(0); opacity: 1; }
  75% { transform: scale(1.04) rotate(2deg); }
  100% { transform: scale(1) rotate(-6deg); opacity: 1; }
}

.parchment {
  width: 100%;
  border-radius: 18px;
  padding: 40px 32px 28px;
  background:
    radial-gradient(120% 140% at 50% -10%, #1a2846 0%, transparent 55%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 6px),
    var(--panel);
  border: 1px solid var(--line);
  position: relative;
}
.parchment::before, .parchment::after {
  content: "";
  position: absolute; left: 24px; right: 24px; height: 1px;
  background: var(--line-soft);
}
.parchment::before { top: 18px; }
.parchment::after { bottom: 18px; }

.cert-domain {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 4px 0 4px;
}
.cert-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.cert-sub.staging { color: var(--seal); }

.cert-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  text-align: left;
  max-width: 480px;
  margin: 0 auto 22px;
}
.cert-meta .k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cert-meta .v { font-family: var(--font-mono); font-size: 12.5px; margin-top: 4px; word-break: break-all; }

.download-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 640px) { .download-grid { grid-template-columns: 1fr 1fr; } }

.dl-btn {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  border-radius: 10px;
  padding: 12px;
  text-decoration: none;
  color: var(--paper);
  transition: border-color .15s ease, transform .12s ease;
}
.dl-btn:hover { border-color: var(--seal); transform: translateY(-2px); }
.dl-btn .fn { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.dl-btn .fd { font-size: 11px; color: var(--muted); }

/* ---------- footer ---------- */

footer.site {
  margin: 60px 0 40px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
footer.site a { color: var(--paper-dim); text-decoration: underline; text-underline-offset: 2px; }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .seal-wrap.stamp, .spinner { animation: none !important; }
  .seal-wrap.stamp { opacity: 1; transform: scale(1) rotate(-6deg); }
}
