/* ==========================================================================
   CHAPTER 03 | EVERY DETAIL.
   (redesigned 2026-11-25)
   .detail : one pinned stage — mirror of CHAPTER 02's last frame, then
             TEXTURE → NECKLINE → SIGNATURE → FINISH (all masks are transform-only)
   .extra  : pinned NOTHING EXTRA. → hand-off to CHAPTER 04
   ========================================================================== */

/* ── SCENE 01–02 ──────────────────────────────────────────── */
.detail {
  /* ── Adjustable ───────────────────────────────────────────────
     --detail-length   : 区間全体の高さ（画面何枚分）。演出に使うのは −1画面分（4シーン）
     --handoff-overlap : CHAPTER 02 の最後（SHORTS で止まっている区間）に重ねる長さ。
                         CHAPTER 02 の SHORTS が中央に止まった直後から始まるよう
                         (1 − 0.925) × (5.4 − 1) ≈ 0.33 にしている */
  --detail-length: 7.2;   /* ≈ 6.2 screens of scroll for the four scenes */
  --handoff-overlap: 0.33;

  position: relative;
  z-index: 2;
  height: calc(var(--vh-large) * var(--detail-length));
  margin-top: calc(var(--vh-large) * -1 * (1 + var(--handoff-overlap)));
  pointer-events: none;
}
.detail__stage {
  position: sticky;
  top: 0;
  height: var(--vh-large);
  overflow: hidden;
  contain: layout paint;
  isolation: isolate;
  background: rgb(217, 216, 212);   /* = CHAPTER 02 light grey; JS blends to black */
  visibility: hidden;               /* shown by JS only once pinned (exact hand-off) */
}

.detail__mirror { position: absolute; inset: 0; z-index: 2; }
.detail__mirror-product {
  margin: 0;
  opacity: 1;
}
.detail__mirror-name {
  bottom: auto;
  opacity: 1;
}

/* Layers (z order = scene order). Each mask is a wrapper with overflow: hidden whose
   transform crops the picture, while the picture counter-transforms — no clip-path. */
.dl {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  will-change: transform, opacity;
}
.dl__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform-origin: 50% 50%;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.dl--texture { z-index: 1; }
.dl--curtain { z-index: 5; background: var(--c-black); opacity: 1; transform: translate3d(0, 100%, 0); }
.dl--neck    { z-index: 6; overflow: visible; }
.dl--sig     { z-index: 7; }
.dl--finish  { z-index: 8; }
.dl__inner   { position: absolute; inset: 0; will-change: transform; }
.dl__mask    { position: absolute; inset: 0; }   /* SIGNATURE's mask (a framed panel on landscape PC only) */
.dlabel__pc  { display: none; }                  /* large number + name: landscape PC only */
.dl--finish .dl__img { object-position: 30% 50%; }   /* keeps the cuff and the logo in frame */

/* NECKLINE frame: full width, centred in the always-visible height */
.dl__frame {
  position: absolute;
  left: 0;
  width: 100vw;
  height: calc(100vw * 710 / 830);                     /* the photo's own aspect ratio */
  top: calc(var(--vh-small) / 2 - 100vw * 710 / 830 / 2 - 18px);
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* Labels: "01 — NECKLINE" etc. Kept away from the logo. */
.dlabel {
  position: absolute;
  left: var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font: 500 12px/11px var(--font-text);       /* line box kept at 11px */
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--c-white);
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
}
.dlabel::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: .7;
}
.dlabel--under  { top: calc(var(--vh-small) / 2 + 100vw * 710 / 830 / 2 - 18px + 22px); }
.dlabel--bottom { top: calc(var(--vh-small) - var(--safe-bottom) - 64px); z-index: 2; }
.dlabel--top    { top: calc(var(--safe-top) + 88px); z-index: 2; }

.detail__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.38) 34%, rgba(0,0,0,0) 62%),
    linear-gradient(to bottom, rgba(0,0,0,.30) 0%, rgba(0,0,0,0) 22%);
}

.detail__ui {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  height: var(--vh-small);
}
.detail__copy {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--safe-bottom) + 64px);
  color: var(--c-white);
  will-change: transform;
}
.detail__title {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: calc((100vw - 2 * var(--gutter)) / 5.42);   /* same scale as CHAPTER 01 */
  line-height: .86;
  letter-spacing: -.045em;
  text-transform: uppercase;
}
.detail__line {
  display: block;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
}
.detail__sub {
  margin-top: 22px;
  font-family: var(--font-jp);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: .12em;
  color: rgba(255,255,255,.86);
  opacity: 0;
  will-change: transform, opacity;
}

