/* 06 · 키네틱 타이포그래피 — 먹과 종이, 인주 하나 */
:root {
  --paper: #f2eee5;
  --paper-2: #e9e4d8;
  --ink: #0e0e0d;
  --ink-2: #3a3936;
  --ink-3: #7c786f;
  --hair: rgba(14, 14, 13, .22);
  --seal: #b8241c;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", serif;
  --han: "Noto Serif TC", "Noto Serif KR", serif;
  --sans: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --gut: clamp(16px, 3.2vw, 48px);
  --mast: 56px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.75 var(--serif); word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
a { color: inherit; }
h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--paper); }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; font: 500 14px var(--sans); text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
main:focus { outline: none; }

.rule-b { border-bottom: 1px solid var(--hair); }
.rule-t { border-top: 1px solid var(--hair); }
.sec-num, .kicker, .pillar-num, .note, .hero-meta, .cue, .tier-count, .journal-foot {
  font: 500 12px/1.4 var(--sans); letter-spacing: .14em; color: var(--ink-3);
}

/* ---------- 상단 ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(var(--sp, 0)); }
.mast {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--mast);
  display: flex; align-items: center; gap: 24px; padding: 0 var(--gut);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 17px var(--serif); letter-spacing: .04em; }
.seal {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 3px;
  background: var(--seal); color: var(--paper); font: 900 16px/1 var(--han);
}
.mast-nav { display: flex; gap: 22px; margin-left: auto; }
.mast-nav a, .motion-toggle { font: 500 13px var(--sans); letter-spacing: .08em; text-decoration: none; color: var(--ink-2); }
.mast-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }
.motion-toggle { background: none; border: 1px solid var(--hair); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.motion-toggle:hover { border-color: var(--ink); color: var(--ink); }
.mast-cta { font: 500 13px var(--sans); letter-spacing: .08em; text-decoration: none; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 2px; }
.mast-cta:hover { background: var(--seal); }

.btn {
  display: inline-flex; align-items: center; gap: 12px; padding: 15px 24px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font: 700 16px var(--serif); letter-spacing: .04em; border-radius: 2px;
  transition: background .2s;
}
.btn:hover { background: var(--seal); }
.link { font: 500 14px var(--sans); letter-spacing: .06em; text-underline-offset: 6px; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }

/* ---------- 1. 무대 (墨 → 流·緣·記) ---------- */
.stage { position: relative; }
.stage-pin { position: relative; }
.ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; display: none; }
.ink path { fill: var(--ink); stroke: var(--ink); stroke-linejoin: round; }

.slot { position: relative; aspect-ratio: 1; }
.glyph { position: absolute; inset: 0; display: grid; place-items: center; font: 900 calc(var(--gs, 300px)) / 1 var(--han); color: var(--ink); container-type: size; }
.slot { container-type: inline-size; }
.slot .glyph { font-size: 100cqw; line-height: 1; }

.hero {
  min-height: 100svh; padding: calc(var(--mast) + 0px) var(--gut) 28px;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto 1fr auto; column-gap: 20px;
}
.hero-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; padding: 14px 0 12px; }
.hero-copy { grid-column: 1 / span 6; grid-row: 2; align-self: end; padding-bottom: 6vh; position: relative; z-index: 3; }
.kicker { margin-bottom: 26px; display: flex; align-items: center; gap: 12px; }
.kicker::before { content: ""; width: 36px; height: 1px; background: var(--ink); }
h1 {
  font: 900 clamp(2.3rem, 5.4vw, 5.6rem) / 1.12 var(--serif); letter-spacing: -.035em;
}
.hero-sub { margin: 28px 0 34px; max-width: 30em; font-size: clamp(1rem, 1.25vw, 1.15rem); color: var(--ink-2); }
.slot-hero { grid-column: 7 / -1; grid-row: 2; align-self: center; justify-self: end; width: min(100%, calc(100svh - var(--mast) - 150px)); }
.cue { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 14px; }
.cue-line { width: 64px; height: 1px; background: var(--ink); transform-origin: 0 50%; animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleX(0); } 50% { transform: scaleX(1); } 100% { transform: scaleX(0); transform-origin: 100% 50%; } }

