/* ============================================================
   CERTIFICATES SECTION
   ============================================================ */
.certificates {
  position: relative;
  padding: clamp(60px, 10vw, 120px) 0 clamp(60px, 10vw, 100px);
  background: linear-gradient(150deg, #fdf0e8 0%, #fff0f5 40%, #fce8ef 100%);
  overflow: hidden;
}

/* BG text */
.cert-bg-text {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(60px, 15vw, 200px);
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(196,88,128,.18);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  line-height: 1;
}

/* ── Header ── */
.cert-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: clamp(36px, 5vw, 60px);
  padding: 0 clamp(20px, 6vw, 72px);
}

.cert-eyebrow {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--pink-deep);
  background: rgba(196,88,128,.10);
  border: 1px solid rgba(196,88,128,.22);
  border-radius: 999px;
  padding: 5px 18px;
  margin-bottom: 14px;
  margin-top: 170px;
  display: inline-block;
}

.cert-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 7vw, 82px);
  font-weight: 900;
  line-height: .95;
  color: var(--text-dark);
  letter-spacing: -2px;
  margin: 18px 0 14px;
}
.cert-title em {
  font-style: italic;
  color: var(--pink-deep);
}

.cert-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(12px, 1.3vw, 15px);
  color: var(--text-soft);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Carousel wrap ── */
.cert-carousel-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
}

.cert-carousel {
  flex: 1;
  overflow: hidden;
  padding: 20px 0 28px;
  cursor: grab;
  user-select: none;

  /* FIX SWIPE */
  touch-action: pan-y;
}
.cert-track,
.cert-card,
.cert-img {
  user-select: none;
  -webkit-user-drag: none;
}
.cert-img,
.cert-img-overlay,
.cert-frame,
.cert-frame * {
  pointer-events: none;
}
.cert-carousel.is-dragging { cursor: grabbing; }

.cert-track {
  display: flex;
  gap: clamp(16px, 2.5vw, 28px);
  transition: transform 0.42s cubic-bezier(0.34, 1.15, 0.64, 1);
  padding: 0 clamp(20px, 6vw, 72px);
  will-change: transform;
}

/* ── Card ── */
.cert-card {
  flex: 0 0 clamp(280px, calc((100% - clamp(20px,6vw,72px)*2 - clamp(16px,2.5vw,28px)) / 2), 420px);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (min-width: 1024px) {
  .cert-card {
    flex: 0 0 calc((100% - clamp(20px,6vw,72px)*2 - clamp(16px,2.5vw,28px)*2) / 3);
  }
}
.cert-card:hover { transform: translateY(-8px) scale(1.02); }
.cert-card:active { transform: scale(0.97); }

/* ── Certificate Frame ── */
.cert-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(145deg, #fffaf8 0%, #fff5f8 50%, #fdf0f5 100%);
  border-radius: 4px;
  border: 2px solid rgba(196,88,128,.35);
  box-shadow:
    0 8px 40px rgba(196,88,128,.18),
    0 2px 8px rgba(0,0,0,.06),
    inset 0 1px 0 rgba(255,255,255,.9);
  overflow: hidden;
  transition: box-shadow .35s;
}
.cert-card:hover .cert-frame {
  box-shadow:
    0 20px 60px rgba(196,88,128,.30),
    0 4px 16px rgba(0,0,0,.10),
    inset 0 1px 0 rgba(255,255,255,.95);
  border-color: rgba(196,88,128,.55);
}

/* Outer decorative border inside frame */
.cert-frame::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(196,88,128,.22);
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}
/* Inner fine line */
.cert-frame::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(196,88,128,.12);
  border-radius: 1px;
  pointer-events: none;
  z-index: 0;
}

/* Corner ornaments */
.cert-frame-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  z-index: 2;
  pointer-events: none;
}
.cert-frame-corner::before,
.cert-frame-corner::after {
  content: '';
  position: absolute;
  background: var(--pink-deep);
  border-radius: 1px;
}
.cert-frame-corner::before { width: 100%; height: 2px; top: 0; left: 0; }
.cert-frame-corner::after  { width: 2px; height: 100%; top: 0; left: 0; }

