/* Mẫu 7 — ÉP KIM XOAY (foil-flip). Thiệp giấy dày màu đậm (pha từ màu nhấn của giao diện), mép mạ vàng nhìn thấy khi
   nghiêng (3 lớp giấy cách nhau theo chiều sâu), khung art-deco + quạt + chữ lồng ÉP NHŨ: ánh kim chạy theo chuột/cảm biến
   nghiêng, thêm lớp bóng lướt. Chạm -> thiệp nhấc lên và xoay; nửa sau cú xoay (-90° -> 0) chính là thiệp mở: mặt sau
   màu đậm sang trọng, chữ nhũ vàng, góc art-deco, ngày cưới dạng vé. */
.ic--foil-flip {
  --ic-out-delay: .36s;
  --ff-ink: color-mix(in srgb, var(--accent) 30%, #121016);
  --ff-frame: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 296 424' preserveAspectRatio='none'><path d='M2 2H294V422H2Z M10 26H18V18H26V10H270V18H278V26H286V398H278V406H270V414H26V406H18V398H10Z M26 34a8 8 0 0 0 8-8 M262 26a8 8 0 0 0 8 8 M34 398a8 8 0 0 0-8-8 M270 390a8 8 0 0 0-8 8 M148 392l8 8-8 8-8-8Z M118 400H136 M160 400H178' fill='none' stroke='black' stroke-width='1.3'/></svg>");
  --ff-fan: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 296 424' preserveAspectRatio='none'><path d='M122 104a26 26 0 0 1 52 0 M123.6 95.1L93.5 84.2 M125.9 90.4L108.8 79.9 M129.1 86.2L105.8 64.2 M133.1 82.7L121.6 66.3 M137.7 80.1L125.0 50.7 M142.7 78.5L138.7 59.0 M148.0 78.0L148.0 46.0 M153.3 78.5L157.3 59.0 M158.3 80.1L171.0 50.7 M162.9 82.7L174.4 66.3 M166.9 86.2L190.2 64.2 M170.1 90.4L187.2 79.9 M172.4 95.1L202.5 84.2 M96 104H200' fill='none' stroke='black' stroke-width='1.3'/></svg>");
  --ff-fan2: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 70'><path d='M58 68a22 22 0 0 1 44 0 M66 68a14 14 0 0 1 28 0 M58.3 64.2L17.0 56.9 M59.5 60.0L33.5 49.7 M61.5 56.1L26.2 33.3 M64.3 52.6L44.2 33.1 M67.6 49.8L43.9 15.1 M71.5 47.7L60.6 21.9 M75.6 46.4L67.3 5.3 M80.0 46.0L80.0 18.0 M84.4 46.4L92.7 5.3 M88.5 47.7L99.4 21.9 M92.4 49.8L116.1 15.1 M95.7 52.6L115.8 33.1 M98.5 56.1L133.8 33.3 M100.5 60.0L126.5 49.7 M101.7 64.2L143.0 56.9 M4 68H156' fill='none' stroke='black' stroke-width='1.4'/></svg>");
  --ff-corner: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'><path d='M2 78V2H78 M10 70V10H70 M10 30H22V22H30V10 M18 78V18H78 M30 40a10 10 0 0 1 10-10' fill='none' stroke='black' stroke-width='1.5'/><path d='M22 22l4 4-4 4-4-4Z'/></svg>");
}
[data-theme="songhy"] .ic--foil-flip { --ff-ink: #5a0f0b; }
[data-theme="demsao"] .ic--foil-flip { --ff-ink: #0b1230; }
[data-theme="tapchi"] .ic--foil-flip { --ff-ink: #151413; }
[data-theme="hoangkim"] .ic--foil-flip { --ff-ink: #1d1912; }

/* ── Bìa ── */
/* R2-CARDS-01: điện thoại xoay ngang -> bìa vừa chiều cao màn (tên khách + nút "Chạm để mở" không rơi khỏi màn) */
.ic--foil-flip .ic-env-btn { width: min(320px, 76vw, calc((100vh - 140px) * 5 / 7)); aspect-ratio: 5 / 7; animation: ff-idle 7s ease-in-out infinite; }
@keyframes ff-idle { 0%, 100% { transform: rotateY(-4deg) rotateX(2deg); } 50% { transform: rotateY(5deg) rotateX(-2deg) translateY(-6px); } }
.ic--foil-flip.is-opening .ic-env-btn { animation: none; }
.ff, .ff > span, .ff-front > span, .ff-back > span { position: absolute; display: block; }
.ff { inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.55, 0, .8, .3); }
.ff > span { inset: 0; border-radius: 7px; }
.ff-ply { background: color-mix(in srgb, var(--ff-ink) 70%, #000); }
.ff-ply-1 { transform: translateZ(-1.6px); }
.ff-ply-2 { transform: translateZ(-3.2px); background: linear-gradient(135deg, #8a6a2c, #f3dc9a 40%, #a8853d 60%, #e9cf86); }  /* mép mạ vàng */
.ff-ply-3 { transform: translateZ(-4.8px); box-shadow: 0 46px 70px -30px rgba(0, 0, 0, .6), 0 10px 20px -10px rgba(0, 0, 0, .4); }
.ff > .ff-front, .ff > .ff-back { -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.ff > .ff-front {
  display: flex; flex-direction: column; align-items: center; padding-top: 37%; text-align: center; overflow: hidden;
  background: var(--ic-grain), radial-gradient(120% 70% at 30% 10%, rgba(255, 255, 255, .1), transparent 60%), var(--ff-ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.ff > .ff-back { transform: translateZ(-4.9px) rotateY(180deg); background: var(--ic-grain), var(--ff-ink); }
.ff-frame, .ff-fan, .ff-c, .ff-rim { background: var(--ic-foil); background-size: 240% 100%; background-position: calc(50% + var(--tx) * 40%) 0; }
.ff-front .ff-frame, .ff-back .ff-frame { inset: 12px; -webkit-mask: var(--ff-frame) center / 100% 100% no-repeat; mask: var(--ff-frame) center / 100% 100% no-repeat; }
.ff-front .ff-fan { inset: 12px; -webkit-mask: var(--ff-fan) center / 100% 100% no-repeat; mask: var(--ff-fan) center / 100% 100% no-repeat; }
.ff-front > .ff-eyebrow, .ff-front > .ff-mono, .ff-front > .ff-date { position: relative; }
.ff-eyebrow { font: 600 .75rem/1.3 var(--f-ui, system-ui, sans-serif); letter-spacing: .3em; text-transform: uppercase; }
.ff-mono { margin-top: 8px; font: var(--name-style, normal) 400 4rem/1.15 var(--f-name, Georgia, serif); padding: 0 .12em; }
.ff-mono i { font-style: normal; font-size: .45em; margin: 0 .1em; vertical-align: .4em; }
.ff-date { margin-top: 6px; font: 500 1rem/1 var(--f-head, Georgia, serif); letter-spacing: .2em; }
.ic--foil-flip .ic-env-to { left: 12%; right: 12%; bottom: 14%; justify-items: center; text-align: center; transform: translateZ(1px); --ic-to-small: #cdbf9e; }
.ic--foil-flip .ic-env-to small { letter-spacing: .16em; font-size: .875rem; }   /* M1-CARDS-03: ≥14px */
.ic--foil-flip .ic-env-to b {
  background: var(--ic-foil); background-size: 240% 100%; background-position: calc(50% + var(--tx) * 40%) 0;
  -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .1em;
}
.ic--foil-flip.is-opening .ff { transform: translateZ(70px) rotateY(90deg); }
.ic--foil-flip.is-opening .ic-env { animation: none; }

/* ── Thiệp mở: nửa sau cú xoay ── */
.ic--foil-flip .ic-card {
  --ink: #f3e9d2; --muted: #cdbf9e; --accent: #e2c47c; --ic-on-accent: #1a140c; --ic-line: rgba(217, 184, 102, .42); --ic-paper: var(--ff-ink);
  width: min(470px, 100%); padding: 112px 42px 48px; border-radius: 8px; color: var(--ink);
  background: var(--ic-grain), radial-gradient(90% 40% at 50% 0%, rgba(255, 255, 255, .08), transparent 70%), var(--ff-ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 2px 0 #b8934a, 0 3px 0 #8a6a2c, 0 50px 90px -40px rgba(0, 0, 0, .6);
}
.ic--foil-flip.is-open .ic-card { animation: ff-in .62s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes ff-in { from { transform: translateZ(70px) rotateY(-90deg); } to { transform: none; } }
.ic--foil-flip .ff-deco > span { position: absolute; display: block; }
.ff-deco .ff-rim { inset: 12px; background: none; border: 1px solid transparent; border-image: var(--ic-foil) 1; }
.ff-deco .ff-c { width: 78px; height: 78px; -webkit-mask: var(--ff-corner) center / contain no-repeat; mask: var(--ff-corner) center / contain no-repeat; }
.ff-c1 { top: 18px; left: 18px; } .ff-c2 { top: 18px; right: 18px; transform: scaleX(-1); }
.ff-c3 { bottom: 18px; left: 18px; transform: scaleY(-1); } .ff-c4 { bottom: 18px; right: 18px; transform: scale(-1); }
.ff-deco .ff-fan { top: 26px; left: 50%; width: 170px; height: 74px; margin-left: -85px; -webkit-mask: var(--ff-fan2) center / contain no-repeat; mask: var(--ff-fan2) center / contain no-repeat; }
.ff-deco .ff-gloss {
  left: 0; right: 0; top: 0; height: 420px; border-radius: 8px 8px 0 0; mix-blend-mode: soft-light; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .5) 46%, rgba(255, 255, 255, .1) 54%, transparent 66%) no-repeat;
  background-size: 260% 100%; background-position: calc(50% + var(--tx) * 45%) 0;
  -webkit-mask: linear-gradient(#000 55%, transparent); mask: linear-gradient(#000 55%, transparent);
}
.ic--foil-flip .ic-mono { border: 0; box-shadow: none; width: auto; height: auto; margin-bottom: 18px; font-size: 1.1rem; letter-spacing: .3em; color: var(--accent); }
.ic--foil-flip .ic-mono i { color: var(--accent); }
.ic--foil-flip .ic-card .ic-name, .ic--foil-flip .ic-couple span, .ic--foil-flip .ic-dmy b, .ic--foil-flip .ic-done-title {
  background: var(--ic-foil); background-size: 240% 100%; background-position: calc(50% + var(--tx) * 40%) 0;
  -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .08em;
}
.ic--foil-flip .ic-couple { color: var(--ink); }
.ic--foil-flip .ic-text { color: color-mix(in srgb, var(--ink) 88%, transparent); }
.ic--foil-flip .ic-dmy { gap: 18px; }
.ic--foil-flip .ic-dmy i { width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }
.ic--foil-flip .ic-date { padding: 14px 0; margin: 20px 0 6px; border-top: 1px solid var(--ic-line); border-bottom: 1px solid var(--ic-line); }
.ic--foil-flip .ic-btn-yes { background: var(--ic-foil); background-size: 200% 100%; border-color: #c9a75a; color: #1a140c; }
.ic--foil-flip .ic-btn-yes:hover:not(:disabled) { background: var(--ic-foil); background-size: 200% 100%; background-position: 100% 0; }
.ic--foil-flip .ic-btn-no { border-color: rgba(243, 233, 210, .4); color: var(--ink); }
.ic--foil-flip .ic-msg textarea, .ic--foil-flip .ic-stepper input { background: rgba(255, 255, 255, .06); color: var(--ink); }
.ic--foil-flip .ic-err, .ic--foil-flip .ic-count-hint.is-warn { color: #ffb4a8; }
@media (max-width: 420px) {
  .ic--foil-flip .ic-card { padding: 104px 26px 40px; }
  .ff-deco .ff-c { width: 56px; height: 56px; }
}

/* R2-CARDS-01: xoay ngang (bìa ~180px) -> chữ trên bìa nhỏ theo, không đè nhãn "Thân gửi". */
@media (max-height: 500px) {
  .ic--foil-flip .ff > .ff-front { padding-top: 22%; }
  .ic--foil-flip .ff-eyebrow { font-size: .5625rem; letter-spacing: .1em; white-space: nowrap; }   /* 06/10: .22em tràn mép bìa ~120px */
  .ic--foil-flip .ff-mono { font-size: 2.2rem; margin-top: 4px; }
  .ic--foil-flip .ff-date { font-size: .8125rem; margin-top: 2px; }
  .ic--foil-flip .ic-env-to { bottom: 10%; }
}
