/* ===================== NƠ · REN · KHUNG 3D ===================== */
:root {
  /* Ren trắng (dùng trên nền nâu) */
  --lace-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cg fill='none' stroke='%23FBF6EE' stroke-width='.9'%3E%3Ccircle cx='11' cy='11' r='3.4'/%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='22' cy='0' r='3'/%3E%3Ccircle cx='0' cy='22' r='3'/%3E%3Ccircle cx='22' cy='22' r='3'/%3E%3Cpath d='M11 0v4M11 18v4M0 11h4M18 11h4M3 3l4.5 4.5M19 3l-4.5 4.5M3 19l4.5-4.5M19 19l-4.5-4.5'/%3E%3C/g%3E%3Cg fill='%23FBF6EE'%3E%3Ccircle cx='11' cy='11' r='1.2'/%3E%3Cellipse cx='11' cy='5.6' rx='1.1' ry='1.7'/%3E%3Cellipse cx='11' cy='16.4' rx='1.1' ry='1.7'/%3E%3Cellipse cx='5.6' cy='11' rx='1.7' ry='1.1'/%3E%3Cellipse cx='16.4' cy='11' rx='1.7' ry='1.1'/%3E%3C/g%3E%3C/svg%3E");

  /* Ren nâu nhạt (dùng trên nền ivory) */
  --lace-brown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cg fill='none' stroke='%23B98583' stroke-width='.8'%3E%3Ccircle cx='11' cy='11' r='3.4'/%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='22' cy='0' r='3'/%3E%3Ccircle cx='0' cy='22' r='3'/%3E%3Ccircle cx='22' cy='22' r='3'/%3E%3Cpath d='M11 0v4M11 18v4M0 11h4M18 11h4M3 3l4.5 4.5M19 3l-4.5 4.5M3 19l4.5-4.5M19 19l-4.5-4.5'/%3E%3C/g%3E%3Cg fill='%23B98583'%3E%3Ccircle cx='11' cy='11' r='1.1'/%3E%3Cellipse cx='11' cy='5.6' rx='1' ry='1.6'/%3E%3Cellipse cx='11' cy='16.4' rx='1' ry='1.6'/%3E%3Cellipse cx='5.6' cy='11' rx='1.6' ry='1'/%3E%3Cellipse cx='16.4' cy='11' rx='1.6' ry='1'/%3E%3C/g%3E%3C/svg%3E");

  /* Dải ren viền vỏ sò có lỗ xỏ (ngang) */
  --trim-ivory: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='20' viewBox='0 0 32 20'%3E%3Cpath fill='%23F8F3EA' fill-rule='evenodd' d='M0 0h32v9a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1-8 8a8 8 0 0 1-8-8zM8 9.5a2.2 2.2 0 1 0 0 .01zM24 9.5a2.2 2.2 0 1 0 0 .01zM4 3.5a1 1 0 1 0 0 .01zM12 3.5a1 1 0 1 0 0 .01zM20 3.5a1 1 0 1 0 0 .01zM28 3.5a1 1 0 1 0 0 .01z'/%3E%3C/svg%3E");
  --trim-brown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='20' viewBox='0 0 32 20'%3E%3Cpath fill='%23D9C7AE' fill-rule='evenodd' d='M0 0h32v9a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1-8 8a8 8 0 0 1-8-8zM8 9.5a2.2 2.2 0 1 0 0 .01zM24 9.5a2.2 2.2 0 1 0 0 .01zM4 3.5a1 1 0 1 0 0 .01zM12 3.5a1 1 0 1 0 0 .01zM20 3.5a1 1 0 1 0 0 .01zM28 3.5a1 1 0 1 0 0 .01z'/%3E%3C/svg%3E");
}

/* ---------- Nơ ---------- */
.bow {
  display: block;
  width: 92px; height: 74px;
  margin: 0 auto;
  background: var(--bow-img) center / contain no-repeat;
  filter: drop-shadow(0 4px 4px rgba(46, 31, 21, .28));
  pointer-events: none;
}
.bow--sm { width: 64px; height: 52px; }

/* ---------- Dải ren viền ---------- */
.lace-trim {
  height: 20px;
  margin: 0 calc(var(--gutter) * -1);
  max-width: none !important;
  background: var(--trim-brown) 0 0 / 32px 20px repeat-x;
  opacity: .9;
}
.sec--events > .lace-trim { margin-top: calc(var(--sec-pad) * -.6); margin-bottom: 40px; transform: scaleY(-1); }
.lace-trim--dark { background-image: var(--trim-ivory); opacity: 1; position: absolute !important; left: 0; right: 0; margin: 0; }
.lace-trim--top { top: -1px; }
.lace-trim--bottom { bottom: -1px; transform: scaleY(-1); }

