/* EBBM COSMETICS — 모션 2판 "물 · 금 · 안개" (2026-12)
   짝: assets/js/motion.js. 규칙은 docs/개편_2026-12.md 4절.
   물  = 방울이 번지며 드러남(사진 가림막, 첫 진입, 페이지 이동), 히어로의 액체 전환과 잔물결(WebGL)
   금  = 짙은 구역에 떠다니는 금박(캔버스)
   안개 = 글자가 흐림에서 또렷하게 맺힘
   · 숨김은 html.motion-ready 가 붙었을 때만(머리 스크립트가 붙이고, 모션 스크립트가 못 오면 3초 뒤 뗀다).
   · 움직임 줄이기 설정이면 motion-ready 가 붙지 않아 여기의 숨김·붙잡기·캔버스가 모두 꺼진다. */

:root {
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  /* 방울 모양 둘(가림막용). 겹쳐 쓰면 가장자리가 일렁이는 것처럼 보인다 */
  --blob-a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M50 4c14 0 30 6 38 19s10 30 3 44-22 26-38 28-33-5-43-18S-2 42 6 27 34 4 50 4z'/%3E%3C/svg%3E");
  --blob-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M54 5c16 3 31 13 36 29s-2 33-15 45-32 16-47 9S4 67 5 50 13 17 27 9s14-6 27-4z'/%3E%3C/svg%3E");
}