.pillars { padding: calc(var(--mast) + 0px) var(--gut) 40px; min-height: 100svh; display: flex; flex-direction: column; }
.pillars-head { display: flex; align-items: baseline; gap: 24px; padding: 14px 0 12px; }
.pillars-head h2 { font: 900 clamp(1.1rem, 1.6vw, 1.5rem) / 1.3 var(--han); letter-spacing: .1em; }
.pillars-head .arrow { color: var(--seal); font-family: var(--sans); font-weight: 400; }
.h2-ko { font: 500 12px var(--sans); letter-spacing: .14em; color: var(--ink-3); margin-left: 12px; vertical-align: middle; }
.pillar-list { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; }
.pillar { padding: 0 clamp(12px, 2.2vw, 36px); border-left: 1px solid var(--hair); height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.pillar:first-child { border-left: 0; padding-left: 0; }
.pillar .slot { width: min(100%, 44svh); }
.pillar-num { margin-bottom: 10px; }
.pillar h3 { font: 900 clamp(1.25rem, 1.8vw, 1.75rem) / 1.3 var(--serif); letter-spacing: -.02em; margin-bottom: 10px; }
.pillar-copy p:last-child { color: var(--ink-2); font-size: 15.5px; line-height: 1.7; max-width: 26em; }

/* 모션 모드: 무대를 고정하고 두 장면을 겹친다 */
.motion .stage { height: 440vh; }
.motion .stage-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.motion .hero, .motion .pillars { position: absolute; inset: 0; min-height: 0; }
.motion .ink { display: block; }
.motion .slot .glyph { opacity: 0; }
.motion .pillars-head, .motion .pillar-copy { opacity: 0; }
.motion .pillar { border-color: rgba(14, 14, 13, calc(.22 * var(--pv, 0))); }
.motion .hero-copy, .motion .hero-meta, .motion .cue, .motion .pillars-head, .motion .pillar-copy { will-change: transform, opacity; }

/* 획 그리기 (페이지 로드 시 1회) */
.ink .src path { stroke-width: 10; fill-opacity: 0; stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.ink.drawn .src path { animation: draw .75s cubic-bezier(.6,.05,.3,1) var(--d) forwards, flood .55s ease-out calc(var(--d) + .42s) forwards; }
.ink.done .src path { animation: none; fill-opacity: 1; stroke-dashoffset: 0; stroke-width: 0; }
.ink .tgt path { stroke-width: 0; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes flood { to { fill-opacity: 1; stroke-width: 0; } }

/* ---------- 섹션 공통 ---------- */
.sec-head { display: grid; grid-template-columns: 120px 1fr auto; align-items: baseline; gap: 16px; padding: 14px 0 12px; }
.sec-head h2 { font: 900 clamp(1.4rem, 2.4vw, 2.2rem) / 1.25 var(--serif); letter-spacing: -.02em; }
.note { text-align: right; }

/* ---------- 2. 일지 ---------- */
.journal { position: relative; padding: 0 var(--gut); }
.journal-pin { min-height: 100svh; padding: calc(var(--mast) + 8px) 0 32px; display: flex; flex-direction: column; }
.motion .journal { height: 280vh; }
.motion .journal-pin { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.entry { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 1100px; margin: 0 auto; width: 100%; padding: 4vh 0; }
.entry-chapter { font: 400 clamp(.95rem, 1.2vw, 1.1rem) var(--serif); letter-spacing: .3em; color: var(--ink-2); margin-bottom: 14px; }
.entry-title { font: 900 clamp(2rem, 5vw, 4.6rem) / 1.15 var(--serif); letter-spacing: -.03em; margin-bottom: clamp(20px, 4vh, 48px); }
.entry-body { font: 300 clamp(1.15rem, 2.05vw, 1.9rem) / 1.85 var(--serif); letter-spacing: -.01em; max-width: 36em; }
.entry b { font-weight: inherit; }
.journal-foot { display: flex; gap: 12px; align-items: center; }
.journal-foot span { font: 900 20px var(--han); color: var(--ink); letter-spacing: 0; }

/* 분할 글자 */
.split-w { display: inline-block; white-space: nowrap; }
.split-c { display: inline-block; will-change: transform, opacity; }
.kw { position: relative; display: inline-block; }
.kw-heavy {
  position: absolute; inset: 0; display: flex; justify-content: center; white-space: nowrap;
  font-weight: 900; opacity: 0; transform: scale(.9); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.kw-base { display: inline-block; transition: opacity .6s ease; }
.kw::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: .08em; height: .14em; background: var(--ink);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .7s cubic-bezier(.7,0,.2,1) .15s;
}
.kw-red::after, .kw-red .kw-heavy { background: none; }
.kw-red .kw-heavy { color: var(--seal); }
.kw-red::after { background: var(--seal); }
.kw.on .kw-heavy { opacity: 1; transform: scale(1.06); }
.kw.on .kw-base { opacity: 0; }
.kw.on::after { transform: scaleX(1); }
.static .kw .kw-heavy { opacity: 1; transform: none; transition: none; }
.static .kw .kw-base { opacity: 0; }
.static .kw::after { transform: scaleX(1); transition: none; }

/* ---------- 3. 플레이 ---------- */
.play { padding: calc(var(--mast) + 40px) var(--gut) 14vh; overflow: hidden; }
.marquee { margin: 6vh calc(var(--gut) * -1) 4vh; white-space: nowrap; overflow: hidden; }
.marquee-line {
  display: inline-block; font: 900 clamp(3.4rem, 11vw, 11rem) / 1.05 var(--serif); letter-spacing: -.045em;
  transform: translateX(calc(var(--mq, 0) * -38%));
}
.marquee-line i { font-style: normal; color: var(--seal); font-weight: 300; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.step { padding: 26px clamp(14px, 2vw, 32px) 10px; border-left: 1px solid var(--hair); }
.step:first-child { border-left: 0; padding-left: 0; }
.step-n { display: block; font: 900 clamp(4.5rem, 9vw, 9rem) / .9 var(--serif); letter-spacing: -.06em; margin-bottom: 24px; -webkit-text-stroke: 1.5px var(--ink); color: transparent; }
.step h3 { font: 900 clamp(1.25rem, 1.8vw, 1.7rem) / 1.3 var(--serif); margin-bottom: 8px; }
.step p { color: var(--ink-2); }

/* ---------- 4. 수련 경지 ---------- */
.ladder { position: relative; padding: 0 var(--gut); background: var(--paper-2); }
.ladder-pin { padding: calc(var(--mast) + 8px) 0 32px; min-height: 100svh; display: flex; flex-direction: column; }
.ladder-body { flex: 1; position: relative; display: grid; grid-template-columns: 160px 1fr 160px; align-items: center; }
.tier-index { font: 500 13px/2.3 var(--sans); letter-spacing: .1em; color: var(--ink-3); counter-reset: t; display: none; }
.tier-index li { counter-increment: t; transition: color .3s; }
.tier-index li::before { content: counter(t, decimal-leading-zero) "  "; }
.tier-index li.on { color: var(--ink); }
.tier-index li.on::after { content: " —"; }
.tier-count { display: none; text-align: right; align-self: end; }
.tier-count b { font: 900 clamp(2.4rem, 4vw, 3.6rem) var(--serif); color: var(--ink); letter-spacing: -.04em; }

/* 정적 상태: 위로 갈수록 커지고 짙어지는 사다리 */
.tiers { grid-column: 1 / -1; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 4px; padding: 5vh 0; }
.tier {
  --f: calc(.42 + var(--i) * .083);
  position: relative; display: flex; align-items: baseline; gap: .25em;
  font: 300 calc((1.6rem + 6.4vw) * var(--f)) / 1.05 var(--serif); letter-spacing: -.05em;
  color: color-mix(in srgb, var(--ink) calc(38% + var(--i) * 9%), var(--paper-2));
}
.tier:nth-child(n+3) { font-weight: 400; }
.tier:nth-child(n+5) { font-weight: 700; }
.tier:nth-child(n+7) { font-weight: 900; }
.tier-han { font: 900 .26em var(--han); letter-spacing: .1em; order: 2; color: var(--ink-3); }
.tier-ko { position: relative; }
.stamp {
  position: absolute; right: -.8em; top: -.12em; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 1.5em; height: 2.7em; font: 900 .19em/1.1 var(--han); letter-spacing: 0;
  color: var(--paper); background: var(--seal); border-radius: .14em; transform: rotate(-7deg);
}

.motion .ladder { height: 520vh; }
.motion .ladder-pin { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.motion .tier-index, .motion .tier-count { display: block; }
.motion .tiers { grid-column: 2; position: relative; height: 100%; display: block; padding: 0; }
.motion .tier {
  position: absolute; inset: 0; margin: auto; flex-direction: column; align-items: center; justify-content: center; gap: .1em;
  --f: calc(.5 + var(--i) * .08);
  font-size: min(calc((3rem + 12vw) * var(--f)), calc(30vw / (1 + var(--wide, 0) * .34)), 38svh);
  opacity: 0; will-change: transform, opacity; text-align: center;
}
.motion .tier-han { order: -1; font-size: .16em; letter-spacing: .5em; margin-right: -.5em; }
.motion .tier:nth-child(5), .motion .tier:nth-child(8) { --wide: 1; }
.motion .stamp { transform: rotate(-7deg) scale(calc(1.6 - var(--st, 0) * .6)); opacity: var(--st, 0); }

/* ---------- 5. CTA ---------- */
.cta { padding: 18vh var(--gut) 10vh; overflow: hidden; }
.cta-giant { display: block; text-decoration: none; margin: 4vh 0 8vh; }
.cta-line { display: block; font: 900 clamp(4.2rem, 17.5vw, 17rem) / .98 var(--serif); letter-spacing: -.06em; white-space: nowrap; }
.cta-line-2 { padding-left: 12vw; }
.cta-arrow { display: inline-block; color: var(--seal); font-weight: 300; margin-left: .1em; transition: transform .3s; }
.cta-giant:hover .cta-arrow, .cta-giant:focus-visible .cta-arrow { transform: translateX(.15em); }
.cta-giant:hover .cta-line { color: var(--ink-2); }
.L { display: inline-block; }
.cta-foot { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 26px; flex-wrap: wrap; }
.cta-foot > p { color: var(--ink-2); max-width: 28em; }

.foot { margin: 0 var(--gut); padding: 34px 0 48px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.foot-line { font: 700 clamp(1.1rem, 2vw, 1.6rem) var(--serif); letter-spacing: -.02em; }
.foot-meta { display: flex; align-items: center; gap: 10px; font: 500 13px var(--sans); color: var(--ink-3); letter-spacing: .08em; }
.foot-meta .seal { width: 22px; height: 22px; font-size: 13px; }

/* ---------- 스크롤 구동 애니메이션 (지원 브라우저) ---------- */
@supports (animation-timeline: view()) {
  .motion.sda .progress span { animation: grow linear both; animation-timeline: scroll(root); }
  .motion.sda .rv { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
  .motion.sda .marquee-line { animation: slide linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  .motion.sda .cta-giant .L { animation: letter linear both; animation-timeline: view(); animation-range: entry calc(var(--k) * 4%) cover calc(30% + var(--k) * 3%); }
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { transform: translateX(6%); } to { transform: translateX(-38%); } }
@keyframes letter { from { opacity: 0; transform: translateY(.55em) rotate(8deg) scale(.7); } to { opacity: 1; transform: none; } }

/* 폴백: IntersectionObserver가 .in을 붙인다 */
.motion.no-sda .rv { opacity: 0; transform: translateY(48px); transition: opacity .9s ease, transform 1s cubic-bezier(.2,.8,.2,1); }
.motion.no-sda .rv.in { opacity: 1; transform: none; }
.motion.no-sda .cta-giant .L { opacity: 0; transform: translateY(.55em) rotate(8deg) scale(.7); transition: opacity .7s ease calc(var(--k) * 45ms), transform .9s cubic-bezier(.2,.8,.2,1) calc(var(--k) * 45ms); }
.motion.no-sda .cta-giant.in .L { opacity: 1; transform: none; }

/* 정적(모션 끔) */
.static .marquee-line { transform: none; }
.static .cue-line { animation: none; transform: none; }
.static .progress { display: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cue-line { animation: none; }
  .rv, .L, .marquee-line { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- 반응형 ---------- */
@media (max-width: 980px) {
  .mast-nav { display: none; }
  .motion-toggle { margin-left: auto; }
  .sec-head { grid-template-columns: 1fr; gap: 4px; }
  .note { text-align: left; }
  .ladder-body { grid-template-columns: 1fr; }
  .motion .tiers { grid-column: 1; }
  .motion .tier-index { position: absolute; left: 0; bottom: 0; line-height: 2; font-size: 11px; }
  .motion .tier-count { position: absolute; right: 0; bottom: 0; }
}
@media (max-width: 760px) {
  :root { --mast: 52px; }
  body { font-size: 16px; }
  .hide-sm { display: none; }
  .mast { gap: 10px; }
  .brand { font-size: 15px; }
  .motion-toggle, .mast-cta { font-size: 12px; padding: 6px 10px; letter-spacing: .04em; }
  .hero { grid-template-rows: auto 1fr auto auto; }
  .slot-hero { grid-column: 1 / -1; grid-row: 2; justify-self: center; width: min(88vw, 46svh); align-self: center; }
  .hero-copy { grid-column: 1 / -1; grid-row: 3; padding-bottom: 2svh; }
  .kicker { margin-bottom: 14px; }
  h1 { font-size: clamp(2rem, 9.4vw, 2.6rem); }
  .hero-sub { margin: 16px 0 20px; font-size: 15px; line-height: 1.7; }
  .btn { padding: 13px 18px; font-size: 15px; }
  .cue { display: none; }
  .pillars-head { flex-wrap: wrap; gap: 4px 14px; }
  .h2-ko { margin-left: 0; }
  .pillar-list { grid-template-columns: 1fr; align-content: space-evenly; }
  .pillar { flex-direction: row; align-items: center; border-left: 0; border-top: 1px solid var(--hair); padding: 12px 0; gap: 16px; height: auto; }
  .pillar:first-child { border-top: 0; }
  .pillar .slot { width: 27vw; flex: none; }
  .pillar h3 { font-size: 1.1rem; margin-bottom: 4px; }
  .pillar-num { margin-bottom: 4px; font-size: 11px; }
  .pillar-copy p:last-child { font-size: 13.5px; line-height: 1.6; }
  .steps { grid-template-columns: 1fr; }
  .step { border-left: 0; border-top: 1px solid var(--hair); padding: 20px 0; display: grid; grid-template-columns: auto 1fr; column-gap: 18px; }
  .step:first-child { border-top: 0; }
  .step-n { grid-row: span 2; margin: 0; font-size: 4rem; }
  .entry-chapter { letter-spacing: .2em; }
  .cta-line-2 { padding-left: 0; }
  .cta { padding-top: 12vh; }
}

/* 시안 전시관 돌아가기 탭(shared/gallery-return.js)이 상단 버튼과 겹치지 않도록 */
@media (max-width: 600px) { :root { --gallery-return-left: 170px; } }