.cert-frame-corner--tl { top: 14px;    left: 14px; }
.cert-frame-corner--tr { top: 14px;    right: 14px;  transform: scaleX(-1); }
.cert-frame-corner--bl { bottom: 14px; left: 14px;   transform: scaleY(-1); }
.cert-frame-corner--br { bottom: 14px; right: 14px;  transform: scale(-1); }

/* ── Image inside frame ── */
.cert-img-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 2px;
}

.cert-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .5s cubic-bezier(0.16, 1, 0.3, 1);
  /* Placeholder warna saat gambar belum ada */
  background: linear-gradient(145deg, #fce4f0, #f5c6de);
}
.cert-card:hover .cert-img { transform: scale(1.04); }

/* Overlay zoom icon on hover */
.cert-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(196, 88, 128, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}
.cert-card:hover .cert-img-overlay { opacity: 1; }

.cert-img-zoom {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transform: scale(0.8);
  transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cert-card:hover .cert-img-zoom { transform: scale(1); }

/* Card info below frame */
.cert-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.cert-card-tag {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(9px, 1vw, 11px);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--pink-deep);
  background: rgba(196,88,128,.10);
  border: 1px solid rgba(196,88,128,.22);
  border-radius: 999px;
  padding: 3px 10px;
}

.cert-card-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(9px, 1vw, 11px);
  color: var(--text-soft);
  letter-spacing: .3px;
  font-style: italic;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .25s, transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cert-card:hover .cert-card-hint {
  opacity: 1;
  transform: translateX(0);
}

/* ── Arrow buttons — hidden, navigasi via drag/swipe ── */
.cert-arrow {
  display: none;
}

/* ── Drag hint ── */
.cert-drag-hint {
  text-align: center;
  font-size: clamp(10px, 1.1vw, 12px);
  color: var(--text-soft);
  font-style: italic;
  letter-spacing: .4px;
  margin-top: 10px;
  opacity: .7;
  user-select: none;
}

/* ── Dots ── */
.cert-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.cert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(196,88,128,.25);
  cursor: pointer;
  padding: 0;
  transition: background .25s, transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), width .3s;
}
.cert-dot.active {
  background: var(--pink-deep);
  width: 24px;
  border-radius: 999px;
  transform: scale(1.1);
}

/* ============================================================
   CERTIFICATE MODAL (lightbox)
   ============================================================ */
.cert-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s cubic-bezier(0.16, 1, 0.3, 1);
}
.cert-modal.open {
  pointer-events: all;
  opacity: 1;
}

.cert-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 26, 34, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cert-modal-box {
  position: relative;
  z-index: 1;
  width: min(680px, 94vw);
  background: #fffaf8;
  border-radius: 6px;
  border: 2.5px solid rgba(196,88,128,.45);
  box-shadow:
    0 32px 80px rgba(196,88,128,.28),
    0 8px 32px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.95);
  transform: scale(0.88) translateY(24px);
  transition: transform .4s cubic-bezier(0.34, 1.3, 0.64, 1);
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.cert-modal.open .cert-modal-box {
  transform: scale(1) translateY(0);
}

.cert-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 10;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(196,88,128,.25);
  background: rgba(255,255,255,.72);
  color: var(--text-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cert-modal-close:hover {
  background: rgba(196,88,128,.12);
  color: var(--pink-deep);
  transform: rotate(90deg) scale(1.1);
}

/* Modal inner frame */
.cert-modal-frame {
  position: relative;
  padding: 28px 28px 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Double border lines */
.cert-modal-frame::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1.5px solid rgba(196,88,128,.22);
  border-radius: 2px;
  pointer-events: none;
}
.cert-modal-frame::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px dashed rgba(196,88,128,.12);
  border-radius: 1px;
  pointer-events: none;
}

