/* Mẫu 1 — PHONG BÌ CỔ ĐIỂN (classic): phong bì giấy lót họa tiết, dấu sáp chữ lồng; chạm -> nắp lật 3D, thiệp nhô lên rồi
   hiện thiệp đơn căn giữa. Mỗi giao diện có chất riêng (vàng mạ, đỏ song hỷ, tạp chí, vườn lá, đêm sao, vòm đất nung). */

/* ── Phong bì ── */
.ic--classic .ic-env-btn {
  width: min(420px, 90vw, calc((100vh - 140px) * 7 / 6)); aspect-ratio: 7 / 5; border-radius: 3px;   /* R2-CARDS-01: xoay ngang -> vừa chiều cao màn */
  background: var(--ic-grain), var(--ic-liner), var(--ic-env-in);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .5), 0 12px 24px -12px rgba(0, 0, 0, .18), 0 1px 2px rgba(0, 0, 0, .1);
  animation: ic-float 5s ease-in-out infinite;
  transform-style: flat; perspective: 1100px;   /* lớp phẳng (giữ thứ tự z-index), cả phong bì nghiêng theo sân khấu */
}
/* Tờ thiệp nhô lên khi mở */
.ic--classic .ic-env-btn::before {
  content: ""; position: absolute; left: 7%; right: 7%; top: 6%; bottom: 10%; z-index: 1; border-radius: 3px;
  background: var(--ic-grain), var(--ic-card-bg); box-shadow: inset 0 0 0 6px var(--ic-paper), inset 0 0 0 7px var(--ic-line);
  transition: transform .45s cubic-bezier(.2, .7, .2, 1) .28s;
}
.ic--classic .ic-env-body {
  position: absolute; inset: 0; z-index: 2; border-radius: 3px;
  background: var(--ic-grain), linear-gradient(172deg, rgba(255, 255, 255, .16), rgba(0, 0, 0, .05)), var(--ic-env-front);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
/* Bóng mép nắp đè lên thân phong bì */
.ic--classic .ic-env-btn::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(56% + 4px); z-index: 3; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .14)); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: opacity .2s;
}
.ic--classic .ic-env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 56%; z-index: 4;
  background: var(--ic-grain), linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .04)), var(--ic-env-flap);
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0;
  transition: transform .55s cubic-bezier(.45, 0, .25, 1), z-index 0s .26s;
}
.ic--classic .ic-seal {
  position: absolute; left: 50%; top: 56%; z-index: 5; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 48% 52% 50% 50% / 53% 47% 53% 47%;
  display: grid; 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) 40%, color-mix(in srgb, var(--ic-wax) 72%, #000) 100%);
  color: var(--ic-wax-ink); font: var(--name-style, normal) 400 1.35rem/1 var(--f-name, Georgia, serif);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .22);
  box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--ic-wax) 90%, #000), inset 0 0 0 7px rgba(255, 255, 255, .22), 0 0 0 3px color-mix(in srgb, var(--ic-wax) 55%, transparent),
    0 10px 18px -6px rgba(0, 0, 0, .5);
  transform: translateZ(10px); transition: opacity .25s, transform .25s;
}
.ic--classic .ic-seal i { font-style: normal; font-size: .62em; opacity: .85; }
.ic--classic .ic-env-to { left: 8%; right: 8%; bottom: 8%; z-index: 5; text-align: center; }

.ic--classic.is-opening .ic-env-btn { animation: none; }
.ic--classic.is-opening .ic-env-flap { transform: rotateX(180deg); z-index: 0; }
.ic--classic.is-opening .ic-env-btn::before { transform: translateY(-46%); }
.ic--classic.is-opening .ic-env-btn::after { opacity: 0; }
.ic--classic.is-opening .ic-seal { opacity: 0; transform: scale(.7); }
.ic--classic { --ic-out-delay: .39s; }

