/* ══════════════════════════════════════════════════
   UIUX ZOOM INTRO
══════════════════════════════════════════════════ */

/* #s2 nối tiếp section content-seo màu đen */
#s2 {
  background: #000;
}

/* Wrapper: giảm từ 581vh → 350vh để scroll zoom nhanh hơn */
#uiux-sticky-wrap {
  position: relative;
  height: 350vh;
}

#uiux-sticky {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

#uiux-white {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 1;
}

#uiux-black {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 2;
  pointer-events: none;
}

#uiux-text-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

#uiux-heading {
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(48px, 8vw, 100px);
  font-weight: 900;
  color: #fff;
  letter-spacing: -2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  /* OPT: bỏ will-change cố định — JS bật/tắt động theo IntersectionObserver
     Tránh giữ GPU layer 24/7 dù section không visible → giảm VRAM */
  -webkit-font-smoothing: antialiased;
  backface-visibility: hidden;
  /* KHÔNG set transform ở đây — JS set sau khi đo xong */
}

.uiux-char {
  display: inline-block;
}

#uiux-content {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 13vw 10vh;
}

#uiux-content .uiux-ttl {
  font-family: "Courier Prime", monospace;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 200;
  color: #6b1a1a;
  letter-spacing: 0.12em;
  white-space: nowrap;
  line-height: 1.1;
  margin-bottom: 24px;
}

#uiux-content .uiux-body {
  font-family: "Courier Prime", monospace;
  font-size: clamp(13px, 1.1vw, 15px);
  color: #000;
  line-height: 1.7;
  max-width: 560px;
  white-space: normal;
}

/* ══════════════════════════════════════════════════ */

.section.s3 {
  display: block;
  padding: 50px 0 0 0;
  min-height: auto;
  overflow: visible;
}

/* Giữ indent cho các text đầu section — dùng margin để không ảnh hưởng max-width */
.section.s3 > .lbl,
.section.s3 > .ttl {
  margin-left: 13vw;
  margin-right: 13vw;
}

.section.s3 > .body {
  margin-left: 13.3vw;
  margin-right: 0;
  /* OPT: bỏ white-space:nowrap thừa — mâu thuẫn với text-align:justify, không có tác dụng */
  text-align: justify;
  text-align-last: justify;
  color: #000;
}

.section.s3 > .ttl {
  font-family: "Courier Prime", monospace;
  font-size: 64px;
  font-weight: 200;
  color: #6b1a1a;
  letter-spacing: 0.12em;
  white-space: nowrap;
  line-height: 1;
}

/* Vùng trước/sau section để test scroll tự nhiên */
.spacer {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a8878;
  border-bottom: 1px solid #c8b89a;
}

.hs-section {
  --hs-cream: #fff;
  --hs-ink: #1a1a18;
  --hs-mid: #8a8878;
  --hs-accent: #c8b89a;
  --hs-card-bg: #fff;
  --hs-radius: 28px;
  --hs-np: 6;
  overflow: hidden;
  position: relative;
  height: 100vh;
  width: 100%;
  background: #fff;
}

.hs-track {
  display: flex;
  width: max-content;
  height: 100vh;
  /* OPT: contain layout — giới hạn phạm vi repaint khi GSAP translate ngang */
  contain: layout;
}

.hs-panel {
  width: 90vw;
  height: 100vh;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 6vw;
  border-right: 1px solid rgba(26, 26, 24, 0.1);
}

.hs-fig {
  position: absolute;
  top: 2rem;
  left: 2.8rem;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hs-mid);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Courier Prime", monospace;
}

.hs-fig::before {
  content: "";
  display: block;
  width: 234px;
  /* height: 1px; */
  background: var(--hs-mid);
}

.hs-fig span {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--hs-mid);
  padding-left: 0.8rem;
  border-left: 1px solid var(--hs-accent);
}

.hs-card {
  width: 85%;
  height: 100%;
  background: var(--hs-card-bg);
  border-radius: var(--hs-radius);
  border: 1px solid rgba(26, 26, 24, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 2px 32px rgba(26, 26, 24, 0.06);
}

.hs-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder khi chưa có ảnh */
.hs-card img[src=""] {
  display: none;
}

.hs-card-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  opacity: 0.25;
}