/* ---------- Viền ren cả trang (đầu thiệp & lá thư) ---------- */
.lace-ring {
  position: absolute;
  background: var(--lace-brown) 0 0 / 22px 22px;
  padding: 14px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* ---------- Thẻ có nơ (như nhãn "Location") ---------- */
.tag {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: max-content; min-width: 190px;
  margin: 0 auto 22px;
  padding: 30px 28px 14px;
  background: var(--ivory);
  border: 1px solid var(--beige);
  box-shadow: 0 10px 22px -10px rgba(74, 52, 38, .35), 0 1px 0 rgba(255,255,255,.8) inset;
  transform: rotate(-1.5deg);
}
.tag::before { /* viền kép bên trong */
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(217, 199, 174, .7); pointer-events: none;
}
.tag__bow { position: absolute; top: -30px; left: 50%; transform: translateX(-50%) rotate(1.5deg); }
.tag__en { font-size: 11px; font-weight: 500; letter-spacing: .32em; text-transform: uppercase; color: var(--brown); }
.tag__vi { font-size: 40px; line-height: 1.15; }
.sec--dark .tag { color: var(--text); }
.sec--dark .tag .tag__vi { color: var(--brown); }

/* ---------- Khung ảnh 3D ---------- */
.tilt { perspective: 900px; }
.tilt__inner {
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .25s ease-out;
  will-change: transform;
}

/* Khung gỗ nâu chạm viền, nẹp mạ vàng, góc hoa văn, lót ren, ảnh nổi sau kính */
.frame3d {
  position: relative;
  width: min(76vw, 320px);
  margin: 46px auto 0;
  padding: 26px;
  border-radius: 3px;
  background:
    linear-gradient(to bottom, rgba(255,236,206,.28), transparent 10%, transparent 90%, rgba(0,0,0,.4)),
    linear-gradient(to right, rgba(255,236,206,.2), transparent 10%, transparent 90%, rgba(0,0,0,.32)),
    repeating-linear-gradient(100deg, rgba(0,0,0,.06) 0 1px, transparent 1px 4px, rgba(255,255,255,.03) 4px 5px, transparent 5px 9px),
    linear-gradient(135deg, #85603F, #5A3D27 55%, #3F2A1A);
  box-shadow:
    inset 2px 2px 1px rgba(255, 236, 206, .55),
    inset -2px -2px 2px rgba(0, 0, 0, .55),
    inset 0 0 0 6px rgba(0, 0, 0, .06),
    inset 7px 7px 6px -4px rgba(0, 0, 0, .35),
    0 1px 1px rgba(0,0,0,.3),
    0 14px 22px -6px rgba(46,31,21,.55),
    0 40px 60px -28px rgba(46,31,21,.6);
}
.frame3d::before { /* nẹp mạ vàng bên trong */
  content: ""; position: absolute; inset: 15px;
  border: 4px solid transparent;
  border-image: linear-gradient(135deg, #FBE7B8, #B98A40 30%, #F4DA9C 55%, #8E6428 80%, #E9CB86) 1;
  box-shadow: 0 0 0 1px rgba(40,25,10,.5), inset 0 0 0 1px rgba(40,25,10,.45), 0 2px 3px rgba(0,0,0,.35);
  transform: translateZ(8px);
  pointer-events: none;
}
.frame3d::after { /* 4 góc hoa văn vàng */
  content: ""; position: absolute; inset: 4px;
  background:
    var(--gilt-corner) left top / 46px 46px no-repeat;
  pointer-events: none;
  transform: translateZ(14px);
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.4));
}
.frame3d__corners { position: absolute; inset: 4px; pointer-events: none; transform: translateZ(14px); filter: drop-shadow(0 2px 1px rgba(0,0,0,.4)); }
.frame3d__corners::before, .frame3d__corners::after,
.frame3d__corners span::before, .frame3d__corners span::after {
  content: ""; position: absolute; width: 46px; height: 46px; background: var(--gilt-corner) center / contain no-repeat;
}
.frame3d__corners::before { right: 0; top: 0; transform: scaleX(-1); }
.frame3d__corners::after { left: 0; bottom: 0; transform: scaleY(-1); }
.frame3d__corners span::before { right: 0; bottom: 0; transform: scale(-1, -1); }
.frame3d--wide { width: min(84vw, 380px); }
.frame3d__lace { display: none; }
.frame3d__mat { /* lót ren + ảnh nổi */
  position: relative; display: block;
  padding: 14px;
  background: var(--lace-brown) 0 0 / 18px 18px, #FBF7EF;
  box-shadow: inset 0 0 0 1px rgba(166,132,95,.4), inset 3px 3px 8px rgba(60,40,20,.35);
  transform: translateZ(4px);
}
.frame3d__mat img {
  position: relative;
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  cursor: zoom-in;
  box-shadow: 0 0 0 4px #FBF7EF, 0 0 0 5px rgba(166,132,95,.5), 0 10px 16px rgba(20,12,8,.45);
  transform: translateZ(26px);
}
.frame3d__mat::after { /* phản chiếu mặt kính */
  content: ""; position: absolute; inset: 14px;
  background: linear-gradient(118deg, rgba(255,255,255,.28) 0%, rgba(255,255,255,.06) 32%, transparent 33%, transparent 70%, rgba(255,255,255,.08) 71%, transparent 85%);
  pointer-events: none; transform: translateZ(30px);
}
.frame3d--wide .frame3d__mat img { aspect-ratio: 3 / 4; }
.frame3d__bow {
  position: absolute; left: 50%; top: -52px;
  width: 132px; height: 102px;
  transform: translateX(-50%) translateZ(50px);
}

/* ---------- Logo cặp đôi ---------- */
.logo-mark {
  display: block; width: 70px; height: 70px; margin: 0 auto;
  background: var(--brown);
  -webkit-mask: var(--logo) center / contain no-repeat;
          mask: var(--logo) center / contain no-repeat;
}
body:not(.has-logo) .logo-mark { display: none; }
.logo-mark--letter { width: 34px; height: 34px; margin-bottom: 2px; }
.logo-mark--head { width: 84px; height: 84px; margin: -4px auto 4px; }
.logo-mark--closing { width: 90px; height: 90px; margin-top: 10px; }
.logo-mark--light { background: var(--cream); width: 56px; height: 56px; margin-bottom: 6px; }

/* ---------- Hoạ tiết vẽ tay ---------- */
.doodle {
  position: absolute !important; z-index: 0;
  display: block; max-width: none !important; margin: 0 !important;
  background: center / contain no-repeat;
  opacity: .85; pointer-events: none;
}
.doodle--bow { background-image: var(--doodle-bow); width: 70px; height: 52px; }
.doodle--flower { background-image: var(--doodle-flower); width: 58px; height: 80px; }
.doodle--sprig { background-image: var(--doodle-sprig); width: 96px; height: 48px; }
.doodle--heart { background-image: var(--doodle-heart); width: 34px; height: 30px; }
.doodle--rose { background-image: var(--doodle-rose); width: 60px; height: 74px; }
.sec--dark .doodle { filter: invert(.88) sepia(.3); opacity: .55; }

@media (prefers-reduced-motion: reduce) {
  .tilt__inner { transform: none !important; transition: none; }
}

/* bổ sung */
.frame3d__mat { transform-style: preserve-3d; }
.bow { filter: drop-shadow(0 6px 5px rgba(46, 31, 21, .35)) drop-shadow(0 1px 1px rgba(46,31,21,.3)); }

/* ===== Nơ vẽ tay tông nâu (2026-12-01) ===== */
.bow { background-image: url("/assets/img/bow-short.png"); width: 100px; height: 71px; filter: drop-shadow(0 3px 3px rgba(46,31,21,.25)); }
.bow--sm { width: 72px; height: 51px; }
.head__inner .bow.bow--full { background-image: url("/assets/img/bow.png"); width: 92px; height: 142px; margin-bottom: -6px; }
.letter__inner .bow { width: 46px; height: 33px; }
.tag__bow { top: -34px; }
.card-frame__bow { top: -34px; }
.frame3d__bow { width: 140px; height: 99px; top: -58px; }

/* ===== Bỏ hiệu ứng 3D, giữ khung ảnh ===== */
.tilt { perspective: none; }
.tilt__inner, .tilt__inner * { transform: none !important; }
.frame3d__bow { transform: translateX(-50%) !important; }

/* ===== Nơ ngắn mới (vuông) — 2026-12-01 ===== */
.bow { width: 82px; height: 83px; }
.bow--sm { width: 60px; height: 61px; }
.letter__inner .bow { width: 40px; height: 40px; }
.tag__bow { top: -46px; }
.card-frame__bow { top: -46px; }
.card-frame--bow { padding-top: 58px; }
.frame3d__bow { width: 112px; height: 113px; top: -74px; }
.reply .bow { display: none; }

/* ===== Khung ren oval cho ảnh oval ===== */
.frame-oval, .story__photo.frame-oval {
  position: relative;
  aspect-ratio: 674 / 883;
  padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none;
}
.frame-oval img {
  position: absolute; left: 12.5%; top: 9.5%; width: 75%; height: 81%;
  aspect-ratio: auto; border-radius: 50%; object-fit: cover;
}
.frame-oval::after {
  content: ""; position: absolute; inset: 0;
  background: url("/assets/img/oval-lace.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 4px rgba(74, 52, 38, .28));
  pointer-events: none;
}

/* Trang đầu dùng nơ ngắn như các chỗ khác */
.head__inner .bow.bow--full { background-image: url("/assets/img/bow-short.png"); width: 96px; height: 97px; margin-bottom: 0; }