/* ── Thiệp ── */
.ic--classic .ic-card { background: var(--ic-card-deco), var(--ic-grain), var(--ic-card-bg); }
.ic--classic .ic-card::before, .ic--classic .ic-card::after { content: ""; position: absolute; pointer-events: none; border: 1px solid var(--ic-line); border-radius: 2px; }
.ic--classic .ic-card::before { inset: 10px; }
.ic--classic .ic-card::after { inset: 14px; border-color: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Tên khách 2 dòng (điện thoại, hoặc tên dài ở mọi cỡ màn): phong bì cao hơn, nắp + con dấu lên cao (R2-24). */
@media (max-width: 420px) and (min-width: 341px) {
  .ic--classic .ic-env-btn { aspect-ratio: 7 / 6; }
  .ic--classic .ic-env-flap { height: 46%; }
  .ic--classic .ic-env-btn::after { height: calc(46% + 4px); }
  .ic--classic .ic-env-body { clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%); }
  .ic--classic .ic-seal { top: 46%; width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 1.15rem; }
}
@media (min-width: 421px) {
  .ic--classic.ic--long .ic-env-btn { aspect-ratio: 7 / 6; }
  .ic--classic.ic--long .ic-env-flap { height: 46%; }
  .ic--classic.ic--long .ic-env-btn::after { height: calc(46% + 4px); }
  .ic--classic.ic--long .ic-env-body { clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%); }
  .ic--classic.ic--long .ic-seal { top: 46%; }
}
/* Màn hẹp / phóng chữ 150% (~260px): con dấu nhỏ lại + đặt cao hơn, phong bì cao hơn -> không đè "Thân gửi". */
@media (max-width: 340px) {
  .ic--classic .ic-env-btn { aspect-ratio: 7 / 6.4; }
  .ic--classic .ic-env-flap, .ic--classic .ic-env-btn::after { height: 40%; }
  .ic--classic .ic-env-body { clip-path: polygon(0 0, 50% 40%, 100% 0, 100% 100%, 0 100%); }
  .ic--classic .ic-seal { top: 40%; width: 50px; height: 50px; margin: -25px 0 0 -25px; font-size: 1rem; }
  .ic--classic .ic-env-to b { font-size: 1.15rem; }
  .ic--classic .ic-env-to small { letter-spacing: .08em; }
}

/* M1-CARDS-02: xoay ngang (phong bì cao ~180px) -> con dấu nhỏ + lên cao, nhãn sát đáy -> không đè "Thân gửi". */
@media (max-height: 500px) {
  .ic--classic .ic-env-btn { width: min(420px, 90vw, calc((100vh - 110px) * 7 / 5)); }
  .ic--classic .ic-seal { top: 42%; width: 50px; height: 50px; margin: -25px 0 0 -25px; font-size: .95rem; }
  .ic--classic .ic-env-to { bottom: 5%; }
}

