/* ============================================================
   CERTIFICATE COVER CAROUSEL
   ============================================================ */

:root {
  --c1: 10, 22, 40;
  --c2: 15, 30, 53;
  --c3-lightbox: 5, 12, 25;
  --c4-progress-fill-1: 138, 110, 26;
  --c4-progress-fill-2: 201, 162, 39;
}

body.light {
  --c3-lightbox: 244, 242, 216;
  --c4-progress-fill-1: 10, 22, 40;
  --c4-progress-fill-2: 15, 30, 53;
}

.carousel-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  margin-top: 14px;
}

/* Outer scene — full width, overflow hidden */
.cert-carousel-scene {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0px 0 40px;
  /* perspective for 3-D effect */
  perspective: 1400px;
}

/* Track — flex row, centered */
.cert-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 550px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Individual slide ---- */
.cert-slide {
  position: absolute;
  width: 72vw;
  max-width: 900px;
  min-width: 320px;
  height: 540px;
  border-radius: 20px;
  overflow: hidden;
  transition:
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.75s ease,
    box-shadow 0.75s ease;
  cursor: grab;
  flex-shrink: 0;
  border: 1px solid rgba(201, 162, 39, 0.12);
}

/* State: active (center, full size) */
.cert-slide.is-active {
  transform: translateX(0) scale(1) rotateY(0deg);
  opacity: 1;
  filter: brightness(1);
  z-index: 10;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(201, 162, 39, 0.25),
    0 0 80px rgba(201, 162, 39, 0.08);
  cursor: grab;
}

/* State: next (right, partially visible) */
.cert-slide.is-next {
  transform: translateX(68%) scale(0.82) rotateY(-18deg);
  opacity: 0.55;
  filter: brightness(0.55) blur(1px);
  z-index: 5;
  cursor: pointer;
}

/* State: prev (left, partially visible) */
.cert-slide.is-prev {
  transform: translateX(-68%) scale(0.82) rotateY(18deg);
  opacity: 0.55;
  filter: brightness(0.55) blur(1px);
  z-index: 5;
  cursor: pointer;
}

/* State: far (hidden behind) */
.cert-slide.is-far {
  transform: translateX(0) scale(0.6);
  opacity: 0;
  filter: brightness(0.3);
  z-index: 1;
  pointer-events: none;
}

/* ---- Slide Background (certificate image + overlay) ---- */
.cert-slide-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.cert-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.22;
  filter: saturate(0.4) contrast(1.1);
  transition: opacity 0.5s;
}

.cert-slide.is-active .cert-slide-img {
  opacity: 0.3;
}

/* Layered overlay: dark gradient + color tint */
.cert-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
      rgba(var(--c1), 0.88) 0%,
      rgba(var(--c2), 0.95) 50%,
      rgba(var(--c1), 0.92) 100%);
}

/* Color accent strip from cert color variable */
.cert-slide-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cert-color, #c9a227), transparent);
  z-index: 2;
}

/* ---- Slide Content ---- */
.cert-slide-content {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 44px 48px 40px;
}

.cert-slide-issuer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--cert-color, #c9a227);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 10px;
  opacity: 0.9;
}

.cert-slide-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  color: #f5efe0;
  line-height: 1.2;
  margin-bottom: 6px;
}

.cert-slide-subtitle {
  font-size: 0.85rem;
  color: rgba(201, 162, 39, 0.75);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.cert-slide-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(200, 210, 225, 0.75);
  margin-bottom: 18px;
  max-width: 600px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cert-slide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.cert-tag {
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.2);
  color: rgba(232, 197, 71, 0.9);
  font-size: 0.68rem;
  padding: 4px 12px;
  border-radius: 14px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

.cert-slide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cert-slide-date {
  font-size: 0.75rem;
  color: rgba(201, 162, 39, 0.6);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- View Certificate Button ---- */
.cert-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.15), rgba(201, 162, 39, 0.08));
  border: 1px solid rgba(201, 162, 39, 0.4);
  color: #e8c547;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.25s;
  position: relative;
  z-index: 20;
  text-transform: uppercase;
}

