/* 숲 속 장면 (4차 design/comfy2 의 무대·영상·매킹·안개 + 5차 스크롤 장면 design/scroll).
   base.css 다음에 불러온다. 첫 화면의 장면 1(숲)과 장면 6(물러난 숲)이 같이 쓰고, 앞으로의 도구 소개 쪽도 쓸 수 있다.
   - 정지 쪽(움직임 끄기 단추 html.still·세로가 짧은 화면·자바스크립트 없음): 무대(.stage)를 16:9 로 화면 높이(--hh)에 꽉 채움(cover, --fx·--fy 자리 기준).
   - 움직이는 쪽(html.motion): 무대를 1920x1080px 로 두고 scroll.js 가 자리·배율·카메라를 transform 으로 넣음.
     배경·영상·매킹·안개가 모두 무대 안 % 자리라 어느 쪽이든 매킹 발이 같은 땅을 딛는다.
   - 장면은 밝은·어두운 모드 모두 같은 밤 장면 (글자색 고정, base.css .hero). */
.hero{--hh:max(100svh,600px);--fx:.78;--fy:.5;color:var(--h-ink);background:#05080a}
.pin{position:relative;overflow:hidden;isolation:isolate}
.stage{position:absolute;z-index:-3;width:max(100%,calc(var(--hh) * 16 / 9));aspect-ratio:16/9;
  left:calc(100% * var(--fx));top:calc(var(--hh) * var(--fy));transform:translate(calc(-100% * var(--fx)),calc(-100% * var(--fy)))}
.hero-poster,.hero-video,.dolly{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:cover}
.hero-video{opacity:0;transition:opacity 1.6s ease}
.hero-video.on{opacity:1}
.dolly{opacity:0;display:none}
/* 글 쪽(왼쪽)만 어둡게, 아래는 장면 색으로 살짝 */
.hero-shade{position:absolute;left:0;right:0;top:0;height:var(--hh);z-index:-2;pointer-events:none;
  background:linear-gradient(90deg,rgba(4,7,9,.72) 0%,rgba(4,7,9,.42) 32%,rgba(4,7,9,0) 58%),
             linear-gradient(180deg,rgba(4,7,9,.45) 0%,rgba(4,7,9,0) 22%,rgba(4,7,9,0) 78%,rgba(4,7,9,.6) 100%)}
.veil{display:none}

/* 흐르는 안개 (fog.webp, 이음매 없는 무늬)와 반딧불 */
.fog{position:absolute;left:0;width:200%;pointer-events:none;mix-blend-mode:screen;
  background:url(../img/hero/fog.webp) repeat-x 0 0/50% 100%;transform:translateX(-50%)}
.f1{top:44%;height:44%;opacity:.42}
.f2{top:66%;height:34%;opacity:.26}
.ff{position:absolute;width:.22%;aspect-ratio:1;border-radius:50%;background:#eef7b8;opacity:0;pointer-events:none;
  box-shadow:0 0 6px 2px rgba(220,240,140,.7)}
.ff:nth-child(1 of .ff){left:52%;top:78%}.ff:nth-child(2 of .ff){left:63%;top:84%}.ff:nth-child(3 of .ff){left:71%;top:73%}
.ff:nth-child(4 of .ff){left:80%;top:80%}.ff:nth-child(5 of .ff){left:88%;top:76%}.ff:nth-child(6 of .ff){left:58%;top:70%}
.ff:nth-child(7 of .ff){left:94%;top:86%}

/* 매킹: 무대 안 자리(% — design/comfy2/composite.py). 그림에 장면 빛·테두리 빛·바닥 그림자가 들어 있다 */
.hero-making{--mk-l:47.86%;--mk-t:53.87%;--mk-w:21.06%;--mk-ar:1101/1140;--mk-ox:56.7%;--mk-oy:86.8%;
  position:absolute;left:var(--mk-l);top:var(--mk-t);width:var(--mk-w);aspect-ratio:var(--mk-ar);pointer-events:none;
  transform-origin:var(--mk-ox) var(--mk-oy)}
.hero-making img{position:absolute;inset:0;width:100%;height:100%;transform-origin:var(--mk-ox) var(--mk-oy)}
.mk-blink{opacity:0}

/* 첫 칸 글: 큰 명조 제목 두 줄 + 한 줄 + 단추 */
.intro{position:relative;min-height:var(--hh);display:flex;flex-direction:column;justify-content:flex-end;
  padding:110px clamp(20px,4.4vw,72px) clamp(56px,10vh,112px);max-width:min(980px,62vw)}
.intro h1{font-family:var(--serif);font-weight:600;font-size:clamp(44px,5.7vw,104px);line-height:1.08;letter-spacing:-.04em;
  text-shadow:0 2px 30px rgba(0,0,0,.3)}
.intro h1 .ln{display:block;white-space:nowrap}
.intro h1 .ln:first-child{color:var(--h-ink2)}
:lang(ja) .intro h1{font-size:clamp(36px,4.5vw,84px);letter-spacing:-.03em}
:lang(en) .intro h1{font-size:clamp(44px,5.8vw,104px);letter-spacing:-.035em}
.sub{margin-top:28px;font-size:clamp(15px,1.12vw,18px);line-height:1.7;color:var(--h-ink2);max-width:28rem;text-wrap:pretty}
.cta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 22px;margin-top:32px}
.hint{display:none}

