/* ──────────────────────────────────────────────────────────────
   index-cinematic.css — 다크-웜 시네마틱 히어로 + 스크롤 여정 (가산 레이어)
   기존 redesign.css 토큰 계승. 외부 CSS라 CSP(style-src 'self') 안전.
   MengTo web-design 스킬 방법론 적용(.omc/research/mengto-applied-patterns.md).
   ────────────────────────────────────────────────────────────── */

:root {
  --stage: #17110c;          /* warm near-black */
  --stage-2: #211812;
  --stage-ink: #F3E7D6;      /* 다크 위 텍스트 (웜 크림) */
  --stage-ink-2: rgba(243, 231, 214, 0.66);
  --stage-ink-3: rgba(243, 231, 214, 0.42);
  --glow: rgba(182, 90, 60, 0.55);   /* terracotta glow */
  --ease-cine: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── 모션 게이트 (progressive enhancement) ───────────────────────
   has-motion(=JS 활성)일 때만 리빌 대상 숨김 시작. 무JS=항상 보임. */
html.has-motion [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-cine), transform 0.9s var(--ease-cine), filter 0.9s var(--ease-cine);
}
html.has-motion [data-reveal="blur-in"] { filter: blur(10px); transform: translateY(18px); }
html.has-motion [data-reveal="scale"]   { transform: scale(0.965); }
html.has-motion [data-reveal="fade"]     { transform: none; }
[data-reveal].is-in { opacity: 1 !important; transform: none !important; filter: none !important; will-change: auto; }
/* 그룹 내 자식 stagger (JS가 --i 부여) */
html.has-motion [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s var(--ease-cine), transform 0.85s var(--ease-cine);
  transition-delay: calc(var(--i, 0) * 0.075s);
}
[data-reveal-group].is-in > * { opacity: 1 !important; transform: none !important; will-change: auto; }

@media (prefers-reduced-motion: reduce) {
  html.has-motion [data-reveal],
  html.has-motion [data-reveal-group] > * {
    opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important;
  }
}

