/* ───────── 스토리 스테이지 (스크롤 = 하루) ───────── */
.story {
  position: relative;
  height: 1500vh;
}

.stage {
  --bg: var(--cream);
  --fg: var(--ink);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
  padding: 88px var(--gutter) 28px;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

/* 등록 버튼에서 오렌지가 번지는 막 */
.stage__wipe {
  position: absolute;
  inset: 0;
  background: var(--orange);
  clip-path: circle(var(--wr, 0%) at var(--wx, 50%) var(--wy, 50%));
  pointer-events: none;
}

/* 챕터 번호를 아주 크게, 옅게 깐다 */
.stage__bignum {
  position: absolute;
  right: -0.04em;
  bottom: -0.2em;
  z-index: 1;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(260px, 42vw, 620px);
  line-height: 1;
  color: currentColor;
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
}

.stage__copy {
  position: relative;
  z-index: 3;
  align-self: center;
  max-width: 560px;
}

/* 오리 동선 레일 */
.rail {
  position: relative;
  margin-bottom: clamp(28px, 6vh, 64px);
  padding-top: 10px;
}

.rail__line {
  position: relative;
  height: 2px;
  background-image: linear-gradient(90deg, currentColor 40%, transparent 40%);
  background-size: 9px 2px;
  opacity: 0.55;
}

.rail__fill {
  position: absolute;
  inset: 0;
  right: auto;
  width: 0%;
  background: currentColor;
}

.rail__stops {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
}

.rail__stops li {
  position: relative;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.rail__stops li::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: currentColor;
}

.rail__stops li:first-child::before {
  left: 0;
  margin-left: 0;
}

.rail__stops li:last-child::before {
  left: auto;
  right: 0;
  margin-left: 0;
}

.rail__stops li.is-on {
  opacity: 1;
}

.rail__foot {
  position: absolute;
  top: -8px;
  left: 0;
  width: 20px;
  height: 20px;
  color: var(--orange);
  transform: rotate(90deg);
  transform-origin: 50% 50%;
}

.stage.on-orange {
  color: var(--on-orange);
}

.stage.on-orange .rail__foot {
  color: var(--on-orange);
}

/* 캡션: 같은 자리에 겹쳐 두고 스크롤로 갈아 끼운다 */
.caps {
  position: relative;
  min-height: 330px;
}

.cap {
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  visibility: hidden;
}

.cap__no {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 800;
}

.cap__no .serif {
  font-size: 22px;
}

.cap__no .serif:last-child {
  font-size: 17px;
  opacity: 0.6;
}

.cap__title {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 68px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.cap__accent {
  color: var(--orange);
}

.stage.on-orange .cap__accent {
  color: var(--butter);
}

.cap__body {
  max-width: 30em;
  margin: clamp(14px, 2.4vh, 24px) 0 0;
  font-size: clamp(15px, 1.25vw, 18px);
  opacity: 0.86;
}

.stage__note {
  margin: 24px 0 0;
  font-size: 12px;
  opacity: 0.55;
}

/* 장면 영역 — 안쪽 장면은 400×660 좌표로 그리고 비율에 맞춰 줄인다 */
.stage__scene-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  min-height: 0;
}

.scene {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 660px;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) scale(var(--scene-scale, 1));
}

.obj {
  position: absolute;
  top: 50%;
  left: 50%;
}

@media (max-width: 860px) {
  .story {
    height: 1600vh;
  }
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
    padding: 72px 16px 10px;
  }
  /* 챕터 번호를 아주 크게, 옅게 깐다 */
.stage__bignum {
  position: absolute;
  right: -0.04em;
  bottom: -0.2em;
  z-index: 1;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(260px, 42vw, 620px);
  line-height: 1;
  color: currentColor;
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
}

.stage__copy {
    max-width: none;
    align-self: start;
  }
  .rail {
    margin-bottom: 14px;
  }
  .rail__stops {
    font-size: 11px;
  }
  .stage__note {
    display: none;
  }
  .caps {
    min-height: 148px;
  }
  .cap__no {
    margin-bottom: 6px;
    font-size: 12px;
  }
  .cap__no .serif {
    font-size: 17px;
  }
  .cap__no .serif:last-child {
    display: none;
  }
  .cap__title {
    font-size: clamp(25px, 7.4vw, 34px);
  }
  .cap__body {
    margin-top: 8px;
    font-size: 13.5px;
    line-height: 1.5;
  }
}

@media (max-width: 860px) and (max-height: 700px) {
  .cap__body {
    display: none;
  }
  .caps {
    min-height: 82px;
  }
}