/* ── 페이지 이동(지원 브라우저만): 누른 자리에서 새 화면이 방울처럼 번진다 ── */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
  ::view-transition-new(root) { animation: vt-drop .8s var(--ease-io) both; mix-blend-mode: normal; }
}
@keyframes vt-drop { from { clip-path: circle(0 at var(--vx, 50%) var(--vy, 50%)); } to { clip-path: circle(150vmax at var(--vx, 50%) var(--vy, 50%)); } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ── 첫 방문 인트로(세션에 한 번, 첫 화면만): 금빛 방울 하나가 떨어지고, 닿은 자리에서 어두운 막이 방울 모양으로 열린다. 1.2초.
      CSS 만으로 끝나 스스로 사라지고(스크립트가 없어도), 화면을 막지 않는다. 누르거나 굴리면 바로 건너뛴다. ── */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  html.intro body::before { content: ""; position: fixed; inset: 0; z-index: 200; pointer-events: none; background: var(--night);
    -webkit-mask: linear-gradient(#000 0 0) 0 0 / 100% 100% no-repeat, var(--blob-a) 50% 50% / 0vmax 0vmax no-repeat; -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) 0 0 / 100% 100% no-repeat, var(--blob-a) 50% 50% / 0vmax 0vmax no-repeat; mask-composite: exclude;
    animation: drop-open .8s var(--ease-io) .4s both, intro-end .01s 1.25s both; }
  html.intro body::after { content: ""; position: fixed; left: 50%; top: 50%; z-index: 201; width: 14px; height: 18px; margin: -9px 0 0 -7px; pointer-events: none; background: var(--gold); border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; animation: drop-fall .44s cubic-bezier(.55, 0, 1, .45) both; }
  html.intro::after { content: ""; position: fixed; left: 50%; top: 50%; z-index: 201; width: 40px; height: 40px; margin: -20px 0 0 -20px; pointer-events: none; border: 1px solid var(--gold); border-radius: 50%; animation: drop-ring .9s var(--ease) .4s both; }
  html.intro .hd-logo .wordmark { animation: mist-in 1s var(--ease) 1s both; }
}
@keyframes drop-open { from { -webkit-mask-size: 100% 100%, 0vmax 0vmax; mask-size: 100% 100%, 0vmax 0vmax; } to { -webkit-mask-size: 100% 100%, 360vmax 360vmax; mask-size: 100% 100%, 360vmax 360vmax; } }
@keyframes intro-end { to { visibility: hidden; } }
@keyframes drop-fall { 0% { transform: translateY(-56vh) scaleY(1.6); opacity: 0; } 20% { opacity: 1; } 92% { transform: translateY(0) scaleY(1.15); opacity: 1; } 100% { transform: translateY(0) scale(2.4, .3); opacity: 0; } }
@keyframes drop-ring { from { transform: scale(0); opacity: .9; } to { transform: scale(9); opacity: 0; } }
@keyframes mist-in { from { opacity: 0; filter: blur(10px); transform: scale(1.08); } }

/* ── 등장: 준비 전 ── 스크립트가 조각을 나누기 전까지는 덩어리째 감춘다 */
html.motion-ready [data-reveal]:not(.rv-ready),
html.motion-ready [data-hero]:not(.rv-ready) :is([data-hero-copy], [data-hero-media], .hero-cap b, .hero-cap > span, .carousel-ui) { opacity: 0; }

/* ── 등장: 조각별 숨은 모습(.rv-wait 아래) → 움직이는 동안만 전환(.rv-go) ──
   --d: 덩어리의 늦춤(들어온 차례), --o: 덩어리 안에서의 차례, --i: 글자·낱말 차례, --k: 가운데에서 떨어진 정도 */
html.motion-ready :is(.rv-wait, .rv-wait *).rv-item { opacity: 0; translate: 0 22px; filter: blur(6px); }
html.motion-ready :is(.rv-wait, .rv-wait *).rv-rule { scale: 0 1; }
/* 안개: 글자가 흐리고 벌어진 채 있다가 또렷하게 모인다 */
html.motion-ready .rv-wait .mc { opacity: 0; filter: blur(.3em); translate: calc(var(--k, 0) * .1em) .1em; }
html.motion-ready .rv-wait .rv-mist:not(.is-split) { opacity: 0; }
/* 방울: 방울 모양 가림막 둘이 번지며 사진이 드러난다(안쪽 사진은 살짝 큰 데서 가라앉는다) */
html.motion-ready :is(.rv-wait, .rv-wait *).rv-ph {
  -webkit-mask: var(--blob-a) 40% 62% / 0% 0% no-repeat, var(--blob-b) 62% 44% / 0% 0% no-repeat;
  mask: var(--blob-a) 40% 62% / 0% 0% no-repeat, var(--blob-b) 62% 44% / 0% 0% no-repeat; }
html.motion-ready :is(.rv-wait, .rv-wait *).rv-ph img { scale: 1.28; }
.rv-rule { transform-origin: 0 50%; }
:is(.rv-go, .rv-go *).rv-item { --t: calc(var(--d, 0ms) + var(--o, 0ms)); transition: opacity .9s var(--ease) var(--t), translate 1.1s var(--ease) var(--t), filter .9s var(--ease) var(--t); }
:is(.rv-go, .rv-go *).rv-rule { transition: scale 1.1s var(--ease-io) calc(var(--d, 0ms) + var(--o, 0ms)); }
.rv-go .mc { --t: calc(var(--d, 0ms) + var(--o, 0ms) + var(--i, 0) * var(--gap, 30ms)); transition: opacity .8s ease-out var(--t), filter 1.1s var(--ease) var(--t), translate 1.3s var(--ease) var(--t); }
:is(.rv-go, .rv-go *).rv-ph {
  -webkit-mask: var(--blob-a) 40% 62% / 290% 290% no-repeat, var(--blob-b) 62% 44% / 340% 340% no-repeat;
  mask: var(--blob-a) 40% 62% / 290% 290% no-repeat, var(--blob-b) 62% 44% / 340% 340% no-repeat;
  --t: calc(var(--d, 0ms) + var(--o, 0ms)); transition: -webkit-mask-size 1.7s var(--ease-io) var(--t), mask-size 1.7s var(--ease-io) var(--t); }
:is(.rv-go, .rv-go *).rv-ph img { transition: scale 2s var(--ease) calc(var(--d, 0ms) + var(--o, 0ms)); }
.mw { display: inline-block; white-space: nowrap; }
.mc { display: inline-block; }

/* ── 사진 안쪽 시차(스크립트가 transform 으로 위아래를 민다) ── */
[data-plx] img { scale: 1.1; }

/* ── 첫 화면 히어로: WebGL 무대 ── 캔버스가 사진 자리에 겹쳐 그린다. 준비되면(.gl-on) 사진은 감추고 캔버스가 맡는다 */
.hero-gl { grid-area: 1 / 1; align-self: start; aspect-ratio: 4 / 5; min-width: 0; pointer-events: none; visibility: hidden; }
.hero-gl canvas { display: block; width: 100%; height: 100%; }
@media (min-width: 1024px) { .hero-gl { aspect-ratio: 1; } }
.gl-on .hero-gl { visibility: visible; }
.gl-on .hero-slide .ph { opacity: 0; transition: none; background: none; }
/* 장 이름: 지금 장의 글자가 안개에서 맺히고, 떠나는 장의 글자는 흩어진다 */
html.motion-ready .hero-cap .mc { transition: opacity .35s ease-in, filter .45s ease-in, translate .45s ease-in; }
html.motion-ready .hero-slide:not(.is-current) .hero-cap .mc, html.motion-ready [data-hero].rv-wait .hero-cap .mc { opacity: 0; filter: blur(.28em); translate: calc(var(--k, 0) * .12em) 0; }
html.motion-ready .hero-slide.is-current .hero-cap .mc { --t: calc(260ms + var(--i, 0) * 45ms); transition: opacity .8s ease-out var(--t), filter 1.1s var(--ease) var(--t), translate 1.3s var(--ease) var(--t); }
html.motion-ready [data-hero].rv-wait .hero-cap > span { opacity: 0; }
html.motion-ready [data-hero].rv-go .hero-slide.is-current .hero-cap > span { transition-delay: calc(var(--d, 0ms) + 1100ms); }
html.motion-ready [data-hero].rv-go .hero-slide.is-current .hero-cap .mc { --t: calc(var(--d, 0ms) + 800ms + var(--i, 0) * 45ms); }

/* ── 금박 캔버스 ── 짙은 구역 뒤에 깔린다(꾸밈) */
[data-flakes] { position: relative; }
[data-flakes] > :not(.flakes) { position: relative; z-index: 1; }
.flakes { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
[data-flakes="top"] > .flakes { height: min(100%, 420px); }

/* ── 컬렉션: 순번 ── */
.lines { counter-reset: line; }
.line { counter-increment: line; }
.line-text::before { content: counter(line, decimal-leading-zero); font: 400 13px/1 var(--sans); letter-spacing: .16em; color: var(--gold-deep); margin-bottom: 4px; }
.deck-meter { display: none; }

/* ── 컬렉션: 입체 카드 더미 ──
   틀이 화면에 붙고(position: sticky) 세로 스크롤에 따라 카드가 한 장씩 앞으로 넘어온다. 지난 카드는 뒤로 물러나며 어두워진다.
   높이(화면 + 넘길 거리)는 CSS 로 미리 잡는다. 카드의 transform 은 motion.js 가 스크롤 위치로 계산해 넣는다. */
html.motion-ready:not(.no-deck) .deck { --step: 68svh; height: calc(100svh + 4 * var(--step)); max-width: none; padding: 0; }
html.motion-ready:not(.no-deck) .deck-frame { position: sticky; top: 0; height: 100svh; overflow: hidden; overflow: clip;
  --card-h: min(100svh - var(--hd-h) - 236px, (100vw - 2 * var(--gutter)) * 1.25, 560px); }
html.motion-ready:not(.no-deck) .deck .lines { display: block; position: absolute; inset: var(--hd-h) 0 0; }
html.motion-ready:not(.no-deck) .deck .line { position: absolute; inset: 0; margin: 0; pointer-events: none; }
html.motion-ready:not(.no-deck) .deck .line.is-front { pointer-events: auto; }
html.motion-ready:not(.no-deck) .deck .line a { display: grid; grid-template-rows: 1fr auto; gap: 0; height: 100%; padding: 16px var(--gutter) 0; }
html.motion-ready:not(.no-deck) .deck .line .ph { position: relative; justify-self: center; align-self: center; height: var(--card-h); aspect-ratio: 4 / 5; transform-origin: 50% 100%; will-change: transform; opacity: 0; box-shadow: 0 30px 60px -28px rgba(31, 27, 22, .38); }
/* 물러난 카드는 안개에 잠기듯 바탕색으로 옅어지고(--dim), 앞 카드에 빛 반사(--gx, --gy) */
html.motion-ready:not(.no-deck) .deck .line .ph::after { content: ""; position: absolute; inset: 0; background: var(--paper); opacity: var(--dim, 0); pointer-events: none; }
html.motion-ready:not(.no-deck) .deck .line .ph::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 55%); opacity: var(--glare, 0); mix-blend-mode: soft-light; pointer-events: none; }
html.motion-ready:not(.no-deck) .deck .line .ph img { scale: none; transition: none; }
html.motion-ready:not(.no-deck) .deck .line-text { position: relative; z-index: 2; display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; align-items: end; align-content: start; height: 188px; padding-top: 18px; opacity: 0; will-change: opacity, transform; }
html.motion-ready:not(.no-deck) .deck .line-text::before { grid-row: 1 / span 3; align-self: start; font: 400 clamp(3.4rem, 15vw, 5rem)/.85 var(--serif); letter-spacing: 0; color: var(--gold-deep); margin: 0; font-variant-numeric: lining-nums; }
html.motion-ready:not(.no-deck) .deck .line-text b { font-size: clamp(1.9rem, 8vw, 2.6rem); white-space: nowrap; }
html.motion-ready:not(.no-deck) .deck .line-text > * { grid-column: 2; }
html.motion-ready:not(.no-deck) .deck-meter { display: block; position: absolute; left: var(--gutter); right: var(--gutter); bottom: max(14px, env(safe-area-inset-bottom)); height: 1px; background: var(--line); z-index: 3; }
.deck-meter i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }
@media (min-width: 1024px) {
  html.motion-ready:not(.no-deck) .deck { --step: 78vh; }
  html.motion-ready:not(.no-deck) .deck-frame { --card-h: min(100vh - var(--hd-h) - 150px, 660px); }
  html.motion-ready:not(.no-deck) .deck .line a { grid-template-rows: 1fr; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; max-width: var(--wrap); margin-inline: auto; padding: 0 var(--gutter); }
  html.motion-ready:not(.no-deck) .deck .line .ph { grid-column: 2; grid-row: 1; }
  html.motion-ready:not(.no-deck) .deck .line-text { grid-column: 1; grid-row: 1; height: auto; grid-template-columns: 1fr; gap: 10px; padding: 0; }
  html.motion-ready:not(.no-deck) .deck .line-text::before { grid-row: auto; font-size: clamp(6rem, 11vw, 10rem); margin-bottom: 12px; }
  html.motion-ready:not(.no-deck) .deck .line-text > * { grid-column: 1; }
  html.motion-ready:not(.no-deck) .deck .line-text b { font-size: clamp(2.6rem, 4.6vw, 4.4rem); }
  html.motion-ready:not(.no-deck) .deck-meter { left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))); right: auto; width: clamp(200px, 24vw, 340px); bottom: clamp(24px, 5vh, 48px); }
}
html.motion-ready:not(.no-deck) #collection { padding-bottom: 0; }
html.motion-ready:not(.no-deck) #collection .section-head { margin-bottom: 0; }

