/* Landing page 3D trang chủ (landing-3d.js cập nhật các biến --p, --sp, --rx, --ry, --gx, --gy, --l3d-mx, --l3d-my) */
.l3d {
  --l3d-bg: #05080f;
  --l3d-panel: #0b1120;
  --l3d-ink: #e9edf5;
  --l3d-muted: rgba(233, 237, 245, .64);
  --l3d-line: rgba(255, 255, 255, .1);
  --l3d-gold: #ffb347;
  --l3d-accent: linear-gradient(246deg, #ffa800, #f05a22);
  --l3d-mx: 0;
  --l3d-my: 0;
  background: var(--l3d-bg);
  color: var(--l3d-ink);
  overflow: clip
}

body:has(.l3d) {
  background: var(--l3d-bg, #05080f)
}

body:has(.l3d) .site-header.is-scrolled {
  background: rgba(5, 8, 15, .82);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06)
}

body:has(.l3d) .site-header.is-scrolled .account-link {
  border-color: rgba(255, 255, 255, .3)
}

.l3d h2,
.l3d h3 {
  color: #fff
}

/* ---------- Hero: cảnh nhiều lớp, cuộn để bay vào ---------- */
.l3d-hero {
  --p: 0;
  position: relative;
  height: 230vh
}

.l3d-hero-view {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 45%
}

.l3d-scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform:
    translateZ(calc(var(--p) * 1000px))
    rotateX(calc(var(--l3d-my) * -2.5deg))
    rotateY(calc(var(--l3d-mx) * 3.5deg));
  will-change: transform
}

.l3d-layer {
  position: absolute;
  inset: 0;
  /* Bù phối cảnh để lớp ở xa vẫn phủ kín màn hình */
  transform: translateZ(calc(var(--z) * 1px)) scale(calc((1200 - var(--z)) / 1200 * 1.14));
  pointer-events: none
}

.l3d-layer-sky {
  background: url('../../images/jxmobile.jpg') 72% center/cover
}

.l3d-layer-shade {
  background:
    linear-gradient(90deg, rgba(5, 8, 15, .92) 0%, rgba(5, 8, 15, .62) 38%, rgba(5, 8, 15, .08) 70%),
    linear-gradient(transparent 60%, rgba(5, 8, 15, .85))
}

.l3d-layer-fog {
  overflow: hidden;
  opacity: .55
}

.l3d-layer-fog:before,
.l3d-layer-fog:after {
  content: "";
  position: absolute;
  inset: 40% -40% -10%;
  background:
    radial-gradient(ellipse 30% 35% at 20% 60%, rgba(200, 215, 240, .28), transparent 70%),
    radial-gradient(ellipse 35% 30% at 65% 70%, rgba(200, 215, 240, .22), transparent 70%),
    radial-gradient(ellipse 25% 30% at 90% 55%, rgba(255, 190, 130, .18), transparent 70%);
  filter: blur(12px);
  animation: l3d-fog 38s linear infinite
}

.l3d-layer-fog:after {
  inset: 55% -40% -20%;
  animation-duration: 52s;
  animation-direction: reverse;
  opacity: .7
}

.l3d-layer-fog-near {
  opacity: .4
}

@keyframes l3d-fog {
  from { transform: translateX(-12%) }
  50% { transform: translateX(12%) }
  to { transform: translateX(-12%) }
}

.l3d-hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  transform-style: preserve-3d
}

.l3d-hero-content .shell {
  transform-style: preserve-3d;
  padding-top: 40px
}

.l3d-depth {
  transform: translateZ(calc(var(--depth, 0) * 1px));
  opacity: calc(1 - var(--p) * 2.4)
}

.l3d-hero.is-deep .l3d-hero-content {
  visibility: hidden
}

.l3d-title {
  margin: 0;
  max-width: 860px;
  transform-style: preserve-3d;
  font-size: clamp(46px, 6.4vw, 92px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.045em;
  color: #fff
}

.l3d-title span {
  display: block;
  text-shadow: 0 18px 50px rgba(0, 0, 0, .55)
}

.l3d-title em {
  font-style: normal;
  background: var(--l3d-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent
}

.l3d-hero-copy {
  max-width: 560px;
  margin: 26px 0 34px;
  color: rgba(255, 255, 255, .8);
  font-size: 16px;
  line-height: 1.8
}

.l3d-metrics {
  display: flex;
  margin-top: 52px
}

.l3d-metrics div {
  min-width: 150px;
  padding: 4px 24px;
  border-left: 1px solid rgba(255, 255, 255, .25)
}

.l3d-metrics div:first-child {
  padding-left: 0;
  border-left: 0
}

.l3d-metrics strong {
  display: block;
  font-size: 34px;
  font-weight: 800;
  line-height: 1
}

.l3d-metrics span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, .6);
  font-size: 11px;
  line-height: 1.5
}

