/* Figma portfolio fan — Rectangle 780: radius TL/TR 120, gradient #10096c → #005AE1 */
.tkw-fan {
  position: relative;
  width: 100%;
  padding: 96px 0 48px;
  background: linear-gradient(180deg, #10096c 0%, #0a2f9d 55%, #005ae1 100%);
  color: #fff;
  overflow: hidden;
  border-radius: clamp(48px, 7vw, 120px) clamp(48px, 7vw, 120px) 0 0;
}

.tkw-fan__decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Figma 54012 — Glow cam (top) */
.tkw-fan__decor-glow--top {
  position: absolute;
  left: 50%;
  top: -8%;
  width: min(700px, 70vw);
  height: 490px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(254, 102, 37, 0.38) 0%, rgba(254, 102, 37, 0) 68%);
}

/* Figma 54013 — Glow xanh behind mockups */
.tkw-fan__decor-glow--blue {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(1200px, 90vw);
  height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(43, 127, 255, 0.28) 0%, rgba(43, 127, 255, 0) 70%);
}

/* Figma 54022 — Glow center under heading */
.tkw-fan__decor-glow--center {
  position: absolute;
  left: 50%;
  top: 28%;
  width: min(700px, 55vw);
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(254, 102, 37, 0.22) 0%, rgba(254, 102, 37, 0) 72%);
}

/* Rings — tắt theo yêu cầu */
.tkw-fan__decor-ring {
  display: none;
}

.tkw-fan__intro {
  position: relative;
  z-index: 2;
}

.tkw-fan__heading {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(48px, 6vw, 88px);
}

.tkw-fan__stat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 20px);
}

.tkw-fan__stat {
  margin: 0;
  display: flex;
  align-items: flex-start;
  line-height: 1;
  font-family: "SVN-Biennale", var(--font-sec, sans-serif);
  font-weight: 900; /* Black */
  letter-spacing: -0.05em; /* Figma tracking -10.5 @ 210 */
}

.tkw-fan__stat-num {
  font-size: clamp(88px, 12vw, 210px);
  font-weight: 900;
  letter-spacing: -0.05em;
  color: #fff;
}

.tkw-fan__stat-plus {
  font-size: clamp(88px, 12vw, 210px);
  font-weight: 900;
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, #ffb240 0%, #fe6625 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tkw-fan__title {
  margin: 0;
  text-align: left;
  font-family: "SVN-Biennale", var(--font-sec, sans-serif);
  font-size: clamp(28px, 3.2vw, 54px);
  font-weight: 900; /* Black */
  line-height: 1;
  letter-spacing: -0.01em; /* Figma -0.54 @ 54 */
  color: #fff;
  text-transform: uppercase;
}