.cert-view-btn:hover {
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.3), rgba(201, 162, 39, 0.15));
  border-color: rgba(201, 162, 39, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.2);
}

/* Cert index badge top-right */
.cert-slide::before {
  content: attr(data-index-label);
  position: absolute;
  top: 24px;
  right: 28px;
  font-family: 'Playfair Display', serif;
  font-size: 5rem;
  font-weight: 900;
  color: rgba(201, 162, 39, 0.06);
  line-height: 1;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

/* ---- HUD (progress + counter) ---- */
.cert-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 8%;
  margin-top: -20px;
  margin-bottom: 10px;
}

.cert-progress-bar {
  flex: 1;
  max-width: 340px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.cert-progress-fill {
  height: 100%;
  background: linear-gradient(90deg,
      rgb(var(--c4-progress-fill-1)),
      rgb(var(--c4-progress-fill-2)));
  border-radius: 2px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  width: 25%;
}

.cert-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  white-space: nowrap;
}

/* ============================================================
   CERTIFICATE LIGHTBOX
   ============================================================ */

.cert-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(var(--c3-lightbox), 0.96);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.cert-lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lb-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(245, 239, 224, 0.7);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 9001;
}

.lb-close:hover {
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold);
  border-color: rgba(201, 162, 39, 0.3);
}

.lb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 90vw;
  max-height: 90vh;
}

#lb-img {
  max-width: 88vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.2);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  animation: lbPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes lbPop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lb-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--cream);
  text-align: center;
  font-weight: 700;
}

.lb-timer-wrap {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 200px;
}

.lb-timer-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.lb-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #8a6e1a, #c9a227);
  border-radius: 2px;
  width: 100%;
  transition: width 1s linear;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .cert-slide {
    width: 86vw;
    height: 480px;
  }

  .cert-slide.is-next {
    transform: translateX(75%) scale(0.78) rotateY(-14deg);
  }

  .cert-slide.is-prev {
    transform: translateX(-75%) scale(0.78) rotateY(14deg);
  }

  .cert-slide-content {
    padding: 32px 58px 30px;
  }

  .cert-slide-title {
    font-size: 1.4rem;
  }
}

@media (max-width: 600px) {
  .cert-slide {
    width: 92vw;
    height: 440px;
  }

  .cert-slide.is-next {
    transform: translateX(80%) scale(0.72) rotateY(-10deg);
  }

  .cert-slide.is-prev {
    transform: translateX(-80%) scale(0.72) rotateY(10deg);
  }

  .cert-slide-content {
    padding: 24px 52px 22px;
  }

  .cert-slide-desc {
    -webkit-line-clamp: 2;
  }
}

/* ---- Mobile/Tablet prev/next buttons ---- */
.cert-nav-btn {
  display: none;
}

@media (max-width: 901px) {
  .cert-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(10, 22, 40, 0.85);
    border: 1px solid rgba(201, 162, 39, 0.35);
    color: var(--gold);
    font-size: 1rem;
    cursor: pointer;
    z-index: 30;
    backdrop-filter: blur(8px);
    transition: all 0.25s;
    -webkit-tap-highlight-color: transparent;
  }

  .cert-nav-prev {
    left: 0;
    transform: translate(-12px, -50%);
  }

  .cert-nav-next {
    right: 0;
    transform: translate(12px, -50%);
  }

  .cert-nav-btn:hover,
  .cert-nav-btn:active {
    background: rgba(201, 162, 39, 0.18);
    border-color: rgba(201, 162, 39, 0.7);
    transform: translateY(-50%) scale(1.08);
  }

  .cert-nav-prev {
    left: 12px;
  }

  .cert-nav-next {
    right: 12px;
  }
}