/* Mẫu 2 — CỔNG HAI CÁNH (gatefold). Thiệp cổng mở kiểu thiệp in cao cấp: hai cánh cửa vòm có nét vẽ cành lá, đai giấy
   ngang + huy hiệu chữ lồng giữ hai cánh. Chạm -> đai trượt xuống, huy hiệu bay lên, hai cánh xoay mở ra phía người xem
   (rotateY quanh bản lề), thiệp trong tiến lên. Thiệp mở: đỉnh vòm, vòng lá trên vòm; màn rộng có 2 cánh cửa đứng nghiêng
   hai bên (nghiêng theo chuột/cảm biến). Màu: giấy theo giao diện (--ic-env-front, --ic-liner). */
.ic--gatefold { --ic-out-delay: 1.02s; --gf-ink: color-mix(in srgb, var(--accent) 72%, var(--ink)); }

/* ── Bìa ── */
.ic--gatefold .ic-env-btn { width: min(330px, 78vw); aspect-ratio: 5 / 7; animation: ic-float 6s ease-in-out infinite; }
.ic--gatefold.is-opening .ic-env-btn { animation: none; }
.gf, .gf > span, .gf-door > span { position: absolute; display: block; }
.gf { inset: 0; transform-style: preserve-3d; }
.gf .gf-inner {
  inset: 0; border-radius: 4px; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: var(--ic-grain), var(--ic-card-bg); transition: transform .8s var(--ic-ease) .5s;
  box-shadow: 0 46px 70px -34px rgba(0, 0, 0, .55), 0 10px 22px -12px rgba(0, 0, 0, .25);
}
.gf-inner::before {
  content: ""; position: absolute; inset: 9% 11% 8%; border: 1px solid var(--ic-line);
  border-radius: 50% 50% 3px 3px / 30% 30% 3px 3px;
}
.gf-inner-mono { font: var(--name-style, normal) 400 2.4rem/1.15 var(--f-name, Georgia, serif); color: var(--accent); }
.gf-inner-mono i { font-style: normal; font-size: .55em; color: var(--muted); margin: 0 3px; }
.gf-inner-greet { font: 600 .8rem/1.3 var(--f-ui, system-ui, sans-serif); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

.gf-door { top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; transition: transform .86s var(--ic-fold) .3s; }
.gf-l { left: 0; transform-origin: 0 50%; }
.gf-r { right: 0; transform-origin: 100% 50%; }
.gf-face, .gf-back { inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.gf-face {
  color: var(--gf-ink);
  background: var(--ic-grain), linear-gradient(160deg, rgba(255, 255, 255, .22), rgba(0, 0, 0, .04) 70%), var(--ic-env-front);
}
.gf-l .gf-face { border-radius: 4px 0 0 4px; box-shadow: inset -1px 0 0 rgba(0, 0, 0, .12), inset -10px 0 14px -12px rgba(0, 0, 0, .3); }
.gf-r .gf-face { border-radius: 0 4px 4px 0; box-shadow: inset 1px 0 0 rgba(255, 255, 255, .35); }
.gf-back { transform: rotateY(180deg); background: var(--ic-grain), var(--ic-liner), var(--ic-env-in); }
.gf-l .gf-back { border-radius: 0 4px 4px 0; }
.gf-r .gf-back { border-radius: 4px 0 0 4px; }
.gf-art { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
/* lòng vòm sáng hơn (ô cửa) */
.gf-face::before { content: ""; position: absolute; left: 26%; right: 0; top: 17%; bottom: 10.7%; background: linear-gradient(rgba(255, 255, 255, .28), rgba(255, 255, 255, .08)); border-radius: 100% 0 0 0 / 27% 0 0 0; }
.gf-r .gf-face::before { left: 0; right: 26%; border-radius: 0 100% 0 0 / 0 27% 0 0; }
.gf-r .gf-art { transform: scaleX(-1); }

.gf-band {
  left: -2px; right: -2px; top: 62%; height: 27%; transform: translateZ(3px);
  background: linear-gradient(var(--ic-line), var(--ic-line)) 0 6px / 100% 1px no-repeat,
    linear-gradient(var(--ic-line), var(--ic-line)) 0 calc(100% - 6px) / 100% 1px no-repeat, var(--ic-grain), var(--ic-card-bg);
  box-shadow: 0 8px 14px -8px rgba(0, 0, 0, .4), 0 -2px 6px -4px rgba(0, 0, 0, .25);
  transition: transform .42s var(--ic-ease), opacity .32s ease .06s;
}
.gf-medal {
  left: 50%; top: 62%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; transform: translateZ(6px);
  display: grid !important; place-items: center; grid-auto-flow: column; gap: 1px; padding-top: 2px;
  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--ic-wax) 55%, #fff) 0, var(--ic-wax) 42%, color-mix(in srgb, var(--ic-wax) 70%, #000) 100%);
  color: var(--ic-wax-ink); font: var(--name-style, normal) 400 1.1rem/1 var(--f-name, Georgia, serif);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--ic-wax) 88%, #000), inset 0 0 0 5px rgba(255, 255, 255, .25), 0 8px 14px -6px rgba(0, 0, 0, .5);
  transition: transform .38s var(--ic-ease), opacity .3s;
}
.gf-medal i { font-style: normal; font-size: .62em; opacity: .85; }
.ic--gatefold .ic-env-to {
  left: 7%; right: 7%; top: calc(62% + 34px); justify-items: center; text-align: center; transform: translateZ(5px);
  --ic-to-small: var(--muted); --ic-to-name: var(--ink);
}
.ic--gatefold .ic-env-to small { font-size: .8125rem; }

/* Mở: đai trượt xuống + mờ, huy hiệu bay lên, cánh trái/phải xoay ra ngoài, thiệp trong tiến lên */
.ic--gatefold.is-opening .gf-band { transform: translateZ(3px) translateY(46%); opacity: 0; }
.ic--gatefold.is-opening .gf-medal { transform: translateZ(70px) translateY(-30px) scale(.7); opacity: 0; }
.ic--gatefold.is-opening .gf-l { transform: rotateY(-158deg); }
.ic--gatefold.is-opening .gf-r { transform: rotateY(158deg); }
.ic--gatefold.is-opening .gf-inner { transform: translateZ(26px); }
.ic--gatefold.is-opening .ic-env { animation-name: gf-env-out; }
@keyframes gf-env-out { to { opacity: 0; transform: scale(1.12); } }

/* ── Thiệp mở: đỉnh vòm ── */
.ic--gatefold .ic-card {
  width: min(480px, 100%); padding: 108px 40px 42px; transform-style: preserve-3d;
  border-radius: 50% 50% 6px 6px / 220px 220px 6px 6px;
  background: var(--ic-grain), var(--ic-card-bg);
}
.ic--gatefold.is-open .ic-card { animation: gf-card-in .9s var(--ic-ease) both; }
@keyframes gf-card-in { from { opacity: 0; transform: translateZ(-160px) translateY(30px); } to { opacity: 1; transform: none; } }
.ic--gatefold .ic-card::before, .ic--gatefold .ic-card::after {
  content: ""; position: absolute; pointer-events: none; border: 1px solid var(--ic-line);
}
.ic--gatefold .ic-card::before { inset: 12px; border-radius: 50% 50% 3px 3px / 208px 208px 3px 3px; }
.ic--gatefold .ic-card::after { inset: 17px; border-color: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 50% 50% 2px 2px / 202px 202px 2px 2px; }
.ic--gatefold .ic-card > .gf-garland { position: absolute; top: 40px; left: 50%; width: 200px; margin-left: -100px; color: var(--accent); opacity: .8; }
.ic--gatefold .ic-mono { width: 70px; height: 70px; margin-bottom: 14px; }
.ic--gatefold .ic-name { font-size: clamp(2.3rem, 9vw, 3.4rem); }
.ic--gatefold .ic-dmy b { min-width: 1.5em; }

/* Hai cánh cửa đã mở đứng nghiêng hai bên (chỉ màn rộng — điện thoại không đủ chỗ) */
.gf-wing { display: none; }
@media (min-width: 980px) {
  .ic--gatefold .ic-card > .gf-wing {
    display: block; position: absolute; top: 0; width: 50%; height: min(100%, 760px); z-index: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 55%, rgba(255, 255, 255, .18)), var(--ic-grain), var(--ic-liner), var(--ic-env-in);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), inset 0 -40px 60px -40px rgba(0, 0, 0, .25);
  }
  .ic--gatefold .gf-wing-l { left: 0; transform-origin: 0 50%; border-radius: 100% 0 0 6px / 220px 0 0 6px;
    transform: rotateY(calc(-122deg + var(--tx) * 7deg)); }
  .ic--gatefold .gf-wing-r { right: 0; transform-origin: 100% 50%; border-radius: 0 100% 6px 0 / 0 220px 6px 0;
    transform: rotateY(calc(122deg + var(--tx) * 7deg)); }
  .ic--gatefold.is-open .gf-wing-l { animation: gf-wing-l 1.1s var(--ic-ease) both; }
  .ic--gatefold.is-open .gf-wing-r { animation: gf-wing-r 1.1s var(--ic-ease) both; }
  @keyframes gf-wing-l { from { transform: rotateY(-168deg); } }
  @keyframes gf-wing-r { from { transform: rotateY(168deg); } }
}
@media (max-width: 420px) {
  .ic--gatefold .ic-card { padding: 96px 24px 30px; border-radius: 50% 50% 6px 6px / 170px 170px 6px 6px; }
  .ic--gatefold .ic-card::before { border-radius: 50% 50% 3px 3px / 160px 160px 3px 3px; }
  .ic--gatefold .ic-card::after { border-radius: 50% 50% 2px 2px / 154px 154px 2px 2px; }
  .ic--gatefold .ic-card > .gf-garland { top: 34px; width: 170px; margin-left: -85px; }
}