.l3d-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none
}

.l3d-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 30px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 12px;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .6);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: calc(1 - var(--p) * 5);
  pointer-events: none
}

.l3d-scroll-cue span {
  width: 22px;
  height: 36px;
  border: 1.5px solid rgba(255, 255, 255, .45);
  border-radius: 12px;
  position: relative
}

.l3d-scroll-cue span:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #ffa800;
  animation: l3d-cue 1.6s ease-in-out infinite
}

@keyframes l3d-cue {
  60% { transform: translateY(12px); opacity: 0 }
  100% { transform: translateY(0); opacity: 0 }
}

/* Cuối hero: tối dần để nối liền với phần sau */
.l3d-hero-view:after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--l3d-bg);
  opacity: calc((var(--p) - .55) * 2.4);
  pointer-events: none
}

/* ---------- Khung chung các section ---------- */
.l3d-section {
  position: relative;
  padding: 130px 0
}

.l3d-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  margin-bottom: 60px
}

.l3d-head h2,
.l3d-story-copy h2,
.l3d-portal h2 {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.035em
}

.l3d-head h2 span {
  color: rgba(233, 237, 245, .45)
}

.l3d-head p {
  max-width: 420px;
  margin: 0;
  color: var(--l3d-muted);
  line-height: 1.8
}

/* Hiện dần theo chiều sâu khi cuộn tới */
[data-reveal] {
  opacity: 0;
  transform: perspective(1200px) translate3d(0, 70px, -140px) rotateX(24deg);
  transform-origin: 50% 100%;
  transition: opacity .9s ease, transform 1.1s cubic-bezier(.16, .84, .24, 1);
  transition-delay: calc(var(--d, 0) * 120ms)
}

[data-reveal="flip"] {
  transform: perspective(1200px) translate3d(0, 40px, -200px) rotateY(-55deg);
  transform-origin: 0 50%
}

[data-reveal].is-in {
  opacity: 1;
  transform: none
}

/* Thẻ nghiêng theo chuột */
[data-tilt] {
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 50%;
  perspective: 1400px
}

[data-tilt] > div {
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .6s cubic-bezier(.2, .8, .2, 1)
}

[data-tilt].is-tilting > div {
  transition: transform .08s linear
}

/* ---------- Sản phẩm nổi bật ---------- */
.l3d-spot {
  background:
    radial-gradient(ellipse 60% 50% at 70% 40%, rgba(240, 90, 34, .1), transparent 70%),
    var(--l3d-bg)
}

.l3d-card-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  min-height: 540px;
  border: 1px solid var(--l3d-line);
  border-radius: var(--xt-radius-frame);
  background: var(--l3d-panel);
  box-shadow: 0 50px 120px rgba(0, 0, 0, .55)
}

.l3d-card-art {
  position: relative;
  overflow: hidden;
  transform: translateZ(10px)
}

.l3d-card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08) translate(calc(var(--px, 0) * -28px), calc(var(--py, 0) * -28px));
  transition: transform .6s cubic-bezier(.2, .8, .2, 1)
}

.l3d-card-art:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 55%, var(--l3d-panel))
}

.l3d-card-index {
  position: absolute;
  top: 28px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateZ(110px);
  text-shadow: 0 10px 30px rgba(0, 0, 0, .6)
}

.l3d-card-index b {
  font-family: 'Saira', 'Be Vietnam Pro', sans-serif !important;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .85)
}

.l3d-card-index small {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase
}

.l3d-card-panel {
  position: relative;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transform: translateZ(70px)
}

.l3d-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--l3d-gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase
}

.l3d-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffa800;
  box-shadow: 0 0 0 0 rgba(255, 168, 0, .6);
  animation: l3d-pulse 1.8s infinite
}

@keyframes l3d-pulse {
  70% { box-shadow: 0 0 0 10px rgba(255, 168, 0, 0) }
  100% { box-shadow: 0 0 0 0 rgba(255, 168, 0, 0) }
}

.l3d-meta {
  display: flex;
  gap: 8px;
  margin-top: 18px
}