.hs-card img[src=""] ~ .hs-card-placeholder {
  display: flex;
}

.hs-card img:not([src=""]) ~ .hs-card-placeholder {
  display: none;
}

.hs-placeholder-icon {
  width: 48px;
  height: 48px;
  border: 1.5px solid #1a1a18;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hs-placeholder-text {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a18;
  font-family: "Courier Prime", monospace;
}

.hs-caption {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hs-mid);
  white-space: nowrap;
  font-family: "Courier Prime", monospace;
}

.hs-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--hs-ink);
  width: 0%;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

.hs-dots {
  position: fixed;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.65rem;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.4s;
}

.hs-dots .hs-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--hs-mid);
  transition:
    background 0.3s,
    transform 0.3s;
  cursor: pointer;
}

.hs-dots .hs-dot.active {
  background: var(--hs-ink);
  transform: scale(1.6);
}

/* ── FIGMA EMBED BLOCK ── */
.ui-figma-block {
  padding: 80px 13vw 60px;
  background: var(--hs-cream, #fff);
}

.ui-figma-label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ui-figma-tag {
  font-family: "Courier Prime", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hs-mid, #8a8878);
  flex-shrink: 0;
}

.ui-figma-rule {
  flex: 1;
  height: 1px;
  background: rgba(26, 26, 24, 0.1);
  max-width: 60px;
}

.ui-figma-meta {
  font-family: "Courier Prime", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(138, 136, 120, 0.5);
}

.ui-figma-heading {
  font-family: "Courier Prime", monospace;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 400;
  color: var(--hs-ink, #1a1a18);
  letter-spacing: 0.02em;
  margin-bottom: 36px;
}

.ui-figma-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.07),
    0 24px 64px rgba(0, 0, 0, 0.05);
}

.ui-figma-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none !important;
  border-radius: 16px;
}

