/* ===== Pembukaan kad seragam (semua templat) =====
   Templat ubah rupa dengan menetapkan pemboleh ubah ini pada :root:
   --op-bg, --op-bg-image, --op-ink, --op-ink-soft, --op-accent, --op-seam,
   --op-seal-bg, --op-seal-ink, --op-seal-ring, --op-font-names, --op-font-label, --op-font-body
*/
.op {
  position: fixed; inset: 0; z-index: 60; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--op-ink, #3A2E31); font-family: var(--op-font-body, inherit);
}
.op[hidden] { display: none; }

.op-half {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background-color: var(--op-bg, #FFF8F9);
  background-image: var(--op-bg-image, none);
  background-size: var(--op-bg-size, auto);
  transition: transform 1.35s cubic-bezier(.77, 0, .18, 1) .3s, box-shadow 1.35s ease .3s;
  will-change: transform; overflow: hidden;
}
.op-l { left: 0; }
.op-r { right: 0; }
/* Garisan pertemuan di tengah */
.op-l::after, .op-r::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 0;
  border-left: var(--op-seam, 1px solid rgba(0,0,0,.12));
  /* pudar di bahagian tengah supaya tidak melintasi teks */
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 9%, transparent 17%, transparent 83%, #000 91%, #000 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 9%, transparent 17%, transparent 83%, #000 91%, #000 100%);
}
.op-l::after { right: 6px; }
.op-r::after { left: 6px; }
.op-face { position: absolute; inset: 0; }

/* Kandungan tengah */
.op-content {
  position: relative; z-index: 2; width: 100%; max-width: 440px; padding: 24px 28px;
  text-align: center; transition: opacity .45s ease, transform .6s ease;
}
.op-eyebrow {
  font-family: var(--op-font-label, inherit); text-transform: uppercase; letter-spacing: .28em;
  font-size: var(--op-eyebrow-size, .82rem); color: var(--op-ink-soft, #7D6D71);
}
.op-names {
  font-family: var(--op-font-names, inherit); font-size: var(--op-names-size, clamp(3rem, 15vw, 4.3rem));
  line-height: .98; margin: 14px 0 10px;
}
.op-amp { display: block; font-size: .5em; color: var(--op-accent, #C27A8B); margin: 4px 0; }
.op-date { font-family: var(--op-font-label, inherit); letter-spacing: .3em; font-size: var(--op-date-size, 1rem); color: var(--op-ink-soft, #7D6D71); }

/* Butang "meterai" di tengah garisan */
.op-seal {
  position: relative; width: 92px; height: 92px; margin: 34px auto 10px; display: grid; place-items: center;
  border-radius: 50%; border: 0; cursor: pointer; background: var(--op-seal-bg, #C27A8B); color: var(--op-seal-ink, #fff);
  box-shadow: var(--op-seal-shadow, 0 10px 24px -8px rgba(168,95,113,.55)); transition: transform .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.op-seal:hover { transform: scale(1.05); }
.op-seal:focus-visible { outline: 2px solid var(--op-accent, #C27A8B); outline-offset: 6px; }
.op-seal-ring { position: absolute; inset: -9px; border-radius: 50%; border: var(--op-seal-ring, 1px solid rgba(194,122,139,.5)); animation: op-pulse 2.4s ease-out infinite; }
.op-initials { font-family: var(--op-font-names, inherit); font-size: var(--op-initials-size, 1.9rem); line-height: 1; white-space: nowrap; }
.op-initials i { font-style: normal; font-size: .6em; margin: 0 2px; opacity: .85; }
.op-cta { font-family: var(--op-font-label, inherit); text-transform: uppercase; letter-spacing: .3em; font-size: .78rem; color: var(--op-ink-soft, #7D6D71); }
.op-line { margin: 26px auto 0; max-width: 300px; font-size: .98rem; color: var(--op-ink-soft, #7D6D71); }
.op-hint { margin: 10px 0 0; font-size: .8rem; color: var(--op-ink-soft, #7D6D71); opacity: .85; }

@keyframes op-pulse { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }

/* ---- Bila dibuka ---- */
.op--open .op-content { opacity: 0; transform: scale(.96); pointer-events: none; }
.op--open .op-l { transform: translateX(-101%); }
.op--open .op-r { transform: translateX(101%); }
.op--open { pointer-events: none; }

/* Kad di belakang muncul perlahan */
.card-reveal { transition: transform 1.6s cubic-bezier(.2,.7,.2,1) .35s, opacity 1.2s ease .35s; }
.card-reveal.pre { transform: scale(1.04); opacity: .4; }

body.op-locked { overflow: hidden; }
html, body { overflow-x: clip; } /* zum kad semasa pembukaan tak boleh sebabkan skrol ke tepi */

/* ---- Dikongsi semua templat: pemain lagu tersembunyi & paparan galeri ---- */
.yt-hidden { position: fixed; left: -9999px; bottom: 0; width: 200px; height: 200px; opacity: 0; pointer-events: none; }
/* Paparan penuh galeri: gambar besar + kiraan + baris thumbnail (gaya lightGallery) */
.lb { position: fixed; inset: 0; z-index: 80; background: rgba(16, 12, 10, .97); display: flex; flex-direction: column; font-family: system-ui, sans-serif; }
.lb[hidden] { display: none; }
.lb-count { position: absolute; top: 18px; left: 18px; color: rgba(255,255,255,.85); font-size: .9rem; letter-spacing: .08em; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 60px 12px 12px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lb-img.lb-in { animation: lb-zoom .35s ease; }
@keyframes lb-zoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.lb-x, .lb-p, .lb-n { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.7rem; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 1; }
.lb-x:hover, .lb-p:hover, .lb-n:hover { background: rgba(255,255,255,.25); }
.lb-x { top: 12px; right: 12px; }
.lb-p { left: 10px; top: 50%; margin-top: -22px; }
.lb-n { right: 10px; top: 50%; margin-top: -22px; }
.lb-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); scrollbar-width: none; justify-content: safe center; }
.lb-thumbs::-webkit-scrollbar { display: none; }
.lb-thumbs button { flex: 0 0 auto; width: 62px; height: 62px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: none; cursor: pointer; opacity: .5; transition: opacity .2s, border-color .2s; }
.lb-thumbs button.on { opacity: 1; border-color: #fff; }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (prefers-reduced-motion: reduce) {
  .op-half, .op-content, .card-reveal { transition-duration: .01s; transition-delay: 0s; }
  .op-seal-ring { animation: none; }
}