/* ── 서랍 메뉴: 열릴 때 항목이 차례로 맺힌다 ── */
@media (max-width: 1023.98px) and (prefers-reduced-motion: no-preference) {
  html.js .nav.is-open .nav-list > li { animation: nav-in .8s var(--ease) both; animation-delay: calc(90ms + var(--n, 0) * 60ms); }
  .nav-list > li:nth-child(2) { --n: 1; } .nav-list > li:nth-child(3) { --n: 2; } .nav-list > li:nth-child(4) { --n: 3; } .nav-list > li:nth-child(5) { --n: 4; }
}
@keyframes nav-in { from { opacity: 0; filter: blur(8px); transform: translateX(24px); } }

/* ── 마우스(PC 전용) ── */
.more span { position: relative; background: none; }
.more span::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: currentColor; transform-origin: 0 50%; }
@media (hover: hover) and (pointer: fine) {
  .more:hover span::after, a:hover .more span::after { animation: line-redraw .8s var(--ease-io) both; }
  .ph img { transition: scale 1.2s var(--ease); }
  .shot a:hover .ph img { scale: 1.04; }
  .shot a:hover [data-plx] img { scale: 1.14; }
}
@keyframes line-redraw { 0% { transform: scaleX(1); transform-origin: 100% 50%; } 45% { transform: scaleX(0); transform-origin: 100% 50%; } 46% { transform: scaleX(0); transform-origin: 0 50%; } 100% { transform: scaleX(1); transform-origin: 0 50%; } }

@media (prefers-reduced-motion: reduce) { [data-plx] img { scale: none; } .flakes { display: none; } }
