/* ============================================================
   SECTION: WISHES (家族への想い & 健康は一生の付き合い)
   ============================================================ */

.wishes {
  position: relative;
  /* overflow: clip; */
  z-index: 3;
  background-color: var(--color-navy-deep);
  margin-bottom: calc(-1 * var(--wishes-slant-y));

  /* CSS Variables to control the slanted cuts and vertical gap width */
  --wishes-slant-y: 40px; /* Độ dốc dọc (top/bottom) */
  --wishes-slant-x: 40px;  /* Độ dốc ngang giữa 2 cột (0px = khít hoàn toàn) */
}

.wishes + * {
  position: relative;
  z-index: 2;
}

/* Background vertical text "WISHES" */
.wishes__deco {
  position: absolute;
  top: 0;
  right: 0;
  height: 480px;
  width: auto;
  pointer-events: none;
  user-select: none;
  z-index: 5;
}

/* On SP the area under the deco is white, so the white SVG is invisible.
   Hide the raster and redraw the "WISHES" shape with a soft gradient via a
   masked pseudo-element (the gradient only shows inside the letters). */
@media (max-width: 1023px) {
  .wishes__deco {
    display: none;
  }
  .wishes::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 480px;
    background: linear-gradient(0deg, rgba(8, 0, 82, 0) 0%, rgba(18, 0, 184, 0.3) 100%);
    -webkit-mask: url(../img/deco-wishes.svg) no-repeat center / contain;
            mask: url(../img/deco-wishes.svg) no-repeat center / contain;
    pointer-events: none;
    z-index: 5;
  }
}

/* Container and Grid */
.wishes__grid {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* Panel Base Styles */
.wishes__panel {
  position: relative;
  width: 100%;
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Text Panels */
.wishes__panel--text {
  background-color: var(--color-white);
  padding: 56px 16px;
  white-space: nowrap;
}

.wishes__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 24px;
  color: var(--color-navy-deep);
  line-height: 1.4;
  margin-bottom: 24px;
  letter-spacing: 0.03em;
}

.wishes__text p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  letter-spacing: 0.02em;
  margin: 0;
}

.wishes__text p + p {
  margin-top: 20px;
}

/* Mọi ngôn ngữ TRỪ tiếng Nhật: cho toàn bộ chữ trong panel text tự xuống dòng
   (tiêu đề, mô tả, cards, note) để bản dịch dài không bị tràn.
   JA giữ nowrap + <br> thủ công. html[lang] do i18n.js set. */
html:not([lang="ja"]) .wishes__panel--text {
  white-space: normal;
}

/* Wish Cards Grid */
.wishes__cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 16px;
  margin-top: 40px;
  margin-bottom: 32px;
}

.wish-card {
  position: relative;
  background-color: var(--color-white);
  padding: 42px 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(8, 0, 82, 0.06);
  border: 1px solid rgba(8, 0, 82, 0.05);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 1023px) {
  .wish-card:first-child {
    grid-column: span 2;
    justify-self: center;
    width: 100%;
    max-width: 180px;
  }
}

.wish-card__capsule {
  background-color: var(--color-navy);
  color: var(--color-white);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  box-shadow: 0 4px 10px rgba(8, 0, 82, 0.15);
}

@media (min-width: 1024px) {
  .wish-card__capsule {
    font-size: 24px;
    width: 70px;
    height: 70px;
  }
}

.wish-card__text {
  font-size: 13px;
  color: var(--color-navy);
  line-height: 1.4;
  margin: 0;
}

.wishes__note {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--color-navy-deep);
  margin-top: 16px;
  margin-bottom: 0;
}

/* Media Panels */
.wishes__panel--media {
  height: 550px;
}

.wishes__img-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.wishes__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile panel wrapper base styles */
.wishes__panel-wrapper {
  position: relative;
  width: 100%;
}

/* Mobile ordering: Panel 1 -> Panel 2 -> Panel 4 -> Panel 3 */
.wishes__panel--1 { order: 1; }
.wishes__panel-wrapper--2 { order: 2; }
.wishes__panel--4 { order: 3; }
.wishes__panel--3 { order: 4; }

/* Mobile slanted cuts (clip-path parallelogram shape) */
.wishes__panel {
  clip-path: polygon(0 0, 100% var(--wishes-slant-y), 100% 100%, 0 calc(100% - var(--wishes-slant-y)));
}

.wishes__panel--1 {
  clip-path: polygon(0 var(--wishes-slant-y), 100% 0, 100% 100%, 0 calc(100% - var(--wishes-slant-y)));
}

.wishes__panel--3 {
  clip-path: polygon(0 var(--wishes-slant-y), 100% 0, 100% calc(100% - var(--wishes-slant-y)), 0 100%);
}