/* ── NOTHING EXTRA. — brand film ─────────────────────────── */
.extra {
  /* --extra-length  : 区間全体の高さ（画面何枚分）。演出に使うのは −1画面分
     --extra-overlap : FINISH の最後に重ねる長さ（画面何枚分）。この間にムービーが重なってくる */
  --extra-length: 2.6;   /* 2026-11-30 段階2：映像と文字は時間で進むため 3.2 → 2.6（旧方式 ?motion=legacy は 3.2） */
  --extra-overlap: 0.5;
  position: relative;
  z-index: 2;
  height: calc(var(--vh-large) * var(--extra-length));
  margin-top: calc(var(--vh-large) * -1 * (1 + var(--extra-overlap)));
  pointer-events: none;
}
.extra__stage {
  position: sticky;
  top: 0;
  height: var(--vh-large);
  overflow: hidden;
  contain: layout paint;
  background: transparent;          /* JS: transparent over FINISH → black */
  visibility: hidden;               /* shown by JS only once pinned */
}
.extra__media {
  position: absolute;
  inset: 0;
  opacity: 0;
  will-change: opacity;
}
.extra__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 50% 50%;
  will-change: transform;
}
.extra__veil {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% 50%, rgba(0,0,0,.42), rgba(0,0,0,0) 70%),
    linear-gradient(to top, rgba(0,0,0,.5), rgba(0,0,0,0) 40%);
}
/* PLAY — shown only when autoplay is refused (Low Power Mode etc.); quiet text + hairline triangle */
.extra__play {
  position: absolute;
  right: calc(var(--gutter) - 10px);
  top: calc(var(--vh-small) - var(--safe-bottom) - 72px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  font: 500 12px/1 var(--font-text);
  letter-spacing: .24em;
  color: var(--c-white);
  opacity: 0;
  pointer-events: none;
}
.extra__play[hidden] { display: none; }
.extra__play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}
/* iOS draws its own large play glyph over a muted inline video it may not autoplay — hide it */
.extra__video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.extra__video::-webkit-media-controls { display: none !important; }

.extra__title {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: calc(var(--vh-small) * 0.62);   /* below the chest logos, above the shorts logo of the walking cut */
  margin: 0;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  color: var(--c-white);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: calc((100vw - 2 * var(--gutter)) / 4.3);   /* "NOTHING" (≈4.28em) spans the width */
  line-height: .9;
  letter-spacing: -.045em;
  text-transform: uppercase;
}
.extra__line {
  display: block;
  overflow: hidden;                 /* the mask each word rises through */
  padding-bottom: .04em;
}
.extra__word {
  display: block;
  white-space: nowrap;
  transform: translate3d(0, 105%, 0);
  will-change: transform;
}
.extra__black {
  position: absolute;
  inset: 0;
  background: var(--c-black);
  opacity: 0;
  pointer-events: none;
}

/* ── Tablet / PC (basic only — full PC design comes later) ── */
@media (min-width: 768px) {
  .detail__title, .extra__title { font-size: calc((100vw - 2 * var(--gutter)) / 7); }
  /* NECKLINE frame on wide screens: centred, not full width (PC design comes later) */
  .dl__frame { left: 50%; width: min(70vw, 900px); height: calc(min(70vw, 900px) * 710 / 830);
               margin-left: calc(min(70vw, 900px) / -2); top: calc(var(--vh-small) / 2 - min(70vw, 900px) * 710 / 830 / 2 - 18px); }
  .dlabel--under { left: calc(50% - min(70vw, 900px) / 2); top: calc(var(--vh-small) / 2 + min(70vw, 900px) * 710 / 830 / 2 - 18px + 22px); }
}

/* ── Landscape PC (≥1024px wide, landscape only) ────────────────────────────
   縦長の写真を全面に引き伸ばさず、額縁として置き、横幅は大きな番号とラベルで構成する。
     TEXTURE   CHAPTER 02 の SHORTS の位置から生地の窓が開き、中央の縦長の額縁（画面の高さ）に。
               EVERY を左上、DETAIL. を右下に置き、額縁の端に重ねる
     01 NECKLINE  左に大きな写真（細い帯から上下に開く）／右に 01 と NECKLINE
     02 SIGNATURE 右に縦長の額縁（下からマスクがせり上がる・視点が胸ロゴへ移動）／左に 02 と SIGNATURE
     03 FINISH    中央やや左に横長の額縁（中心から左右へ開く）／写真の左下に 03 と FINISH を重ねる
   区間は 6画面（モバイル・タブレット縦は 7.2）。タイミングは js/ch03-detail.js の PC。
   演出なし表示（.is-static）は対象外。                                                   */
