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

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ── Overlay backdrop ─────────────────────────────────────── */
#cert-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

#cert-overlay.active { 
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ── Certificate card ─────────────────────────────────────── */
.cert-modal {
  position: relative;
  width: 860px;
  max-width: 100%;
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.28),
    0 0 0 1px rgba(255,255,255,0.08);
}

/* ── Decorative top bar ───────────────────────────────────── */
.cert-top-bar {
  height: 6px;
  background: linear-gradient(90deg, #e04a4a 0%, #f97316 40%, #e04a4a 100%);
  background-size: 200% 100%;
  animation: shiftBar 4s linear infinite;
}

@keyframes shiftBar {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ── Background decoration (right) ────────────────────────── */
.cert-bg-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 20px;
}

.cert-bg-decor svg {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  height: 100%;
  opacity: 0.07;
}

/* ── Background decoration (left logo mark) ──────────────── */
.cert-bg-decor-left {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 20px;
}

.cert-bg-decor-left svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  opacity: 0.07;
}

/* ── Inner layout ─────────────────────────────────────────── */
.cert-body {
  position: relative;
  padding: 3rem 4rem 2.5rem;
  z-index: 1;
}

/* ── Header row ───────────────────────────────────────────── */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.75rem;
}

.cert-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.cert-logo img {
  height: 36px;
  width: 36px;
  filter: drop-shadow(0 0 6px rgba(224, 74, 74, 0.5));
}

.cert-logo-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.cert-logo-text .w { color: #1E1E2F; }
.cert-logo-text .r { color: #e04a4a; }

.cert-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9ca3af;
}

/* ── Background decoration (diagonal line) ──────────────── */
.cert-bg-decor-diag {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 20px;
}

.cert-bg-decor-diag svg {
  position: absolute;
  bottom: 150px;
  left: 200px;
  width: 100%;
  height: 100%;
  opacity: 0.15;
}

.cert-sig-svg {
  transform: rotate(2.5deg);
}

.cert-sig-svg {
  height: 92px;
  width: 220px;
}

/* ── Divider ──────────────────────────────────────────────── */
.cert-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e5e7eb 20%, #e5e7eb 80%, transparent);
  margin-bottom: 2.5rem;
}

/* ── Main content — fully centered ───────────────────────── */
.cert-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cert-intro-line {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: #6b7280;
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem 0;
}

.cert-name {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.6rem 0;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.cert-desc-line {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 0.5rem 0;
}

.cert-course-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: #e04a4a;
  margin: 0 0 1.8rem 0;
  line-height: 1.2;
}

/* ── Meta row ─────────────────────────────────────────────── */
.cert-meta-row {
  display: flex;
  gap: 2.5rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.cert-meta-item label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 3px;
  text-align: center;
}

.cert-meta-item span {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

/* ── Signature area ───────────────────────────────────────── */
.cert-sig-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.cert-sig-svg {
  height: 52px;
  width: 130px;
  margin-bottom: 6px;
}

.cert-sig-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.cert-sig-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
}

/* ── Gold stamp ───────────────────────────────────────────── */
.cert-stamp {
  position: absolute;
  top: 100px;
  right: 115px;
  z-index: 3;
  width: 130px;
  height: 130px;
  pointer-events: none;
}

/* ── Close button ─────────────────────────────────────────── */
.cert-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #6b7280;
  transition: background 0.2s;
  z-index: 10;
}

.cert-close-btn:hover { background: rgba(0,0,0,0.12); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .cert-body { padding: 2rem 1.5rem 1.75rem; }
  .cert-name { font-size: 2rem; }
  .cert-course-name { font-size: 1.25rem; }
  .cert-header { flex-wrap: wrap; gap: 0.75rem; }
}

/* ── Download bar ─────────────────────────────────────────── */
.cert-download-bar {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 1.25rem 2rem 1.75rem;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  position: relative;
  z-index: 2;
}

.cert-dl-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  border: 1px solid #e04a4a;
  background: #ffffff;
  color: #e04a4a;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.cert-dl-btn:hover {
  background: #e04a4a;
  color: #ffffff;
}

.cert-dl-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 700px) {
  .cert-download-bar {
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
  }
}

.cert-download-bar {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 1.25rem 2rem 1.75rem;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  position: relative;
  z-index: 2;
}

.cert-dl-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  border: 1px solid #e04a4a;
  background: #ffffff;
  color: #e04a4a;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.cert-dl-btn:hover {
  background: #e04a4a;
  color: #ffffff;
}

.cert-dl-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cert-download-bar {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 0;
  background: transparent;
  border-top: none;
  z-index: 2;
}

.cert-dl-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.cert-dl-btn:hover {
  background: rgba(255,255,255,0.25);
}

.cert-dl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cert-meta-item label {
  white-space: nowrap;
}