.wishes__panel--4 {
  clip-path: polygon(0 0, 100% var(--wishes-slant-y), 100% 0, 100% calc(100% - var(--wishes-slant-y)), 0 100%);
}

/* Apply negative margin-top between all grid direct children on mobile */
.wishes__grid > * + * {
  margin-top: calc(-1 * var(--wishes-slant-y));
}

/* ---- Sticky / Floating CTA Button ---- */
.wishes__sticky-btn {
  position: absolute;
  bottom: 80px; /* Tăng từ 24px lên 80px để không đè lên chữ và đường chéo trên di động */
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-orange);
  color: var(--color-white);
  padding: 4px 4px 4px 28px;
  min-height: 48px;
  min-width: 310px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 18px rgba(235, 159, 52, 0.35);
  text-decoration: none;
  white-space: nowrap;
  z-index: 5;
  overflow: hidden; /* Đảm bảo tia sáng không bị tràn ra ngoài */
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  line-height: 1;
}

/* Lớp giả chứa luồng sáng quét qua */
.wishes__sticky-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50px;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  pointer-events: none;
  z-index: 1;
}

.wishes__sticky-btn-text {
  letter-spacing: 0.05em;
  margin-right: 16px;
  color: var(--color-white) !important;
}

.wishes__sticky-btn-arrow {
  width: 40px;
  height: 28px;
  background-color: var(--color-orange);
  border: 1.5px solid var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: skewX(-15deg);
  border-radius: 4px;
  transition: background-color 0.3s, border-color 0.3s, transform 0.3s;
}

.wishes__sticky-btn-arrow span {
  display: inline-block;
  transform: skewX(15deg);
  color: var(--color-white) !important;
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  transition: transform 0.3s;
}

.wishes__sticky-btn:hover {
  background-color: #f7ac3e;
  box-shadow: 0 8px 24px rgba(235, 159, 52, 0.5);
  transform: translateX(-50%) scale(1.05); /* Phóng to nhẹ khi hover */
}

.wishes__sticky-btn:hover::after {
  animation: btnShine 1.0s cubic-bezier(0.25, 1, 0.5, 1);
}

.wishes__sticky-btn:hover .wishes__sticky-btn-arrow {
  background-color: var(--color-white);
  border-color: var(--color-white);
  transform: skewX(-15deg) scale(1.05);
}

.wishes__sticky-btn:hover .wishes__sticky-btn-arrow span {
  color: var(--color-orange) !important;
  transform: skewX(15deg) translateX(2px);
}


@keyframes btnShine {
  0% { left: -150%; }
  100% { left: 200%; }
}

/* JS-controlled states for the sticky CTA (see animation.js).
   .is-pinned  = float fixed at the bottom-right of the viewport.
   .is-pin-hidden = fade out (before section enters / after it is scrolled past). */
/* Shared pinned/parked look (constant horizontal position -> no jump). */
.wishes__sticky-btn.is-pinned,
.wishes__sticky-btn.is-parked {
  right: 100px;
  transform: none;
  z-index: 60;
  max-width: calc(100vw - 48px);
}

/* Khi ngôn ngữ là tiếng Nhật: Thiết lập left: auto */
html[lang="ja"] .wishes__sticky-btn.is-pinned,
html[lang="ja"] .wishes__sticky-btn.is-parked {
  left: auto;
}

/* Following the viewport while scrolling through the section. */
.wishes__sticky-btn.is-pinned {
  position: fixed;
  bottom: 24px;
}

/* Parked near the end of the section: scrolls away naturally with the content.
   bottom must stay in sync with PARK_BOTTOM in animation.js (per breakpoint)
   so the follow -> park transition has no jump. */
.wishes__sticky-btn.is-parked {
  position: absolute;
  bottom: 60px;
}

@media (min-width: 1024px) {
  .wishes__sticky-btn.is-parked {
    bottom: 12%; /* clears the slanted pricing overlap on PC */
  }
}

.wishes__sticky-btn.is-pinned:hover,
.wishes__sticky-btn.is-parked:hover {
  transform: scale(1.05);
}