.l3d-meta > span,
.l3d-platforms > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--l3d-line);
  border-radius: var(--xt-radius-pill);
  background: rgba(255, 255, 255, .04);
  color: var(--l3d-muted);
  font-size: 11px;
  font-weight: 700
}

.l3d-card-panel h3 {
  margin: 22px 0 14px;
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.03em
}

.l3d-card-panel p {
  margin: 0 0 22px;
  color: var(--l3d-muted);
  line-height: 1.8
}

.l3d-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px
}

.l3d-platforms .svg {
  width: 14px;
  height: 14px
}

.l3d-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .16), transparent 42%);
  opacity: 0;
  transform: translateZ(120px);
  transition: opacity .4s;
  pointer-events: none
}

.is-tilting .l3d-glare {
  opacity: 1
}

.l3d-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px
}

.l3d-feature-inner {
  height: 100%;
  padding: 26px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--l3d-line);
  border-radius: var(--xt-radius-frame);
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015))
}

.l3d-feature-inner .svg {
  width: 30px;
  height: 30px;
  color: #ffa800;
  transform: translateZ(40px)
}

.l3d-feature-inner b {
  font-size: 14px;
  transform: translateZ(24px)
}

.l3d-feature:hover .l3d-feature-inner {
  border-color: rgba(255, 168, 0, .45)
}

/* ---------- Giá trị ---------- */
.l3d-values {
  background:
    radial-gradient(ellipse 45% 40% at 15% 30%, rgba(80, 120, 220, .12), transparent 70%),
    radial-gradient(ellipse 40% 45% at 85% 75%, rgba(240, 90, 34, .1), transparent 70%),
    var(--l3d-bg)
}

.l3d-value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px
}

.l3d-value-inner {
  position: relative;
  height: 100%;
  min-height: 320px;
  padding: 34px 30px;
  border: 1px solid var(--l3d-line);
  border-radius: var(--xt-radius-frame);
  background: linear-gradient(165deg, rgba(20, 28, 48, .92), rgba(8, 12, 22, .92));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45)
}

.l3d-value-num {
  position: absolute;
  top: 18px;
  right: 24px;
  font-family: 'Saira', 'Be Vietnam Pro', sans-serif !important;
  font-size: 92px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 168, 0, .45);
  transform: translateZ(70px)
}

.l3d-value-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: var(--xt-radius-control);
  background: var(--l3d-accent);
  box-shadow: 0 16px 40px rgba(240, 90, 34, .35);
  transform: translateZ(55px)
}

.l3d-value-icon .svg {
  width: 26px;
  height: 26px;
  color: #fff
}

.l3d-value h3 {
  margin: 78px 0 12px;
  font-size: 22px;
  font-weight: 700;
  transform: translateZ(35px)
}

.l3d-value p {
  margin: 0;
  color: var(--l3d-muted);
  line-height: 1.75;
  transform: translateZ(20px)
}

/* ---------- Câu chuyện ---------- */
.l3d-story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 80px
}

.l3d-frame {
  --sp: 0;
  perspective: 1300px
}

.l3d-frame-inner {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--sp) * -22deg + var(--l3d-mx) * 6deg)) rotateX(calc(var(--sp) * 8deg - var(--l3d-my) * 4deg))
}

.l3d-frame img {
  display: block;
  width: 100%;
  height: 560px;
  object-fit: cover;
  border-radius: var(--xt-radius-frame);
  box-shadow: 0 50px 100px rgba(0, 0, 0, .6)
}

.l3d-frame-back {
  position: absolute;
  inset: 28px -28px -28px 28px;
  border: 2px solid #f05a22;
  border-radius: var(--xt-radius-frame);
  transform: translateZ(-80px)
}

.l3d-frame-tag {
  position: absolute;
  left: -28px;
  bottom: 48px;
  padding: 18px 22px;
  background: var(--l3d-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .04em;
  text-transform: uppercase;
  box-shadow: 0 24px 50px rgba(240, 90, 34, .35);
  transform: translateZ(90px)
}

.l3d-story-copy p {
  color: var(--l3d-muted);
  line-height: 1.8
}

.l3d-story-copy h2 {
  margin-bottom: 18px
}

.l3d-points {
  display: grid;
  gap: 16px;
  margin-top: 34px
}

.l3d-point {
  display: flex;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--l3d-line);
  border-radius: var(--xt-radius-frame);
  background: rgba(255, 255, 255, .03)
}

.l3d-point b {
  color: #ffa800;
  font-size: 13px;
  font-weight: 800
}