/* Modal corners */
.cert-modal-corner {
  position: absolute;
  width: 28px; height: 28px;
  z-index: 2; pointer-events: none;
}
.cert-modal-corner::before,
.cert-modal-corner::after {
  content: '';
  position: absolute;
  background: var(--pink-deep);
  border-radius: 1px;
}
.cert-modal-corner::before { width: 100%; height: 2.5px; top: 0; left: 0; }
.cert-modal-corner::after  { width: 2.5px; height: 100%; top: 0; left: 0; }

.cert-modal-corner--tl { top: 18px;    left: 18px; }
.cert-modal-corner--tr { top: 18px;    right: 18px;  transform: scaleX(-1); }
.cert-modal-corner--bl { bottom: 18px; left: 18px;   transform: scaleY(-1); }
.cert-modal-corner--br { bottom: 18px; right: 18px;  transform: scale(-1); }

/* ── Modal image ── */
.cert-modal-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(145deg, #fce4f0, #f5c6de);
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-modal-img {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Caption below image */
.cert-modal-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px;
  gap: 12px;
}

.cert-modal-caption-tag {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--pink-deep);
  background: rgba(196,88,128,.10);
  border: 1px solid rgba(196,88,128,.22);
  border-radius: 999px;
  padding: 4px 12px;
  flex-shrink: 0;
}

.cert-modal-caption-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 900;
  font-style: italic;
  color: var(--text-dark);
  letter-spacing: -.2px;
  line-height: 1.2;
  text-align: right;
}

/* Lock scroll when modal open */
body.modal-open { overflow: hidden; }

/* ── Stiker pojok kiri bawah ── */
.cert-sticker {
  position: absolute;
  bottom: clamp(-80px, -2vw, -56px);
  left: -9px;
  width: clamp(250px, 14vw, 300px);
  z-index: 2;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 8px 18px rgba(196,88,128,.22));
  transform-origin: bottom left;
  transform: rotate(-8deg);
}
.cert-sticker img {
  width: 100%;
  height: auto;
  display: block;
}

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

/* Tablet ≤ 1024px — 2 visible cards */
@media (max-width: 1024px) {
  .cert-card {
    flex: 0 0 calc((100% - clamp(20px,6vw,72px)*2 - clamp(16px,2.5vw,28px)) / 2);
  }
  .cert-sticker {
    width: clamp(250px, 14vw, 300px);
    bottom: -56px;
  }
}

/* Mobile ≤ 640px — 1 card, arrow closer */
@media (max-width: 640px) {
  .certificates { padding: 50px 0 60px; }
  .cert-bg-text  { font-size: 56px; top: 20px; }
  .cert-eyebrow  { margin-top: 70px; font-size: 8px; letter-spacing: 2px; padding: 4px 12px; }
  .cert-header   { padding: 0 16px; }

  .cert-card {
    flex: 0 0 calc(100% - clamp(20px,6vw,72px)*2);
    min-width: 0;
  }
  .cert-track { padding: 0 clamp(16px, 5vw, 40px); }

  .cert-arrow {
    width: 36px; height: 36px;
    margin: 0 6px;
  }
  .cert-arrow svg { width: 16px; height: 16px; }

  .cert-modal-box { border-radius: 4px; }
  .cert-modal-frame { padding: 32px 24px 28px; }
  .cert-modal-name { font-size: 18px; }
  .cert-sticker {
    width: clamp(170px, 22vw, 130px);
    bottom: -38px;
    left: -15px;
    transform: rotate(-6deg);
  }
}

/* Very small ≤ 380px */
@media (max-width: 380px) {
  .cert-title   { font-size: 32px; }
  .cert-arrow   { display: none; }
  .cert-carousel-wrap { padding: 0; }
  .cert-track { padding: 0 14px; gap: 14px; }
  .cert-card  { flex: 0 0 calc(100% - 28px); }
  .cert-sticker { width: 70px; bottom: -12px; }
}