.wishes__sticky-btn.is-pin-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 1023px) {
  /* Căn giữa nút trên SP thay vì lệch phải như PC. */
  .wishes__sticky-btn.is-pinned,
  .wishes__sticky-btn.is-parked {
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
  }
  html[lang="ja"] .wishes__sticky-btn.is-pinned,
  html[lang="ja"] .wishes__sticky-btn.is-parked {
    left: 50%;
  }
  .wishes__sticky-btn.is-pinned {
    bottom: 16px;
  }
  .wishes__sticky-btn.is-pinned:hover,
  .wishes__sticky-btn.is-parked:hover {
    transform: translateX(-50%) scale(1.05);
  }

  /* Tiếng Anh: text dài -> nút mở full chiều rộng, cho text tự xuống dòng
     để không che mất icon mũi tên bên phải. */
  html[lang="en"] .wishes__sticky-btn {
    width: 100vw ;
    padding: 10px;
    min-width: 0;
    gap: 15px;
  }
  html[lang="en"] .wishes__sticky-btn-text {
    white-space: normal;
    margin-right: 5px;
    letter-spacing: -0.05em;
  }
  html[lang="en"] .wishes__sticky-btn-arrow {
    flex-shrink: 0;
    width: 25px;
    height: 25px;
  }
}

/* ============================================================
   PC ( >= 1024px )
   ============================================================ */