/* ── Figma Lazy Load placeholder ── */
.figma-lazy {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.figma-lazy-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(26, 26, 24, 0.04);
  border: 1px solid rgba(26, 26, 24, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition:
    background 0.3s,
    border-color 0.3s;
}

.figma-lazy-thumb:hover {
  background: rgba(26, 26, 24, 0.08);
  border-color: rgba(26, 26, 24, 0.22);
}

.figma-lazy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.figma-lazy-icon circle {
  transition: fill 0.3s;
}

.figma-lazy-thumb:hover .figma-lazy-icon circle {
  fill: rgba(26, 26, 24, 0.12);
}

.figma-lazy-text {
  font-family: "Courier Prime", monospace;
  color: var(--hs-ink, #1a1a18);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.figma-lazy-sub {
  font-family: "Courier Prime", monospace;
  color: var(--hs-mid, #8a8878);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.figma-lazy iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none !important;
  border-radius: 16px;
  display: block;
}

.ui-figma-block--alt {
  border-top: 1px solid rgba(26, 26, 24, 0.08);
  margin-top: 0;
  padding-top: 60px;
}

/* PHASE 2 */

.pf-section *,
.pf-section *::before,
.pf-section *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.pf-section {
  /* ↓↓ CHỈNH ĐỘ RỘNG: tăng số vw để hẹp hơn, giảm để rộng hơn ↓↓ */
  padding: 0 13vw 80px; /* trái/phải: 13vw — khớp indent chung của site */
  /* ↑↑ ————————————————————————————————————————————————— ↑↑ */
  padding-top: 80px; /* dùng padding thay margin để bg:#fff phủ khoảng cách, không lộ nền đen */
  background: #fff;
}

.pf-section .pf-design-label {
  display: block;
  font-family: "Courier Prime", monospace;
  font-size: 64px;
  font-weight: 200;
  color: #6b1a1a;
  letter-spacing: 0.12em;
  white-space: nowrap;
  line-height: 3;
  margin-bottom: 40px;
}

.pf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.pf-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pf-col:nth-child(1) {
  margin-top: 0px;
}
.pf-col:nth-child(2) {
  margin-top: 100px;
}
.pf-col:nth-child(3) {
  margin-top: 50px;
}

.pf-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  cursor: pointer;
  background: #111;
  width: 100%;
  aspect-ratio: 3 / 4;
  opacity: 0;
  /* OPT: bỏ will-change thường trực — tạo GPU layer cho tất cả cards cùng lúc → VRAM 5GB
     Chỉ bật khi hover để browser tạo layer đúng lúc cần */
  backface-visibility: hidden;
}

.pf-card:hover {
  will-change: transform;
}

.pf-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition:
    filter 0.5s ease,
    transform 0.55s ease;
  display: block;
}

.pf-col:nth-child(1) .pf-card:nth-child(2) img {
  object-position: 55% center;
}

.pf-col:nth-child(1) .pf-card:nth-child(3) img {
  object-position: 65% center;
}

.pf-card:hover img {
  filter: grayscale(0%);
  transform: scale(1.06);
}

/* ── Lightbox ── */
.pf-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(240, 237, 223, 0.08);
  /* OPT: giảm blur 22→12px — bớt ~40% GPU cost, mắt thường không phân biệt được */
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  cursor: pointer;
}
.pf-lightbox.pf-open {
  display: flex;
  animation: pf-fi 0.22s ease;
}
@keyframes pf-fi {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pf-lb-inner {
  width: 900px;
  height: 600px;
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 18px;
  overflow: hidden;
  cursor: default;
  animation: pf-si 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}
@keyframes pf-si {
  from {
    transform: scale(0.88);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.pf-lb-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ══════════════════════════════════════════════════
   MOBILE — section UIUX (≤768px)
   Tắt animation nặng, hiện content trực tiếp
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── ZOOM INTRO: tắt hoàn toàn, rút height về 0 ── */
  #uiux-sticky-wrap {
    height: auto;
  }

  #uiux-sticky {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Ẩn black overlay và heading zoom */
  #uiux-black,
  #uiux-text-layer {
    display: none;
  }

  /* Hiện thẳng white background */
  #uiux-white {
    display: none;
  }

  /* Hiện content trực tiếp, không cần opacity:0 từ JS */
  #uiux-content {
    position: relative;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding: 60px 6vw 40px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
  }

  #uiux-content .uiux-ttl {
    font-size: clamp(28px, 8vw, 48px);
    white-space: normal;
    margin-bottom: 16px;
  }

  #uiux-content .uiux-body {
    font-size: 14px;
    max-width: 100%;
  }

  /* ── s3 section text ── */
  .section.s3 > .lbl,
  .section.s3 > .ttl {
    margin-left: 6vw;
    margin-right: 6vw;
  }

  .section.s3 > .body {
    margin-left: 6vw;
    text-align: left;
    text-align-last: left;
  }

  .section.s3 > .ttl {
    font-size: clamp(28px, 8vw, 48px);
    white-space: normal;
  }

  /* ── Horizontal scroll gallery: CSS snap thay GSAP pin ── */
  .hs-section {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 80vw;
    max-height: 480px;
  }

  .hs-section::-webkit-scrollbar {
    display: none;
  }

  .hs-track {
    height: 100%;
  }

  .hs-panel {
    width: 85vw;
    height: 100%;
    padding: 3vw;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .hs-card {
    width: 100%;
    height: 100%;
    border-radius: 16px;
  }

  /* Ẩn progress bar và dots — dùng scroll tay */
  .hs-progress,
  .hs-dots {
    display: none;
  }

  /* ── Figma embed ── */
  .ui-figma-block {
    padding: 40px 6vw 30px;
  }

  .ui-figma-heading {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
  }

  /* ── pf-section: portfolio grid ── */
  .pf-section {
    padding: 40px 6vw 60px;
  }

  .pf-section .pf-design-label {
    font-size: clamp(28px, 8vw, 48px);
    white-space: normal;
    line-height: 1.4;
    margin-bottom: 24px;
  }

  .pf-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .pf-col:nth-child(2) {
    margin-top: 40px;
  }

  .pf-col:nth-child(3) {
    display: none;
  }
}

@media (max-width: 420px) {
  .pf-grid {
    grid-template-columns: 1fr;
  }
  .pf-col:nth-child(n) {
    margin-top: 0;
  }
  .pf-col:nth-child(3) {
    display: flex;
  }
  .hs-panel {
    width: 90vw;
  }
}