@media (min-width: 1024px) and (orientation: landscape) {
  .detail {
    --detail-length: 6;
    --pf-w: calc(var(--vh-large) * 1122 / 1402);           /* portrait frame at full height */
    --neck-w: min(46vw, 720px);
    --neck-h: calc(var(--neck-w) * 710 / 830);
    --fin-w: min(58vw, 960px);
    --fin-h: calc(var(--vh-large) * .84);
    --col: calc(var(--gutter) * 1.5);                       /* outer margin of the frames */
    --num-size: min(28vh, 16vw, 18rem);
    --name-size: min(7vh, 4.4vw, 4.75rem);
  }

  /* TEXTURE — centred portrait frame */
  .detail:not(.is-static) .dl--texture {
    inset: 0 auto 0 calc(50% - var(--pf-w) / 2);
    width: var(--pf-w);
    transform-origin: 50% 45%;                              /* the window opens where SHORTS stood */
  }
  .detail:not(.is-static) .dl--texture .dl__img { transform-origin: 50% 45%; }

  .detail:not(.is-static) .detail__copy { inset: 0 var(--gutter); }
  .detail:not(.is-static) .detail__title {
    position: absolute;
    left: 0;
    right: 0;
    top: 17vh;
    font-size: min(21vh, 12.5vw, 15rem);
  }
  .detail:not(.is-static) .detail__line:nth-child(2) { align-self: flex-end; margin-top: 15vh; }
  .detail:not(.is-static) .detail__sub {
    position: absolute;
    right: 0;
    bottom: 9vh;
    margin: 0;
    font-size: 15px;
  }

  /* 01 NECKLINE — photo left, number + name right */
  .detail:not(.is-static) .dl__frame {
    left: var(--col);
    width: var(--neck-w);
    height: var(--neck-h);
    margin-left: 0;
    top: calc(50% - var(--neck-h) / 2);
  }
  .detail:not(.is-static) .dlabel--under {
    top: auto;
    left: calc(var(--col) + var(--neck-w) + 6vw);
    bottom: calc(50% - var(--neck-h) / 2);
  }

  /* 02 SIGNATURE — portrait frame right, number + name left */
  .detail:not(.is-static) .dl--sig { overflow: visible; }
  .detail:not(.is-static) .dl__mask {
    left: auto;
    right: var(--col);
    width: var(--pf-w);
    overflow: hidden;
    will-change: transform, opacity;
  }
  .detail:not(.is-static) .dlabel--bottom { top: auto; left: var(--col); bottom: 12vh; }

  /* 03 FINISH — wide frame, opens sideways from its centre; the label overlaps its lower-left corner */
  .detail:not(.is-static) .dl--finish { overflow: visible; }
  .detail:not(.is-static) .dl__inner {
    inset: auto;
    left: calc(var(--col) + 14vw);
    top: calc(50% - var(--fin-h) / 2 + 3vh);
    width: var(--fin-w);
    height: var(--fin-h);
    overflow: hidden;
  }
  .detail:not(.is-static) .dl--finish .dl__img { object-position: 30% 55%; }
  .detail:not(.is-static) .dlabel--top { top: auto; left: var(--col); bottom: 9vh; z-index: 2; }

  /* Labels: a large number and the name under a hairline */
  .detail:not(.is-static) .dlabel { display: block; white-space: nowrap; }
  .detail:not(.is-static) .dlabel::before { display: none; }
  .detail:not(.is-static) .dlabel__text { display: none; }
  .detail:not(.is-static) .dlabel__pc { display: flex; flex-direction: column; align-items: flex-start; }
  .detail:not(.is-static) .dlabel__num {
    font: 900 var(--num-size)/.8 var(--font-display);
    letter-spacing: -.05em;
  }
  .detail:not(.is-static) .dlabel__name {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 30px;
    font: 900 var(--name-size)/.9 var(--font-display);
    letter-spacing: -.035em;
  }
  .detail:not(.is-static) .dlabel__name::before {
    content: "";
    width: 44px;
    height: 1px;
    background: currentColor;
    opacity: .7;
  }
}