/* ── 다크-웜 시네마틱 히어로 ─────────────────────────────────── */
.cine-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--stage);
  color: var(--stage-ink);
  isolation: isolate;
}
.cine-hero__media { position: absolute; inset: 0; z-index: -3; overflow: hidden; }
.cine-hero__video {
  position: absolute; inset: 0;
  width: 100%; height: 108%;           /* 살짝 크게 → 패럴랙스 여유 */
  object-fit: cover;
  object-position: center 32%;
  opacity: 0.62;
  /* will-change 미지정: GSAP scrub가 히어로 in-view 동안만 transform 관리(영구 레이어 승격 방지) */
}
/* 브랜드 온기: 테라코타 radial glow (atmosphere-background) */
.cine-hero__glow {
  position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60% 55% at 22% 30%, var(--glow) 0%, rgba(182,90,60,0) 60%),
    radial-gradient(50% 50% at 88% 78%, rgba(111,64,83,0.38) 0%, rgba(111,64,83,0) 62%);
  mix-blend-mode: screen;
  opacity: 0.9;
}
/* 가독 scrim (progressive-blur) — 좌하단 텍스트 대비 */
.cine-hero__scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(23,17,12,0.92) 0%, rgba(23,17,12,0.55) 42%, rgba(23,17,12,0.15) 72%, rgba(23,17,12,0) 100%),
    linear-gradient(0deg, rgba(23,17,12,0.85) 0%, rgba(23,17,12,0) 38%);
}
.cine-hero__inner {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 120px 40px 96px;
}
.cine-hero__kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--stage-ink-2);
  margin-bottom: 22px;
}
.cine-hero__kicker::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 14px 2px var(--glow);
  animation: cinePulse 2.6s ease-in-out infinite;
}
@keyframes cinePulse { 0%,100%{opacity:.5;transform:scale(.85)} 50%{opacity:1;transform:scale(1.15)} }
.cine-hero__title {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  max-width: 15ch;
}
.cine-hero__title .em { font-style: italic; color: #F0B79A; }
/* staggered word reveal (staggered-word-reveal 스킬) */
.cine-hero__title .wr-word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity 0.8s var(--ease-cine), transform 0.8s var(--ease-cine);
  transition-delay: calc(var(--word-index, 0) * 0.06s + 0.15s);
  will-change: opacity, transform;
}
html:not(.has-motion) .cine-hero__title .wr-word { opacity: 1; transform: none; }
.cine-hero__title.is-in .wr-word { opacity: 1; transform: none; will-change: auto; }
.cine-hero__rotator {
  min-height: 1.6em;
  margin: 20px 0 30px;
  font-size: clamp(15px, 2.1vw, 19px);
  line-height: 1.55;
  color: var(--stage-ink-2);
  max-width: 46ch;
}
.cine-hero__rotator .rot-mono {
  font-family: var(--mono);
  color: #E7A98A;
  transition: opacity 0.45s var(--ease-cine), transform 0.45s var(--ease-cine);
}
.cine-hero__rotator.is-swapping .rot-mono { opacity: 0; transform: translateY(-6px); }
.cine-hero__cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 6px; }
.cine-hero__cta .btn-accent {
  box-shadow: 0 10px 40px -12px var(--glow), 0 2px 0 rgba(0,0,0,0.2);
}
.cine-hero__cta .btn-stage {
  background: rgba(243, 231, 214, 0.08);
  color: var(--stage-ink);
  border: 1px solid rgba(243, 231, 214, 0.24);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.cine-hero__cta .btn-stage:hover { background: rgba(243, 231, 214, 0.14); }
.cine-hero__meta {
  display: flex; flex-wrap: wrap; gap: 12px 26px;
  margin-top: 34px;
  font-size: 13px; color: var(--stage-ink-2); /* 대비 확보(어두운 배경 위 4.5:1) */
}
.cine-hero__meta span { display: inline-flex; align-items: center; gap: 8px; }
.cine-hero__meta .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
/* 스크롤 큐 */
.cine-hero__cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--stage-ink-3);
}
.cine-hero__cue i {
  width: 1px; height: 42px;
  background: linear-gradient(var(--stage-ink-3), transparent);
  animation: cineCue 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cineCue { 0%{transform:scaleY(.2);opacity:.2} 50%{transform:scaleY(1);opacity:.9} 100%{transform:scaleY(.2);opacity:.2} }

/* 다크 → 크림 시각 핸드오프 (pure CSS, no-JS 안전) */
.cine-fade {
  height: 140px; margin-top: -1px;
  background: linear-gradient(180deg, var(--stage) 0%, var(--stage-2) 24%, var(--paper) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .cine-hero__kicker::before, .cine-hero__cue i { animation: none; }
  .cine-hero__video { opacity: 0.5; }
}
@media (max-width: 767px) {
  .cine-hero { min-height: 92vh; min-height: 92svh; }
  .cine-hero__inner { padding: 100px 22px 84px; }
  .cine-hero__video { object-position: center 28%; opacity: 0.5; }
  .cine-hero__scrim { background:
    linear-gradient(0deg, rgba(23,17,12,0.94) 0%, rgba(23,17,12,0.35) 46%, rgba(23,17,12,0.12) 100%); }
  .cine-hero__cta { width: 100%; }
  .cine-hero__cta .btn { flex: 1 1 auto; justify-content: center; }
  .cine-hero__cue { display: none; }
}

/* ════════════════════════════════════════════════════════════════
   섹션별 시네마틱 스크롤 모션 (MengTo 스킬 방법론, 디자인패널+크리틱 채택본)
   — 아래 프리셋 규칙은 기존 [data-reveal-group] 블록 '뒤'라 동일 특이도 tie를 이김
   ════════════════════════════════════════════════════════════════ */

/* ── #interview: 면접관 카드 마스크 언베일 ── */
html.has-motion #interview .iv-grid[data-reveal-group] > .iv-card{
  clip-path: inset(0 0 26% 0 round var(--r-lg));
  transform: translateY(26px) scale(.965);
  transition: opacity .85s var(--ease-cine), transform .9s var(--ease-cine),
              clip-path .9s var(--ease-cine),
              box-shadow .28s var(--ease-cine), border-color .28s var(--ease-cine);
  transition-delay: calc(var(--i,0) * .09s);
  will-change: opacity, transform, clip-path;
}
#interview .iv-grid[data-reveal-group].is-in > .iv-card{ clip-path: inset(0 0 0 0 round var(--r-lg)) !important; will-change: auto; }
@media (prefers-reduced-motion: reduce){
  html.has-motion #interview .iv-grid > .iv-card{ clip-path:none !important; transition:none !important; }
}
/* 초상 3D 틸트 + 부드러운 하이라이트(데스크톱 포인터 전용) */
#interview .iv-video-wrap{ transform-style: preserve-3d; transition: transform .42s var(--ease-cine); }
#interview .iv-video-wrap::after{
  content:""; position:absolute; inset:0; z-index:2; pointer-events:none;
  background: radial-gradient(40% 44% at var(--mx,50%) var(--my,25%), rgba(240,183,154,.22) 0%, rgba(240,183,154,0) 62%);
  opacity:0; transition:opacity .4s var(--ease-cine);
}
@media (hover:hover) and (pointer:fine){
  #interview .iv-card.is-tilt{ box-shadow: var(--shadow-2); border-color: rgba(182,90,60,.35); }
  #interview .iv-card.is-tilt .iv-video-wrap::after{ opacity:.35; }
}
@media (prefers-reduced-motion: reduce){
  #interview .iv-video-wrap{ transform:none !important; }
  #interview .iv-video-wrap::after{ opacity:0 !important; }
}
/* flow 진행 라인 (입장→질문→꼬리질문→리포트) */
#interview .iv-flow{ position: relative; }
#interview .iv-flow::before{
  content:""; position:absolute; top:0; left:0; z-index:2; height:2px; width:100%;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(182,90,60,.15) 100%);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 1s var(--ease-cine) .1s;
}
#interview .iv-flow.is-in::before{ transform: scaleX(1); }
html:not(.has-motion) #interview .iv-flow::before{ transform: scaleX(1); }
@media (prefers-reduced-motion: reduce){ #interview .iv-flow::before{ transition:none !important; } }

/* ── #features + Capabilities 카드: 마스크 라이즈 + 인덱스 accent 틱 ── */
html.has-motion [data-reveal-preset="cards"] > *{
  transform: translateY(30px) scale(.985);
  clip-path: inset(0 0 26px 0 round 16px);
  transition: opacity .85s var(--ease-cine), transform .85s var(--ease-cine),
              clip-path .9s var(--ease-cine),
              box-shadow .28s var(--ease-cine), border-color .28s var(--ease-cine);
  transition-delay: calc(var(--i,0) * .075s);
}
html.has-motion [data-reveal-preset="cards"].is-in > *{ clip-path: inset(-100px round 16px) !important; }
@media (prefers-reduced-motion: reduce){
  html.has-motion [data-reveal-preset="cards"] > *{ clip-path:none !important; transition:none !important; }
}
[data-reveal-preset="cards"] .num{ position: relative; }
[data-reveal-preset="cards"] .num::after{
  content:""; position:absolute; left:0; bottom:-6px; width:26px; height:2px; border-radius:2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transform: scaleX(1); transform-origin: left center;
}
html.has-motion [data-reveal-preset="cards"] > * .num::after{
  transform: scaleX(0); transition: transform .65s var(--ease-cine); transition-delay: calc(var(--i,0)*.075s + .28s);
}
html.has-motion [data-reveal-preset="cards"].is-in > * .num::after{ transform: scaleX(1); }
@media (prefers-reduced-motion: reduce){
  html.has-motion [data-reveal-preset="cards"] > * .num::after{ transform:scaleX(1) !important; transition:none !important; }
}

/* ── 2단계 시작하기: 스텝 커넥터 draw (진입 1회, 데스크톱) ── */
.steps{ position: relative; }
.steps::after{
  content:""; position:absolute; z-index:1; pointer-events:none;
  left:40px; top:58px; width:38%; height:2px; border-radius:2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 78%, rgba(232,201,180,0) 100%);
  transform: scaleX(1); transform-origin: left center;
}
html.has-motion .steps::after{ transform: scaleX(0); transition: transform .9s var(--ease-cine) .1s; }
html.has-motion .steps.is-in::after{ transform: scaleX(1); }
@media (max-width:767px){ .steps::after{ display:none; } }
@media (prefers-reduced-motion: reduce){ html.has-motion .steps::after{ transform:scaleX(1) !important; transition:none !important; } }