/* 장면 CSS 움직임은 기기의 '움직임 줄이기' 설정과 상관없이 켬 (대표 결정 11-02). 끄는 것은 머리글 단추(html.still, 이 파일 끝) */
.rise{animation:h-rise 1s cubic-bezier(.22,1,.36,1) both}
.intro h1 .ln:nth-child(1){animation-delay:.22s}
.intro h1 .ln:nth-child(2){animation-delay:.36s}
.sub{animation-delay:.5s}
.cta{animation-delay:.64s}
.reel .hero-poster{animation:h-push 2.4s cubic-bezier(.22,1,.36,1) both}
.hero-making img{animation:h-breathe 2.86s ease-in-out 1.7s infinite}
.mk-blink{animation:h-breathe 2.86s ease-in-out 1.7s infinite,h-blink 5.72s steps(1,end) 2.4s infinite}
@keyframes h-rise{from{opacity:0;transform:translateY(28px);filter:blur(10px)}to{opacity:1;transform:none;filter:none}}
@keyframes h-push{from{opacity:0;scale:1.06}to{opacity:1;scale:1}}
@keyframes h-breathe{0%,100%{transform:none}50%{transform:scale(.988,1.012)}}
@keyframes h-blink{0%{opacity:0}46%{opacity:1}48.5%{opacity:0}}
@keyframes fog{from{transform:translateX(-50%)}to{transform:translateX(0)}}
@keyframes ff{0%{opacity:0;transform:none}20%{opacity:.95}70%{opacity:.6}100%{opacity:0;transform:translate(1.4vw,-6vw)}}
.f1{animation:fog 90s linear infinite}
.f2{animation:fog 56s linear infinite}
.ff{animation:ff 7s ease-in-out infinite}
.ff:nth-child(2 of .ff){animation-delay:-1.3s;animation-duration:8.2s}.ff:nth-child(3 of .ff){animation-delay:-2.6s}
.ff:nth-child(4 of .ff){animation-delay:-3.9s;animation-duration:9s}.ff:nth-child(5 of .ff){animation-delay:-5.1s}
.ff:nth-child(6 of .ff){animation-delay:-0.6s;animation-duration:7.6s}.ff:nth-child(7 of .ff){animation-delay:-4.4s;animation-duration:8.6s}
/* 장면이 화면 밖이면 CSS 움직임도 멈춤 (scroll.js 가 .off) */
.stage.off *,.stage.off{animation-play-state:paused}

/* ---------- 움직이는 쪽 (html.motion, scroll.js) ---------- */
/* 스크롤마다 투명도·자리가 바뀌는 것(가림막·화면 빛·진열장 글·만드는 방식 줄·문의 등)은 will-change 로 따로 그려 둠 —
   Safari 는 2D 이동·투명도만 바뀌는 요소를 따로 떼지 않아서, 안 그러면 매 프레임 넓은 자리를 다시 그림 (v0.5.4) */
.motion .reel{height:520svh}
.motion .reel>.pin{position:sticky;top:0;height:100svh}
.motion .stage{width:1920px;height:1080px;aspect-ratio:auto;left:0;top:0;transform-origin:0 0;transform:none;will-change:transform}
.motion .reel .hero-poster{animation:none}
.motion .dolly{display:block;transition:opacity .25s linear}
/* 다가가는 프레임은 PC 만 (scroll.js wideQ 와 같은 조건) — 휴대폰에서는 쓰지 않는 1280x720 캔버스 층을 아예 안 만듦 (v0.5.6) */
@media not all and (min-width:821px) and (min-height:520px) and (hover:hover) and (pointer:fine){.motion .dolly{display:none}}
.motion .dolly.on{opacity:1}
.motion .hero-shade{height:100%}
.motion .veil{display:block;position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:0;will-change:opacity;
  background:radial-gradient(ellipse at 60% 50%,rgba(3,5,7,.2),rgba(3,5,7,.9) 75%)}