@media (min-width: 1024px) {
  .wishes {
    /* Slant scale theo vw NHƯNG có cap 115px (~8vw ở 1440):
       - 1024..1440: dùng 8vw như cũ.
       - >1440 (1920/2560...): khóa ở 115px -> màn càng rộng đường chéo càng thoải. */
    --wishes-slant-y: min(8vw, 90px); /* Vertical slant height */
    --wishes-slant-x: min(8vw, 90px); /* Horizontal slant offset */
    --wishes-gap: 0px;     /* Set to 0px so the panels fit tightly together */
    /* Các mốc phụ = bội số của slant gốc (giữ nguyên tỷ lệ hình học cũ) */
    --wsy-50: calc(var(--wishes-slant-y) * 0.5);  /* was 4vw    */
    --wsy-42: calc(var(--wishes-slant-y) * 0.42); /* was 3.36vw */
    --wsy-58: calc(var(--wishes-slant-y) * 0.58); /* was 4.64vw */
    --wsy-34: calc(var(--wishes-slant-y) * 0.34); /* was 2.72vw */
  }

  .wishes__panel {
    height: 100%;
  }

  .wishes__deco {
    height: 663px;
  }

  .wishes__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 hàng bằng nhau -> điểm giao 4 panel (tâm chong chóng) trùng tâm khối grid.
       Tổng chiều cao (934+934=1868) giữ nguyên như bản cũ (1100+768) nên không xô lệch layout dưới. */
    grid-template-rows: 934px 934px;
  }

  /* Reset grid child margins on PC */
  .wishes__grid > * {
    margin-top: 0;
  }

  /* Text Panels Padding */
  .wishes__panel--text {
    padding: 0 60px 0 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    white-space: normal;
  }

  /* Reset ordering */
  .wishes__panel--1 { order: unset; grid-row: 1; grid-column: 1; }
  .wishes__panel-wrapper--2 { order: unset; grid-row: 1; grid-column: 2; }
  .wishes__panel--3 { order: unset; grid-row: 2; grid-column: 1; }
  .wishes__panel--4 { order: unset; grid-row: 2; grid-column: 2; }

  /* Slanted cuts on PC - mathematically aligned, parallel lines, 0px gap */
  /* Left Column Panel 1 */
  .wishes__panel--1 {
    clip-path: polygon(0 var(--wishes-slant-y), 100% var(--wsy-50), calc(100% - var(--wishes-slant-x)) calc(100% - var(--wsy-42)), 0 100%);
    width: calc(100% + var(--wishes-slant-x));
    /* Chỉ thụt CHỮ về mép container; nền trắng vẫn tràn hết cột (full-bleed). */
    padding-left: max(100px, calc((100vw - var(--container-max)) / 2));
  }

  /* Left Column Panel 3 */
  .wishes__panel--3 {
    clip-path: polygon(0 var(--wishes-slant-y), 100% var(--wsy-58), calc(100% - var(--wishes-slant-x)) calc(100% - var(--wsy-34)), 0 100%);
    margin-top: calc(-1 * var(--wishes-slant-y) + var(--wishes-gap));
    min-height: 934px !important; /* Khớp chiều cao hàng dưới đã cân bằng */
  }

  /* Right Column Panel 2 Wrapper & Panel */
  .wishes__panel-wrapper--2 {
    position: relative;
    z-index: 4;
    height: 100%;
    width: 100%;
    margin-left: 0;
  }

  .wishes__panel--2 {
    clip-path: polygon(var(--wishes-slant-x) var(--wsy-50), 100% 0, 100% calc(100% - var(--wishes-slant-y)), 0 calc(100% - var(--wsy-42)));
    width: 100%;
    margin-left: 0;
    min-height: 332px !important; /* Match Row 1 height to prevent stretching */
  }

  /* Center the family in the visible area to prevent bad cropping */
  .wishes__panel--2 .wishes__img {
    object-position: center center;
  }

  /* Đẩy cặp đôi lên đầu khung ảnh: object-position: center top để đầu/mặt
     không bị đường chéo clip-path cắt ở góc trên-trái. */
  .wishes__panel--3 .wishes__img {
    object-position: center top;
  }

  /* Right Column Panel 4 */
  .wishes__panel--4 {
    background-color: var(--color-bg);
    clip-path: polygon(var(--wishes-slant-x) var(--wsy-58), 100% 0, 100% calc(100% - var(--wishes-slant-y)), 0 calc(100% - var(--wsy-34)));
    width: calc(100% + var(--wishes-slant-x));
    margin-left: calc(-1 * var(--wishes-slant-x));
    margin-top: calc(-1 * var(--wishes-slant-y) + var(--wishes-gap));
    /* Căn giữa dọc để hàng dưới cao hơn không tạo khoảng trắng thừa phía trên. */
    justify-content: center;
    /* Nền tràn full-bleed; chỉ thụt CHỮ ở mép phải về đúng mép container. */
    padding: 0 max(0px, calc((100vw - var(--container-max)) / 2)) 0 200px;
  }

  /* Tiếng Anh: bản dịch dài hơn -> nới khung chữ (1600 thay vì 1240) để cột chữ
     rộng hơn, bớt xuống dòng, tránh nội dung cao quá làm đường chéo cắt tiêu đề
     trên màn lớn (1920/2560...). Cột chữ giữ độ rộng ~ổn định ở mọi màn. */
  html[lang="en"] .wishes__panel--1 {
    padding-left: max(100px, calc((100vw - 1600px) / 2));
  }
  html[lang="en"] .wishes__panel--4 {
    padding-right: max(0px, calc((100vw - 1600px) / 2));
  }

  /* Tiếng Anh: nội dung dịch dài -> nén chiều cao (font 18, line-height 1.5, thu
     khoảng cách) để chữ vừa panel cao 934px ở MỌI màn PC (1024..2560), tránh
     đường chéo cắt tiêu đề. JA/KO/ZH không đổi. */
  html[lang="en"] .wishes__text p {
    font-size: 18px;
    line-height: 1.5;
  }
  html[lang="en"] .wishes__text p + p {
    margin-top: 14px;
  }
  html[lang="en"] .wishes__cards {
    margin-top: 40px;
    margin-bottom: 14px;
  }
  html[lang="en"] .wishes__title {
    margin-bottom: 10px;
  }
  html[lang="en"] .wishes__note {
    margin-top: 8px;
  }

  /* Image Panels Height & Aspect Ratio */
  .wishes__panel--media {
    height: 100%;
  }

  .wishes__title {
    font-size: 32px;
    margin-bottom: 20px;
  }

  .wishes__text p {
    font-size: 20px;
  }

  /* 3 Cards row on PC */
  .wishes__cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    max-width: 535px;
  }

  .wish-card {
    padding: 50px 9px 20px;
  }

  .wish-card:first-child {
    grid-column: auto;
    justify-self: auto;
    width: auto;
  }

  .wish-card__text,
  .wishes__note  {
    font-size: 20px;
  }

  /* CTA Button PC Position & Sticky behavior */
  .wishes__sticky-btn {
    bottom: 250px; /* Tăng từ 40px lên 250px để đặt nút lên phía trên đè lên bãi cát của ảnh gia đình */
    left: 50%;
    transform: translateX(-50%);
    min-height: 72px;
    min-width: 440px;
    font-size: 20px;
    padding: 6px 6px 6px 40px;
  }

  .wishes__sticky-btn-text {
    margin-right: 28px;
  }

  .wishes__sticky-btn-arrow {
    width: 52px;
    height: 36px;
  }

  .wishes__sticky-btn-arrow span {
    font-size: 18px;
  }

  .wishes__sticky-btn:hover {
    transform: translateX(-50%) scale(1.05); /* Giữ lại translateX(-50%) để nút không bị lệch vị trí khi hover */
  }



}

/* Tiếng Anh, màn >=1440: panel--1 rộng = 100% + slant nên chữ (đặc biệt dòng note
   dài) tràn vào vùng slant, chạm sát ảnh nghiêng bên phải. Tăng padding-right để
   chữ lùi vào trong ranh giới cột, cách ảnh 1 khoảng. (<1440 giữ nguyên vì cột hẹp
   hơn, thêm padding sẽ làm nội dung cao lên cắt tiêu đề.) */
@media (min-width: 1440px) {
  html[lang="en"] .wishes__panel--1 {
    padding-right: calc(var(--wishes-slant-x) + 60px);
  }
}