/* (스킬 카드 스태거/타이핑 와이프는 <details> 래퍼의 IntersectionObserver 미발화 문제로 제외 —
   스킬 목록은 항상 정상 노출 유지. 다른 섹션 모션으로 충분히 화려함 확보.) */

/* ── 데이터소스 콘솔: 라인 프린트 (스크롤 진입 게이트) ── */
html.has-motion .ds-console.is-in .ds-panel.is-active li{
  opacity:0; animation: dsLineIn .5s var(--ease-cine) forwards; animation-delay: calc(var(--li,0)*.055s + .12s);
}
html.has-motion .ds-console.is-in .ds-panel.is-active .out{
  opacity:0; animation: dsLineIn .5s var(--ease-cine) forwards; animation-delay:.5s;
}
@keyframes dsLineIn{ from{ opacity:0; transform:translateY(6px) } to{ opacity:1; transform:none } }
@media (prefers-reduced-motion: reduce){ .ds-console .ds-panel.is-active li, .ds-console .ds-panel.is-active .out{ opacity:1 !important; animation:none !important; } }

/* ── 데모 텔레그램 말풍선 순차 팝 (질문→답변) ── */
html.has-motion #demo .grid-3 .tg .bubble{ opacity:0; transform: translateY(10px) scale(.985); }
html.has-motion #demo .grid-3.is-in .tg .bubble{ animation: tgBubble .5s var(--ease-cine) both; }
html.has-motion #demo .grid-3.is-in .tg .bubble.me{ animation-delay: calc(var(--i,0)*.09s + .3s); }
html.has-motion #demo .grid-3.is-in .tg .bubble.bot{ animation-delay: calc(var(--i,0)*.09s + .78s); }
@keyframes tgBubble{ from{ opacity:0; transform:translateY(10px) scale(.985) } to{ opacity:1; transform:none } }
@media (prefers-reduced-motion: reduce){ html.has-motion #demo .grid-3 .tg .bubble{ opacity:1 !important; transform:none !important; animation:none !important; } }

/* ── Before/After: AFTER 패널 좌→우 클립 와이프 ── */
html.has-motion .ba .ba-side.after{
  clip-path: inset(0 100% 0 0); transition: clip-path .85s var(--ease-cine); transition-delay:.15s;
}
.ba.is-in .ba-side.after{ clip-path: inset(0 0 0 0) !important; }
@media (hover:hover){ .ba.is-in:hover{ transform: translateY(-3px) !important; } }
@media (prefers-reduced-motion: reduce){ html.has-motion .ba .ba-side.after{ clip-path:none !important; transition:none !important; } }

/* ── 리빌 후 hover 리프트 복구 (group is-in transform:none !important이 죽이는 것 되살림) ── */
@media (hover:hover){
  .rv-grid.is-in > .rv:hover{ transform: translateY(-3px) !important; }
  [data-reveal-group].is-in > .card:hover,
  [data-reveal-group].is-in > .tg:hover{ transform: translateY(-3px) !important; }
}

/* ── 다크 Support CTA: scale-in + terracotta glow 하단 개화 ── */
.dark-cta{ position:relative; overflow:hidden; isolation:isolate; }
.dark-cta > *{ position:relative; z-index:1; }
html.has-motion .dark-cta::before{
  content:""; position:absolute; z-index:0; inset:-20%;
  background: radial-gradient(45% 42% at 50% 116%, var(--glow) 0%, rgba(182,90,60,0) 70%);
  mix-blend-mode:screen; pointer-events:none; opacity:0; transform:scale(.85); transform-origin:50% 100%;
  transition: opacity 1s var(--ease-cine), transform 1.2s var(--ease-cine); transition-delay:.15s;
}
html.has-motion .dark-cta.is-in::before{ opacity:1 !important; transform:scale(1) !important; }
@media (prefers-reduced-motion: reduce){ html.has-motion .dark-cta::before{ opacity:1 !important; transform:none !important; transition:none !important; } }