.tkw-fan__kicker {
  margin: 0;
  font-family: "SVN-Biennale", var(--font-sec, sans-serif);
  font-size: clamp(14px, 1.4vw, 24px);
  font-weight: 600; /* SemiBold */
  letter-spacing: 0.22em; /* Figma 5.28 @ 24 */
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.tkw-fan__kicker span {
  color: #fe6625;
}

/* Cylinder dial — full-bleed giữa */
.tkw-fan__theater {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 24px;
}

.tkw-fan__dial {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.tkw-fan__stage {
  /* Classic coverflow — dàn ngang rộng (max 1920), gap do JS clamp */
  --fan-card-w: clamp(180px, 16vw, 300px);
  --fan-card-h: calc(var(--fan-card-w) * 1.88);
  /* Chiều cao khung ảnh = card − thanh chrome 32px (dùng để cuộn ảnh chỉ bằng transform) */
  --fan-shot-h: calc(var(--fan-card-h) - 32px);
  --fan-gap: calc(var(--fan-card-w) * 0.58);
  --fan-ease: cubic-bezier(0.33, 1, 0.68, 1);
  --fan-dur: 0.55s;
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  /* Chừa chỗ active scale 1.12 (origin top) + chrome không bị cắt */
  height: max(520px, calc(var(--fan-card-h) * 1.14 + 72px));
  perspective: 2200px;
  perspective-origin: 50% 42%;
  overflow: hidden;
  padding-top: 8px;
  cursor: grab;
  /* pan-y: cho scroll dọc trang; chỉ JS nhận vuốt ngang */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.tkw-fan__stage.is-dragging {
  cursor: grabbing;
}

.tkw-fan__stage.is-dragging .tkw-fan__browser {
  pointer-events: none;
}

/* Chỉ tắt transition lúc rubber nhẹ; lúc flip 1 item vẫn animate */
.tkw-fan__stage.is-dragging.is-rubber .tkw-fan__browser {
  transition-duration: 0s;
}

/* Card tái nhập mép kia khi loop — không animate đoạn “cắt nối” */
.tkw-fan__browser.is-teleport {
  transition: none !important;
}

.tkw-fan__cylinder {
  position: absolute;
  inset: 0;
  /* flat: z-index card giữa thắng side — không bị đè chrome */
  transform-style: flat;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tkw-fan__browser {
  --fan-x: 0px;
  --fan-y: 0px;
  --fan-theta: 0deg;
  --fan-scale: 1;
  --fan-opacity: 0.55;
  --fan-depth: 0px;
  --fan-z: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--fan-card-w);
  height: var(--fan-card-h);
  margin: calc(var(--fan-card-h) / -2) 0 0 calc(var(--fan-card-w) / -2);
  z-index: var(--fan-z);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #111a33;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.4);
  color: inherit;
  cursor: pointer;
  transform-style: flat;
  /* Origin mép trên — chrome address không bị scale cắt; Y bù ở JS */
  transform-origin: 50% 0;
  transform:
    translate3d(var(--fan-x), var(--fan-y, 0px), var(--fan-depth))
    rotateY(var(--fan-theta))
    scale(var(--fan-scale));
  transition:
    transform var(--fan-dur) var(--fan-ease),
    box-shadow 0.4s ease,
    border-color 0.35s ease;
  will-change: transform, opacity;
  -webkit-user-drag: none;
  appearance: none;
  -webkit-appearance: none;
}

/* Card bên: đặc, rõ nét — không phủ lớp mờ (card giữa nổi bật nhờ scale + bóng) */

.tkw-fan__browser.is-active,
.tkw-fan__browser.is-front {
  --fan-opacity: 1;
  --fan-depth: 120px;
  --fan-z: 200;
  z-index: 300 !important;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 28px 64px -10px rgba(0, 0, 0, 0.5),
    0 0 48px -8px rgba(0, 0, 0, 0.25);
  filter: none;
}

.tkw-fan__chrome {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 10px;
  background: #1a2340;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.tkw-fan__dots {
  width: 28px;
  height: 7px;
  flex-shrink: 0;
  pointer-events: none;
}

.tkw-fan__address {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  overflow: hidden;
  transition: border-color 0.35s ease;
}

.tkw-fan__address.is-active {
  border-color: rgba(255, 255, 255, 0.22);
}

.tkw-fan__caret {
  display: none;
}

.tkw-fan__address img {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}

.tkw-fan__address span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "SVN-Biennale", sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
}

.tkw-fan__address span b {
  font-family: "SVN-Biennale", sans-serif;
  font-weight: 500;
  color: #fff;
}

.tkw-fan__shot {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0a1020;
}

.tkw-fan__shot img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: cover;
  object-position: top center;
  max-width: none;
  display: block;
  /* Chỉ animate transform (GPU) — không animate top để tránh giật */
  transform: translate3d(0, 0, 0);
  transition: transform 0.7s ease-out;
  will-change: transform;
  backface-visibility: hidden;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* Không cuộn ảnh khi hover — chỉ card active tự cuộn (xem khối Autoplay) */

/* Thanh tiến độ cuộn — chạy cùng thời gian với ảnh khi hover */
.tkw-fan__progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tkw-fan__progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb240 0%, #fe6625 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.6s ease-in-out;
}

.tkw-fan__browser.is-active .tkw-fan__progress {
  opacity: 1;
}


/* Autoplay: card giữa tự cuộn ảnh, thanh tiến độ = thời gian tới mẫu kế */
.tkw-fan__stage {
  /* Thời gian mỗi mẫu ở giữa (tự cuộn ≈ --fan-play − 1.6s). Tăng số này để cuộn chậm hơn */
  --fan-play: 11s;
}

/*
 * Card giữa cuộn ảnh bằng transition (không dùng keyframes): khi đổi card,
 * card cũ trượt mượt về đầu trang thay vì nhảy giật về top.
 */
.tkw-fan__stage.is-autoplay .tkw-fan__browser.is-active .tkw-fan__shot img {
  transform: translate3d(0, calc(-100% + var(--fan-shot-h)), 0);
  transition: transform calc(var(--fan-play) - 1.6s) cubic-bezier(0.45, 0, 0.55, 1) 0.9s;
}

.tkw-fan__stage.is-autoplay .tkw-fan__browser.is-active .tkw-fan__progress i {
  animation: tkwFanProgress var(--fan-play) linear both;
}

.tkw-fan__stage.is-paused .tkw-fan__browser.is-active .tkw-fan__progress i {
  animation-play-state: paused;
}

@keyframes tkwFanProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Nhãn "Xem mẫu" khi rê vào card giữa */
.tkw-fan__view {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fd6624 0%, #e54600 100%);
  box-shadow: 0 10px 24px -6px rgba(254, 102, 37, 0.55);
  font-family: "SVN-Biennale", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.tkw-fan__view img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
}

.tkw-fan__browser.is-active:hover .tkw-fan__view,
.tkw-fan__browser.is-active:focus-visible .tkw-fan__view {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .tkw-fan__shot img,
  .tkw-fan__progress i {
    transition: none;
  }

  .tkw-fan__stage.is-autoplay .tkw-fan__browser.is-active .tkw-fan__progress i {
    animation: none;
  }
}


.tkw-fan__actions {
  position: relative;
  z-index: 2;
  /* Tách nút CTA khỏi dãy card */
  margin-top: clamp(32px, 4vw, 64px);
}

.tkw-fan__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 0 0 40px;
}