.l3d-point h3 {
  margin: 0 0 6px;
  font-size: 17px
}

.l3d-point p {
  margin: 0;
  font-size: 14px
}

/* ---------- Cổng không gian cuối trang ---------- */
.l3d-portal {
  position: relative;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(var(--l3d-bg), rgba(5, 8, 15, .35) 35%, rgba(5, 8, 15, .5) 75%, var(--l3d-bg)),
    url('../../images/publisher-orbit-bg.webp') center/cover;
  perspective: 900px
}

.l3d-portal-rings {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(calc(70deg + var(--l3d-my) * 8deg)) rotateY(calc(var(--l3d-mx) * 10deg))
}

.l3d-portal-rings span {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 168, 0, .55);
  box-shadow: 0 0 30px rgba(240, 90, 34, .35), inset 0 0 30px rgba(240, 90, 34, .2);
  animation: l3d-spin 24s linear infinite
}

.l3d-portal-rings span:nth-child(1) { width: 300px; height: 300px; margin: -150px; border-style: dashed }
.l3d-portal-rings span:nth-child(2) { width: 520px; height: 520px; margin: -260px; animation-duration: 40s; animation-direction: reverse; border-color: rgba(120, 170, 255, .45) }
.l3d-portal-rings span:nth-child(3) { width: 760px; height: 760px; margin: -380px; animation-duration: 60s; border-style: dotted }
.l3d-portal-rings span:nth-child(4) { width: 1040px; height: 1040px; margin: -520px; animation-duration: 90s; animation-direction: reverse; opacity: .5 }

@keyframes l3d-spin {
  to { transform: rotate(360deg) }
}

.l3d-portal-content {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px
}

.l3d-portal-content .eyebrow:after {
  content: "";
  width: 36px;
  height: 2px;
  background: currentColor
}

.l3d-portal h2 {
  margin-bottom: 30px;
  text-shadow: 0 20px 60px rgba(0, 0, 0, .7)
}

/* ---------- Màn hình thấp (laptop) ---------- */
@media (max-height: 860px) and (min-width: 641px) {
  .l3d-title {
    font-size: clamp(42px, min(6.4vw, 8.4vh), 92px)
  }

  .l3d-hero-copy {
    margin: 18px 0 24px
  }

  .l3d-metrics {
    margin-top: 28px
  }
}

@media (max-height: 700px) {
  .l3d-scroll-cue {
    display: none
  }
}

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 980px) {
  .l3d-hero {
    height: 200vh
  }

  .l3d-head {
    flex-direction: column;
    align-items: start
  }

  .l3d-card-inner {
    grid-template-columns: 1fr
  }

  .l3d-card-art {
    min-height: 320px
  }

  .l3d-card-art:after {
    background: linear-gradient(transparent 55%, var(--l3d-panel))
  }

  .l3d-features {
    grid-template-columns: 1fr 1fr
  }

  .l3d-value-grid {
    grid-template-columns: 1fr
  }

  .l3d-value-inner {
    min-height: 0
  }

  .l3d-story-grid {
    grid-template-columns: 1fr;
    gap: 60px
  }

  .l3d-frame img {
    height: 420px
  }
}

@media (max-width: 640px) {
  .l3d-section {
    padding: 84px 0
  }

  .l3d-title {
    font-size: clamp(32px, 10.5vw, 42px)
  }

  /* Màn hẹp: bỏ độ nổi của chữ để không bị phóng to tràn mép */
  .l3d-depth {
    transform: none
  }

  .l3d-hero-copy {
    font-size: 14px
  }

  .l3d-metrics {
    margin-top: 36px
  }

  .l3d-card-panel {
    padding: 30px 24px
  }

  .l3d-card-index b {
    font-size: 48px
  }

  .l3d-feature-inner {
    padding: 20px 16px
  }

  .l3d-frame-tag {
    left: 12px
  }

  .l3d-frame-back {
    inset: 16px -12px -16px 16px
  }

  .l3d-portal {
    min-height: 520px
  }
}

@media (prefers-reduced-motion: reduce) {
  .l3d-hero {
    height: auto
  }

  .l3d-hero-view {
    position: relative
  }

  .l3d-layer-fog:before,
  .l3d-layer-fog:after,
  .l3d-portal-rings span,
  .l3d-status span,
  .l3d-scroll-cue span:after {
    animation: none
  }

  [data-reveal],
  [data-reveal="flip"] {
    opacity: 1;
    transform: none;
    transition: none
  }
}
