/* ===============================================================
   work-immersive.css
   Full-screen 3D parallax immersive layout for work detail pages
================================================================ */

/* ── Global resets (previously provided by work-detail.css) ── */
*,
::after,
::before {
  box-sizing: border-box;
}

body,
ul, ol,
p,
h1, h2, h3, h4, h5, h6 {
  padding: 0;
  margin: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC',
               'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: var(--color-black, #111111);
  font-weight: 300;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* ── Body override for immersive mode ── */
body.wi-body {
  overflow-x: hidden;
  background: var(--color0, #DEDEDE);
}

/* ── Scene root ── */
.wi-scene {
  position: relative;
  /* total scroll height = number of sections × 100vh, set by JS */
}

/* ════════════════════════════════════════════════════
   BACKGROUND — Three.js WebGL canvas
═══════════════════════════════════════════════════════ */
.wi-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════
   FOREGROUND LAYER — scrollable, sits above bg
═══════════════════════════════════════════════════════ */
.wi-fg {
  position: relative;
  z-index: 1;
  /* height controlled by wi-scene total, set via JS */
}

/* Each section panel */
.wi-sec {
  height: 160vh;   /* extra height = longer hold at the image "sweet spot" */
  display: flex;
  align-items: flex-end;
  position: relative;
}

/* Intro section stays one viewport tall */
.wi-sec--intro {
  height: 100vh;
}

/* Section content wrapper */
.wi-sec-content {
  width: 100%;
  padding: 0 60px 64px;
  max-width: 900px;
  will-change: opacity, transform;
}

/* Intro card: push inside the frame edges */
.wi-sec--intro .wi-sec-content {
  padding: 0 88px 88px;   /* 64px frame + 24px inner gap on all sides */
}

/* Non-intro sections: positioned so the caption is in the viewport lower-third
   exactly when the 3D image hits its sweet spot (scrub=0.30).
   Math: at sweet spot, section top is 22vh from viewport top;
   caption at top:60vh → viewport position = 22+60 = 82vh (lower third). */
.wi-sec:not(.wi-sec--intro) .wi-sec-content {
  position: absolute;
  top: 60vh;
  padding: 0 88px;
  pointer-events: none;
}

/* ── Intro section ─────────────────────────────────── */

.wi-intro-glass {
  background: rgba(15, 15, 15, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  padding: 32px 36px 28px;
  max-width: 580px;
}

.wi-project-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color1, #1E5EFF);
  margin-bottom: 10px;
}

.wi-project-title {
  font-size: clamp(26px, 3.8vw, 46px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.08;
  margin: 0 0 6px;
  letter-spacing: -0.025em;
}

.wi-project-sub {
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.60);
  line-height: 1.55;
  margin-bottom: 24px;
}

.wi-project-sub p { margin: 0; }

/* Meta blocks — horizontal strip */
.wi-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-bottom: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.wi-meta-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.wi-meta-label img {
  width: 13px;
  height: 13px;
  display: block;
  flex-shrink: 0;
}

.wi-meta-label span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--color1, #1E5EFF);
}

.wi-meta-val {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

.wi-meta-val p { margin: 0; }

/* Description text */
.wi-desc {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.wi-desc p {
  font-size: 10.5px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.75;
  margin: 0;
}

.wi-desc p + p { margin-top: 5px; }

/* Last section: keep caption fixed so it doesn't drift up —
   just a subtle float-in rather than a full scroll-through.
   #wiSec6 = last for 7-section pages (e.g. AlphaESS)
   #wiSec7 = last for 8-section pages (e.g. Art Museum) */
#wiSec6 .wi-sec-content,
#wiSec7 .wi-sec-content {
  position: fixed;
  bottom: 140px;
  top: auto;
  left: 0;
}

@media (max-width: 1024px) {
  #wiSec6 .wi-sec-content,
  #wiSec7 .wi-sec-content { bottom: 120px; }
}
@media (max-width: 768px) {
  #wiSec6 .wi-sec-content,
  #wiSec7 .wi-sec-content { bottom: 100px; }
}
@media (max-width: 480px) {
  #wiSec6 .wi-sec-content,
  #wiSec7 .wi-sec-content { bottom: 88px; }
}

/* ── Caption sections ──────────────────────────────── */
.wi-caption-wrap {
  position: relative;
  padding-bottom: 4px;
}

/* Large decorative section number */
.wi-sec-num {
  font-size: clamp(88px, 13vw, 170px);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.055);
  line-height: 1;
  letter-spacing: -0.04em;
  user-select: none;
  pointer-events: none;
  display: block;
  margin-bottom: -14px;   /* pulled tight above accent line */
  font-variant-numeric: tabular-nums;
}

/* Accent bar */
.wi-sec-accent {
  width: 40px;
  height: 2px;
  background: var(--color1, #1E5EFF);
  margin-bottom: 14px;
  border-radius: 1px;
}

/* Main caption */
.wi-cap-main {
  font-size: clamp(22px, 3.2vw, 44px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.08;
  margin: 0 0 7px;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

/* Sub caption */
.wi-cap-sub {
  font-size: clamp(12px, 1.4vw, 17px);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.52);
  margin: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

/* ════════════════════════════════════════════════════
   PROGRESS NAVIGATION — fixed right
═══════════════════════════════════════════════════════ */
.wi-progress {
  position: fixed;
  right: 80px;   /* 64px frame + 16px inner padding */
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wi-dot-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 6px 16px;  /* 16px L/R gives a 37px-wide hit zone around the 5px dot */
}

.wi-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: all 0.35s ease;
  flex-shrink: 0;
}

.wi-dot-item.is-active .wi-dot {
  width: 8px;
  height: 8px;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.wi-dot-item.is-reached .wi-dot {
  background: rgba(255, 255, 255, 0.55);
}

/* ── Light-background variant (toggled by JS canvas sampling) ── */
.wi-progress.is-light-bg .wi-dot {
  background: rgba(0, 0, 0, 0.22);
}
.wi-progress.is-light-bg .wi-dot-item.is-active .wi-dot {
  background: #111111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}
.wi-progress.is-light-bg .wi-dot-item.is-reached .wi-dot {
  background: rgba(0, 0, 0, 0.50);
}

/* Floating label on active / hover */
.wi-dot-label {
  position: absolute;
  right: 36px;  /* 16px padding + 20px gap from dot */
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  pointer-events: none;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wi-dot-label-en,
.wi-dot-label-zh {
  font-size: 9px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
  display: block;
}

.wi-dot-item.is-active .wi-dot-label,
.wi-dot-item:hover .wi-dot-label {
  opacity: 1;
}

.wi-dot-item.is-active .wi-dot-label-en,
.wi-dot-item.is-active .wi-dot-label-zh {
  color: #ffffff;
}

.wi-progress.is-light-bg .wi-dot-label-en,
.wi-progress.is-light-bg .wi-dot-label-zh              { color: rgba(0, 0, 0, 0.50); }
.wi-progress.is-light-bg .wi-dot-item.is-active .wi-dot-label-en,
.wi-progress.is-light-bg .wi-dot-item.is-active .wi-dot-label-zh { color: #111111; }

/* Thin connector line between dots */
.wi-dot-connector {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.wi-dot-connector.is-reached {
  background: rgba(255, 255, 255, 0.38);
}

.wi-progress.is-light-bg .wi-dot-connector          { background: rgba(0, 0, 0, 0.14); }
.wi-progress.is-light-bg .wi-dot-connector.is-reached { background: rgba(0, 0, 0, 0.35); }

/* ════════════════════════════════════════════════════
   COUNTER — bottom-left
═══════════════════════════════════════════════════════ */
.wi-counter {
  position: fixed;
  left: 84px;    /* 64px frame + 20px inner padding */
  bottom: 84px;  /* 64px frame + 20px inner padding */
  z-index: 9999;
  display: flex;
  align-items: baseline;
  gap: 4px;
  pointer-events: none;
}

.wi-cnt-cur {
  font-size: 26px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  transition: opacity 0.3s ease, color 0.4s ease;
}

.wi-cnt-sep {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  margin: 0 2px;
  transition: color 0.4s ease;
}

.wi-cnt-tot {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease;
}

.wi-counter.is-light-bg .wi-cnt-cur                  { color: #111111; }
.wi-counter.is-light-bg .wi-cnt-sep,
.wi-counter.is-light-bg .wi-cnt-tot                  { color: rgba(0, 0, 0, 0.38); }

/* ════════════════════════════════════════════════════
   SCROLL HINT — bottom-center
═══════════════════════════════════════════════════════ */
.wi-scroll-hint {
  position: fixed;
  bottom: 84px;  /* 64px frame + 20px inner padding */
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.wi-scroll-hint.is-hidden {
  opacity: 0;
}

.wi-scroll-hint-text {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  transition: color 0.4s ease;
}

.wi-scroll-line {
  width: 1px;
  height: 38px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.65) 0%, transparent 100%);
  animation: wiScrollPulse 1.8s ease-in-out infinite;
  transform-origin: top;
  transition: background 0.4s ease;
}

.wi-scroll-hint.is-light-bg .wi-scroll-hint-text { color: rgba(0, 0, 0, 0.50); }
.wi-scroll-hint.is-light-bg .wi-scroll-line {
  background: linear-gradient(to bottom, rgba(0,0,0,0.50) 0%, transparent 100%);
}

/* ── Back-to-top button (lives inside .wi-next-works panel) ── */
.wi-back-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  cursor: url("../assets/cursor/cursor-pointer.svg") 6 2, pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}
.wi-back-top:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}
.wi-back-top svg {
  width: 13px;
  height: 13px;
  stroke: rgba(255, 255, 255, 0.75);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes wiScrollPulse {
  0%   { transform: scaleY(0); opacity: 1; }
  55%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .wi-sec:not(.wi-sec--intro) .wi-sec-content {
    top: 58vh;
  }
}

@media (max-width: 768px) {
  /* ── Section content ── */
  .wi-sec-content {
    padding: 0 24px 80px;
    max-width: 100%;
  }

  .wi-sec:not(.wi-sec--intro) .wi-sec-content {
    top: 55vh;
    padding: 0 48px;  /* 28px frame + 20px inner gap */
  }

  /* ── Intro glass card ── */
  .wi-sec--intro .wi-sec-content {
    padding: 0 48px 56px;
  }

  .wi-intro-glass {
    max-width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 22px 20px 18px;
  }

  .wi-meta-row {
    gap: 12px 20px;
  }

  /* ── Fixed UI elements ── */
  .wi-counter {
    left: 44px;    /* 28px frame + 16px */
    bottom: 56px;  /* 40px frame + 16px */
  }

  .wi-cnt-cur { font-size: 20px; }

  .wi-progress {
    right: 42px;   /* 28px frame + 14px */
  }

  .wi-dot-label { display: none; }

  .wi-back-top {
    right: 46px;   /* 28px frame + 18px */
    bottom: 56px;  /* 40px frame + 16px */
  }

  .wi-scroll-hint {
    bottom: 56px;  /* 40px frame + 16px */
  }

  /* ── Caption ── */
  .wi-sec-num {
    font-size: clamp(56px, 18vw, 100px);
  }
}

@media (max-width: 480px) {
  /* ── Nav: hide links on small phones (immersive page has progress nav) ── */
  .wi-body .nav .right ul {
    display: none;
  }
  .wi-body .navMusicBtn {
    margin-left: 0;
  }

  /* ── Section content ── */
  .wi-sec-content {
    padding: 0 18px 90px;
  }

  .wi-sec:not(.wi-sec--intro) .wi-sec-content {
    top: 50vh;
    padding: 0 32px;
  }

  /* ── Intro glass ── */
  .wi-sec--intro .wi-sec-content {
    padding: 0 32px 44px;
  }

  .wi-intro-glass {
    max-height: 52vh;
  }

  .wi-project-title {
    font-size: 22px;
  }

  /* ── Caption type ── */
  .wi-sec-num {
    font-size: clamp(44px, 14vw, 70px);
    margin-bottom: -8px;
  }

  .wi-cap-main {
    font-size: clamp(18px, 5.5vw, 26px);
  }

  /* ── Fixed UI ── */
  .wi-progress {
    display: none;  /* too small to be useful; counter still shows */
  }

  .wi-back-top {
    right: 32px;   /* 16px frame + 16px */
    bottom: 44px;  /* 28px frame + 16px */
  }

  .wi-scroll-hint {
    bottom: 44px;
  }

  .wi-counter {
    left: 32px;
    bottom: 44px;
  }
}

/* ── Next works panel ───────────────────────────────────────
   Appears when the user finishes section 07. Centered above
   the frame bottom edge, glass morphism style. */
.wi-next-works {
  position: fixed;
  bottom: 88px;        /* frame 64px + 24px gap */
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  background: rgba(12, 12, 12, 0.68);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 14px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wi-next-works.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.wi-next-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color1, #1E5EFF);
  margin: 0;
}

/* Back-to-top inside the items row: separated by extra left margin */
.wi-next-works .wi-back-top {
  position: static;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  margin-left: 20px;
  flex-shrink: 0;
}

.wi-next-items {
  display: flex;
  gap: 6px;
}

.wi-next-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
  white-space: nowrap;
}

.wi-next-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
}

.wi-next-title {
  font-size: 11px;
  font-weight: 500;
}

.wi-next-arrow {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wi-next-item:hover .wi-next-arrow {
  opacity: 1;
  transform: translateX(3px);
}

@media (max-width: 768px) {
  .wi-next-works {
    bottom: 56px;
    left: 28px;
    right: 28px;
    transform: translateY(16px);
    width: auto;
  }
  .wi-next-works.is-visible {
    transform: translateY(0);
  }
  .wi-next-items {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .wi-next-works {
    bottom: 44px;
    left: 16px;
    right: 16px;
  }
}

/* ── Rounded frame mask ──────────────────────────────────────
   Sits BELOW the nav (z-index 9998 < nav 9999).
   The element is the transparent "window"; box-shadow fills
   everything outside it with the background grey, following
   border-radius so all four corners are visibly rounded.
   top matches nav height so the window starts right below it.
──────────────────────────────────────────────────────────── */
.wi-frame {
  position: fixed;
  top:    80px;   /* desktop nav height */
  left:   64px;
  right:  64px;
  bottom: 64px;
  z-index: 9998;  /* below nav (9999), above canvas/content */
  pointer-events: none;
  border-radius: 20px;
  box-shadow: 0 0 0 100vmax var(--color0, #DEDEDE);
}

@media (max-width: 1024px) {
  .wi-frame {
    left:   48px;
    right:  48px;
    bottom: 52px;
    border-radius: 18px;
  }
  .wi-progress { right: 64px; }        /* 48px frame + 16px */
  .wi-counter  { left: 64px; bottom: 68px; }  /* 48px + 16px / 52px + 16px */
  .wi-scroll-hint { bottom: 68px; }
}

@media (max-width: 768px) {
  .wi-frame {
    top:    64px;   /* nav shrinks to 64px at this breakpoint */
    left:   28px;
    right:  28px;
    bottom: 40px;
    border-radius: 14px;
  }
}

@media (max-width: 480px) {
  .wi-frame {
    left:   16px;
    right:  16px;
    bottom: 28px;
    border-radius: 10px;
  }
  .wi-progress { right: 28px; }        /* 16px frame + 12px */
  .wi-counter  { left: 28px; bottom: 40px; }  /* 16px + 12px / 28px + 12px */
  .wi-scroll-hint { bottom: 40px; }
}