.tkw-fan__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-radius: 999px;
  font-family: "SVN-Biennale", sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: transform 0.2s ease;
}

.tkw-fan__btn:hover {
  transform: translateY(-1px);
}

.tkw-fan__btn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.tkw-fan__btn--primary {
  background: linear-gradient(90deg, #fd6624 0%, #e54600 100%);
  box-shadow: 0 12px 32px -6px rgba(254, 102, 37, 0.45);
}

.tkw-fan__btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* Tablet trở xuống: full màn, hiện đủ list — không gộp/ẩn ±2 ±3 */
@media (max-width: 1024px) {
  .tkw-fan__theater {
    overflow: visible;
  }

  .tkw-fan__stage {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    --fan-card-w: clamp(120px, 16vw, 168px);
    --fan-gap: calc(var(--fan-card-w) * 0.52);
    height: max(420px, calc(var(--fan-card-h) * 1.14 + 56px));
    perspective: 1400px;
    overflow: visible;
  }

  .tkw-fan__cylinder,
  .tkw-fan__browser {
    transform-style: flat;
  }

  .tkw-fan__browser.is-active,
  .tkw-fan__browser.is-front {
    z-index: 300 !important;
  }

  /* Hiện đủ mọi slot — không ẩn mép */
  .tkw-fan__browser[data-fan-slot-abs="2"],
  .tkw-fan__browser[data-fan-slot-abs="3"] {
    opacity: unset;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 767px) {
  .tkw-fan {
    padding: 48px 0 24px;
    border-radius: 40px 40px 0 0;
  }

  .tkw-fan__heading {
    gap: 12px;
    margin-bottom: 20px;
  }

  .tkw-fan__stat-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }

  .tkw-fan__stat-num,
  .tkw-fan__stat-plus {
    font-size: clamp(40px, 12vw, 56px);
  }

  .tkw-fan__title {
    text-align: left;
    font-size: clamp(18px, 4.8vw, 22px);
    line-height: 1.15;
    min-width: 0;
  }

  .tkw-fan__kicker {
    letter-spacing: 0.12em;
    white-space: normal;
    text-align: center;
  }

  .tkw-fan__theater {
    padding-bottom: 8px;
  }

  .tkw-fan__dial {
    margin-top: 0;
  }

  .tkw-fan__stage {
    --fan-card-w: clamp(96px, 28vw, 132px);
    --fan-gap: calc(var(--fan-card-w) * 0.55);
    height: max(300px, calc(var(--fan-card-h) * 1.08 + 24px));
    padding-top: 0;
    perspective: 1100px;
    perspective-origin: 50% 28%;
  }

  .tkw-fan__browser {
    /* Đẩy cụm card lên gần heading hơn (bớt trống phía trên dial) */
    top: 42%;
  }

  .tkw-fan__cta {
    flex-direction: column;
    align-items: center;
    padding: 16px 0 24px;
  }

  .tkw-fan__btn {
    width: min(100%, 320px);
    justify-content: center;
  }
}

