/* ============================================
   CERTIFICATIONS.CSS
   ============================================ */

#certifications { background: var(--bg); }

.certs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cert-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), box-shadow 0.32s var(--ease), border-color 0.32s var(--ease);
}
.cert-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 26px 20px 22px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.32s var(--ease);
  position: relative;
  overflow: hidden;
}
.cert-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-hero);
  opacity: 0;
  transition: opacity 0.3s;
}
.cert-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(26,107,204,0.20);
}
.cert-card:hover::before { opacity: 1; }

.cert-logo {
  font-size: 2rem;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.cert-issuer {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}
.cert-name {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-body);
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* Clickable card */
.cert-card {
  cursor: pointer;
}
.cert-card:hover .cert-view {
  opacity: 1;
  transform: translateY(0);
}

.cert-view {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-top: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.25s var(--ease);
  position: relative;
  z-index: 1;
}

/* ---- MODAL OVERLAY ---- */
.cert-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 28, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.28s var(--ease);
}
.cert-modal-overlay.open {
  display: flex;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cert-modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 1000px;
  height: calc(100vh - 32px);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(5,12,28,0.55), 0 0 0 1px rgba(255,255,255,0.08);
  animation: modalSlideUp 0.32s var(--ease);
  overflow: hidden;
}
@keyframes modalSlideUp {
  from { transform: translateY(24px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.cert-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  gap: 16px;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}
.cert-modal-issuer {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 2px;
}
.cert-modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.cert-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cert-modal-download {
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(26,107,204,0.08);
  border: 1px solid rgba(26,107,204,0.20);
  padding: 7px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.22s;
  white-space: nowrap;
}
.cert-modal-download:hover {
  background: var(--grad-btn);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-btn);
}
.cert-modal-close {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.cert-modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: rotate(90deg);
}

.cert-modal-body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  background: #1e2535;
  position: relative;
}

/* PDF iframe fills the entire modal body */
#certModalFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  position: absolute;
  inset: 0;
}

.cert-modal-imgwrap {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px;
  background: #1e2535;
}
.cert-modal-imgwrap img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 16px 64px rgba(0,0,0,0.5);
}

@media (max-width: 600px) {
  .cert-modal {
    height: calc(100vh - 20px);
    max-height: 98vh;
    border-radius: var(--radius-lg);
  }
  .cert-modal-header { padding: 12px 16px; }
  .cert-modal-title { font-size: 0.9rem; }
}

@media (max-width: 900px) {
  .certs-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .certs-grid { grid-template-columns: repeat(2, 1fr); }
}