/* ── NOTHING EXTRA. — landscape PC (≥1024px wide, landscape only) ─────────────
   ムービーは縦横比 9:16 のまま中央に（トリミング・引き伸ばしなし、ヘッダーと重ならない上下の余白）。
   NOTHING を左上、EXTRA. を右下に置き、NOTHING は映像の左端に少し重ねる。映像の左下に補助文字。
   区間は 2.8画面（モバイル・タブレット縦は 3.2）。タイミングは js/ch03-detail.js の PC_FILM。
   最後は黒い画面の色を CHAPTER 04 の背景と同じ色・同じタイミングで変え、境目の線を出さない。 */
.extra__caption { display: none; }
@media (min-width: 1024px) and (orientation: landscape) {
  .extra {
    --extra-length: 2.4;   /* 段階2：2.8 → 2.4（旧方式 ?motion=legacy は 2.8） */
    --film-pad: max(88px, 9.5vh);                          /* clear of the fixed header */
    --film-h: calc(var(--vh-large) - 2 * var(--film-pad));
    --film-w: calc(var(--film-h) * 9 / 16);                /* the film's own aspect ratio */
  }
  .extra:not(.is-static) .extra__media,
  .extra:not(.is-static) .extra__veil {
    inset: auto;
    top: var(--film-pad);
    left: calc(50% - var(--film-w) / 2);
    width: var(--film-w);
    height: var(--film-h);
  }
  .extra:not(.is-static) .extra__title {
    top: 0;
    bottom: 0;
    left: var(--gutter);
    right: var(--gutter);
    transform: none;
    display: block;
    font-size: min(15vh, 9vw, 11rem);
    pointer-events: none;
  }
  .extra:not(.is-static) .extra__line { position: absolute; }
  .extra:not(.is-static) .extra__line:nth-child(1) { left: 0; top: calc(var(--film-pad) + var(--film-h) * .16); }
  .extra:not(.is-static) .extra__line:nth-child(2) { right: 0; bottom: calc(var(--film-pad) + var(--film-h) * .1); }
  .extra:not(.is-static) .extra__caption {
    display: block;
    position: absolute;
    left: calc(50% - var(--film-w) / 2);
    top: calc(var(--film-pad) + var(--film-h) + 24px);
    z-index: 2;
    margin: 0;
    font: 500 12px/1 var(--font-text);
    letter-spacing: .26em;
    color: rgba(255, 255, 255, .62);
    white-space: nowrap;
    opacity: 0;
  }
  .extra:not(.is-static) .extra__play { right: calc(50% - var(--film-w) / 2 - 10px); top: calc(var(--film-pad) + var(--film-h) + 8px); }
}

/* 旧方式との比較（?motion=legacy）：段階2以前の区間の長さ */
.motion-legacy .extra { --extra-length: 3.2; }
@media (min-width: 1024px) and (orientation: landscape) {
  .motion-legacy .extra { --extra-length: 2.8; }
}

/* ── Static (reduced motion / no JS) ──────────────────────── */
.detail.is-static { height: auto; margin-top: 0; }
.detail.is-static .detail__stage { position: relative; height: auto; overflow: visible; visibility: visible; background: var(--c-black); }
.detail.is-static .detail__mirror,
.detail.is-static .dl--curtain { display: none; }
.detail.is-static .dl { position: relative; inset: auto; height: var(--vh-small); opacity: 1; transform: none; }
.detail.is-static .dl--texture { position: absolute; inset: 0 0 auto 0; }
.detail.is-static .detail__ui { position: relative; }
.detail.is-static .dl--neck { height: auto; padding: 72px 0 96px; }
.detail.is-static .dl__frame { position: relative; top: auto; transform: none; }
.detail.is-static .dlabel { opacity: 1; transform: none; }
.detail.is-static .dlabel--under { position: relative; top: auto; margin-top: 22px; }
.detail.is-static .detail__shade,
.detail.is-static .detail__line,
.detail.is-static .detail__sub { opacity: 1; }
.extra.is-static { height: auto; margin-top: 0; }
.extra.is-static .extra__stage { position: relative; height: var(--vh-small); visibility: visible; background: var(--c-black); }
.extra.is-static .extra__media { opacity: 1; }
.extra.is-static .extra__veil { opacity: 1; }
.extra.is-static .extra__word { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .detail, .extra { margin-top: 0; }
}