.motion .intro{position:absolute;left:0;bottom:0;min-height:0;will-change:opacity,transform}
.motion .hint{display:flex;position:absolute;left:50%;bottom:22px;translate:-50% 0;flex-direction:column;align-items:center;gap:8px;will-change:opacity;
  font-size:14px;letter-spacing:.14em;color:var(--h-ink3);pointer-events:none}
.motion .hint i{width:1px;height:38px;background:linear-gradient(var(--h-ink2),transparent);transform-origin:top;animation:hint 2.2s ease-in-out infinite}
@keyframes hint{0%{transform:scaleY(0);opacity:1}60%{transform:scaleY(1);opacity:1}100%{transform:scaleY(1);opacity:0}}

/* 좁은 PC·태블릿 가로 */
@media (min-width:821px) and (max-width:1180px){
  .intro{max-width:66vw}
  .intro h1{font-size:clamp(42px,5.6vw,72px)}
}
/* 휴대폰: 영상 없이 정지 그림. 장면 가운데에 빛나는 화면, 제목은 위, 단추는 아래 */
@media (max-width:820px){
  .hero{--fx:var(--fx-m,.72)}
  .hero-video{display:none}
  .hero-shade{background:linear-gradient(180deg,rgba(4,7,9,.7) 0%,rgba(4,7,9,.25) 30%,rgba(4,7,9,0) 55%,rgba(4,7,9,.75) 100%)}
  .intro{max-width:none;padding:92px 16px 40px;justify-content:space-between}
  .intro h1{font-size:clamp(36px,10.6vw,56px);line-height:1.12}
  :lang(ja) .intro h1{font-size:clamp(28px,8.2vw,46px)}
  :lang(en) .intro h1{font-size:clamp(36px,10.4vw,56px)}
  .sub{margin-top:auto;font-size:15px}
  .cta{margin-top:18px}
  .motion .intro{top:0;right:0}
  .motion .hint{bottom:12px}
}
/* 휴대폰 세로 (scroll.js 가 html.portrait): 장면 전체가 폭에 맞게 → 위아래 가장자리를 밤색으로 녹임 */
/* (v0.5.6) 예전에는 무대에 mask-image 로 위아래를 투명하게 했으나, iPhone Safari 는 가림(mask)이 걸린 무대(안개 섞기·움직이는 층 포함)를
   매 프레임 따로 한 번 더 그림 → 같은 모습을 무대 맨 위에 밤색(#05080a = .hero 바탕)이 투명으로 녹는 판(::after)을 얹어 냄. 계산상 같은 색 */
.motion.portrait .stage::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(180deg,#05080a 0,rgba(5,8,10,0) 16%,rgba(5,8,10,0) 84%,#05080a)}
.motion.portrait .hero-shade{background:linear-gradient(180deg,rgba(4,7,9,.5) 0%,rgba(4,7,9,0) 30%,rgba(4,7,9,0) 70%,rgba(4,7,9,.5) 100%)}
.motion.portrait .hint{display:none}
/* 휴대폰 세로 정지 쪽: 움직이는 쪽(fitPortrait)과 같은 구도를 CSS 로 — 장면 가로 920px 이 폭에 맞고 매킹이 글과 겹치지 않음 */
@media (max-width:820px) and (orientation:portrait){
  html:not(.motion) .stage{width:208.7vw;aspect-ratio:16/9;left:-85.9vw;top:calc(var(--hh) * .56 - 58.7vw);transform:none;
    -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 16%,#000 84%,transparent);mask-image:linear-gradient(180deg,transparent 0,#000 16%,#000 84%,transparent)}
  html:not(.motion) .outro .stage{top:calc(var(--hh) * .40 - 58.7vw)}
}
/* 움직임 끄기 (머리글 단추 → scroll.js 가 html.still, pref.js 가 그림이 뜨기 전에 붙임): CSS 움직임을 모두 멈추고 반복 영상을 숨김.
   자바스크립트가 없으면(html.js 없음) 단추가 안 보이므로 기기 설정(움직임 줄이기)을 따름 */
html.still *,html.still *::before,html.still *::after{animation:none !important}
html.still .hero-video{display:none}
@media (prefers-reduced-motion: reduce){
  html:not(.js) *,html:not(.js) *::before,html:not(.js) *::after{animation:none !important}
}