/* ══ Chất riêng theo giao diện ══ */
[data-theme="hoangkim"] .ic--classic .ic-card { border: 3px solid transparent; border-image: linear-gradient(135deg, #8a6a30, #e9d59f 30%, #a8843f 50%, #f3e2b0 70%, #8a6a30) 1; }
[data-theme="hoangkim"] .ic--classic .ic-card::before { inset: 9px; border-color: rgba(168, 132, 47, .7); }
[data-theme="hoangkim"] .ic--classic .ic-card::after { inset: 14px; border-color: rgba(168, 132, 47, .3); }
[data-theme="hoangkim"] .ic--classic .ic-mono { border-radius: 0; border: 0; box-shadow: none; position: relative; color: var(--ink); }
[data-theme="hoangkim"] .ic--classic .ic-mono::before { content: ""; position: absolute; inset: 12px; border: 1px solid #b8964f; transform: rotate(45deg); }
[data-theme="hoangkim"] .ic--classic .ic-card .ic-name { color: #8f6d33; }

[data-theme="songhy"] .ic--classic {
  --ic-card-deco: var(--corner-tl) 20px 20px / 30px no-repeat, var(--corner-tr) calc(100% - 20px) 20px / 30px no-repeat,
    var(--corner-bl) 20px calc(100% - 20px) / 30px no-repeat, var(--corner-br) calc(100% - 20px) calc(100% - 20px) / 30px no-repeat;
  --ic-sh: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='none' stroke='black' stroke-width='6' stroke-linecap='square'><path d='M8 12H45M55 12H92M26.5 3V24M73.5 3V24M15 24H38M62 24H85M15 32H38V45H15ZM62 32H85V45H62Z'/><path d='M19 52l3 6M34 52l-3 6M66 52l3 6M81 52l-3 6M5 64H95M15 73H38V95H15ZM62 73H85V95H62Z'/></g></svg>"); }
[data-theme="songhy"] .ic--classic .ic-env-btn::before { box-shadow: inset 0 0 0 6px #fffaf0, inset 0 0 0 7px rgba(179, 38, 30, .5); }
[data-theme="songhy"] .ic--classic .ic-seal { font-size: 0; }
[data-theme="songhy"] .ic--classic .ic-seal i { display: none; }
[data-theme="songhy"] .ic--classic .ic-seal::before { content: ""; width: 34px; height: 34px; background: var(--ic-wax-ink); -webkit-mask: var(--ic-sh) center / contain no-repeat; mask: var(--ic-sh) center / contain no-repeat; }
[data-theme="songhy"] .ic--classic .ic-card { border: 2px solid #b3261e; }
[data-theme="songhy"] .ic--classic .ic-card::before { inset: 7px; border-color: rgba(196, 147, 58, .8); }
[data-theme="songhy"] .ic--classic .ic-card::after { display: none; }
[data-theme="songhy"] .ic--classic .ic-mono { border: 0; box-shadow: none; width: 64px; height: 64px; font-size: 0; }
[data-theme="songhy"] .ic--classic .ic-mono > * { display: none; }
[data-theme="songhy"] .ic--classic .ic-mono::before { content: ""; width: 60px; height: 60px; background: #b3261e; -webkit-mask: var(--ic-sh) center / contain no-repeat; mask: var(--ic-sh) center / contain no-repeat; }

[data-theme="tapchi"] .ic--classic .ic-card, [data-theme="tapchi"] .ic--classic .ic-env-btn { border-radius: 0; }
[data-theme="tapchi"] .ic--classic .ic-env-btn { box-shadow: 0 0 0 1px #161514, 0 40px 70px -30px rgba(0, 0, 0, .45); }
[data-theme="tapchi"] .ic--classic .ic-env-btn::after { background: linear-gradient(rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, .1)); }
[data-theme="tapchi"] .ic--classic .ic-seal { border-radius: 0; background: #161514; box-shadow: 0 10px 18px -8px rgba(0, 0, 0, .5); text-shadow: none; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  font: 400 1.2rem/1 var(--f-name); }
[data-theme="tapchi"] .ic--classic .ic-card { border: 1px solid #161514; text-align: left; }
[data-theme="tapchi"] .ic--classic .ic-card::before { inset: 8px; border-color: #161514; }
[data-theme="tapchi"] .ic--classic .ic-card::after { display: none; }
[data-theme="tapchi"] .ic--classic .ic-mono { margin: 0 0 22px; border-radius: 0; border: 0; box-shadow: none; background: #161514; color: #fff; width: 56px; height: 56px; font-size: 1.2rem; }
[data-theme="tapchi"] .ic--classic .ic-mono i { color: #fff; }
[data-theme="tapchi"] .ic--classic .ic-card .ic-name { color: #161514; font-size: clamp(2.4rem, 10vw, 3.4rem); letter-spacing: -.02em; line-height: 1.1; }
[data-theme="tapchi"] .ic--classic .ic-text { margin: 0 !important; }
[data-theme="tapchi"] .ic--classic .ic-rule { margin: 24px 0 18px; width: 100%; }
[data-theme="tapchi"] .ic--classic .ic-rule span { display: none; }
[data-theme="tapchi"] .ic--classic .ic-rule::before { border-color: #161514; }
[data-theme="tapchi"] .ic--classic .ic-rule::after { display: none; }
[data-theme="tapchi"] .ic--classic .ic-couple { justify-content: flex-start; }
[data-theme="tapchi"] .ic--classic .ic-dmy { justify-content: flex-start; font-size: 2.8rem; }
[data-theme="tapchi"] .ic--classic .ic-place, [data-theme="tapchi"] .ic--classic .ic-rsvp { border-top: 1px solid #161514; }
[data-theme="tapchi"] .ic--classic .ic-link { justify-self: start; color: #161514; }
[data-theme="tapchi"] .ic--classic .ic-q, [data-theme="tapchi"] .ic--classic .ic-note { text-align: left; }
[data-theme="tapchi"] .ic--classic .ic-done { justify-items: start; }
[data-theme="tapchi"] .ic--classic .ic-enter { border-color: #161514; }

[data-theme="vuonhoa"] .ic--classic {
  --ic-branch: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'><g fill='none' stroke='%235c6b3a' stroke-width='1.3' stroke-linecap='round'><path d='M4 116C30 90 52 60 60 20'/><path d='M22 96c-10-2-16-8-18-16 10 1 16 7 18 16zM23 95c3-9 10-13 18-13-2 8-9 13-18 13zM38 74c-9-3-14-9-15-17 9 2 14 8 15 17zM39 73c4-8 11-12 19-11-3 8-10 12-19 11zM50 50c-8-4-11-11-10-19 8 4 11 11 10 19zM51 49c5-7 12-10 20-8-4 7-12 10-20 8zM60 20c1-8 6-13 13-15 0 8-5 13-13 15z'/></g></svg>");
  --ic-card-deco: var(--ic-branch) 6px calc(100% - 6px) / 110px no-repeat; }
[data-theme="vuonhoa"] .ic--classic .ic-card { border-radius: 14px; }
[data-theme="vuonhoa"] .ic--classic .ic-card::before, [data-theme="vuonhoa"] .ic--classic .ic-card::after { border-radius: 8px; }
[data-theme="vuonhoa"] .ic--classic .ic-card::after { inset: auto 6px auto auto; top: 6px; width: 110px; height: 110px; border: 0; transform: scale(-1, -1);
  background: var(--ic-branch) center / contain no-repeat; }

[data-theme="demsao"] .ic--classic .ic-env-btn { background-size: 180px 180px, 170px 170px, 170px 170px, 170px 170px, 170px 170px, 170px 170px, 170px 170px; }
[data-theme="demsao"] .ic--classic .ic-env-btn::before { background: #16204a; box-shadow: inset 0 0 0 6px #16204a, inset 0 0 0 7px rgba(216, 181, 106, .5); }
[data-theme="demsao"] .ic--classic .ic-card { background: var(--stars-a), linear-gradient(180deg, #16204a, #0f1838);
  background-size: 230px 230px, 230px 230px, 230px 230px, 230px 230px, 230px 230px, 230px 230px, auto; }
[data-theme="demsao"] .ic--classic .ic-mono { color: var(--gold); }
[data-theme="demsao"] .ic--classic .ic-card .ic-name { color: #e3c47e; }

[data-theme="datnung"] .ic--classic .ic-card { border-radius: 240px 240px 8px 8px; padding-top: 88px; }
[data-theme="datnung"] .ic--classic .ic-card::before { border-radius: 230px 230px 4px 4px; }
[data-theme="datnung"] .ic--classic .ic-card::after { border-radius: 224px 224px 2px 2px; }
[data-theme="datnung"] .ic--classic .ic-mono { border-radius: 999px 999px 8px 8px; }
@media (max-width: 420px) {
  [data-theme="datnung"] .ic--classic .ic-card { border-radius: 180px 180px 8px 8px; padding-top: 76px; }
  [data-theme="datnung"] .ic--classic .ic-card::before { border-radius: 170px 170px 4px 4px; }
  [data-theme="datnung"] .ic--classic .ic-card::after { border-radius: 166px 166px 2px 2px; }
}
