/* =====================================================================
   home-hero.css — 홈 첫 화면 "새벽 세 시 → 밤 열 시" 이야기 + 책 넘김 (2026-11-01, 시안 docs/design/home_book_open_mock.html)
   - 움직임은 js/home/home-hero.js (내리는 만큼: 자막 한 줄씩 · 선생님 → 토끼 → 퀘스 · 교재 표지가 열리고 넘어감 · 네 장이 벌어짐)
   - 이름이 겹치지 않게 모두 .hs- 로 시작, 규칙은 .hd .hs 안에서만
   - 어두운 바탕 글자색은 홈의 다른 어두운 절(css/home-story.css .sec.dark)과 같은 값 (#c9d1db · #5cb6f0 · #8293a8)
   ===================================================================== */
.hd .hs { --pw: 300px; --ph: calc(var(--pw) * 297 / 210); height: 380vh; position: relative; background: var(--ink); }
.hd .hs-hero { position: sticky; top: 0; height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: 32px; padding: 48px 64px; overflow: hidden; background: var(--ink); --t: 0; }

/* 글: 한 번에 한 줄씩 — 공간 안쪽에서 다가와 또렷해지고, 다음 줄이 오면 앞으로 지나감 (--k: 0 멀리 → 1 제자리 → 2 지나감) */
.hd .hs-copy { position: relative; height: 100%; perspective: 900px; perspective-origin: 30% 50%; }
.hd .hs-clk { position: absolute; left: 0; top: 18%; font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: 2px; font-variant-numeric: tabular-nums; color: #5cb6f0; }
.hd .hs-clk::after { content: ''; display: inline-block; width: 48px; height: 1px; background: currentColor; margin-left: 16px; vertical-align: middle; opacity: .5; }
.hd .hs-ln { position: absolute; left: 0; right: 0; top: 50%; transform-origin: 0 50%; will-change: transform, opacity, filter;
  --k: 0; --in: min(1, var(--k)); --out: max(0, calc(var(--k) - 1));
  opacity: calc(var(--in) - var(--out) * 1.6);
  filter: blur(calc((1 - var(--in)) * 10px + var(--out) * 6px));
  transform: translateY(-50%) translate3d(calc(var(--out) * -60px), calc(var(--out) * -40px), calc((1 - var(--in)) * -420px + var(--out) * 260px)) rotateY(calc((1 - var(--in)) * 16deg)); }
.hd .hs-ln h1, .hd .hs-ln p { margin: 0; font-size: 42px; font-weight: 900; line-height: 1.25; letter-spacing: -0.035em; word-break: keep-all; color: var(--bg); }
.hd .hs-ln .hs-who { display: block; margin-bottom: 16px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 2.5px; color: #5cb6f0; }
.hd .hs-ln h1 { color: var(--bg); }
.hd .hs-ln p.hs-s { margin-top: 16px; font-size: 22px; font-weight: 700; line-height: 1.5; letter-spacing: -0.02em; color: #c9d1db; }
.hd .hs-ln .hs-cta { margin-top: 32px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.hd .hs-ln .hs-lnk { background: none; border: 0; padding: 0; font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; color: var(--bg); }
.hd .hs-ln:not(.on) .hs-cta { pointer-events: none; }

/* 책상 = 이야기 캐릭터 + 책 */
.hd .hs-desk { position: relative; height: calc(var(--ph) + 64px); display: flex; align-items: center; justify-content: center; perspective: 2200px; }
.hd .hs-desk::before { content: ''; position: absolute; left: 50%; top: 50%; width: 140%; height: 120%; transform: translate(-50%, -45%); background: radial-gradient(ellipse 45% 40% at 50% 55%, rgba(255,255,255,.10), transparent 70%); pointer-events: none; }
/* 이야기 캐릭터 한 자리 (--o 보임 0~1, --x 옆으로 나감 — JS가 스크롤로) */
.hd .hs-cast { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.hd .hs-cast .hs-c { position: absolute; left: 50%; bottom: 0; height: calc(var(--ph) * 1.05); width: auto; opacity: var(--o, 0);
  transform: translateX(-50%) translateX(var(--x, 0px)) translateY(calc((1 - var(--o, 0)) * 16px)); filter: drop-shadow(0 16px 24px rgba(0,0,0,.5)); }
.hd .hs-cast .hs-leave { left: 0; height: calc(var(--ph) * .55); transform: scaleX(-1) translateX(var(--x, 0px)); }

/* 3D 틸트 — 마우스 쪽으로 책이 살짝 기욺 (--rx·--ry, JS) */
.hd .hs-tilt { position: relative; opacity: var(--bk, 0); transform-style: preserve-3d; transform: rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.hd .hs-book { pointer-events: none; position: relative; width: var(--pw); height: var(--ph); transform-style: preserve-3d; opacity: calc(1 - var(--q, 0) * 7);
  transform: translateX(calc(var(--pw) * -0.5)) rotateX(10deg) rotateY(-14deg); transition: transform .8s cubic-bezier(.3,.7,.2,1); }
.hd .hs-book.closed { transform: translateX(0) rotateX(14deg) rotateY(-24deg) rotateZ(2deg); }
.hd .hs-book.open { transform: translateX(calc(var(--pw) * 0.5)) rotateX(8deg) rotateY(0deg); }
.hd .hs-book::after { content: ''; position: absolute; left: -6%; right: -6%; bottom: -24px; height: 32px; background: radial-gradient(ellipse at center, rgba(0,0,0,.18), transparent 70%); transform: translateZ(-2px); opacity: .5; }
/* 맨 아래 쪽 + 책 두께 */
.hd .hs-base { position: absolute; inset: 0; background: var(--bg); box-shadow: 2px 0 0 #e9e6df, 4px 0 0 #dedad1, 6px 1px 0 #d4cfc4; }
.hd .hs-base img, .hd .hs-leaf img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.hd .hs-base::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 18%; background: linear-gradient(to right, rgba(0,0,0,.12), transparent); z-index: 2; pointer-events: none; }
/* 한 장 = 앞(오른쪽 쪽) + 뒤(넘기면 왼쪽 쪽) */
.hd .hs-leaf { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: left center; transition: transform .7s cubic-bezier(.45,.05,.25,1); }
.hd .hs-leaf.turn { transform: rotateY(-178deg); }
.hd .hs-leaf .hs-fr, .hd .hs-leaf .hs-bk { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
.hd .hs-leaf .hs-bk { transform: rotateY(180deg); }
/* 앞·뒷면: 넘김이 반쯤 지나면 앞면을 감추고 뒷면만 보임 — backface-visibility는 3D가 납작해지는 브라우저에서 앞면이 거울처럼 비쳐서 쓰지 않음 (2026-11-01) */
.hd .hs-leaf.turn .hs-fr, .hd .hs-leaf:not(.turn) .hs-bk { visibility: hidden; transition: visibility 0s .3s; }
.hd .hs-leaf .hs-fr, .hd .hs-leaf .hs-bk { transition: visibility 0s .3s; }
.hd .hs-leaf .hs-fr::after, .hd .hs-leaf .hs-bk::after { content: ''; position: absolute; inset: 0; pointer-events: none; transition: opacity 1.1s; }
.hd .hs-leaf .hs-fr::after { background: linear-gradient(to left, rgba(0,0,0,.25), transparent 60%); opacity: 0; }
.hd .hs-leaf.turn .hs-fr::after { opacity: 1; }
.hd .hs-leaf .hs-bk::after { background: linear-gradient(to left, rgba(0,0,0,.10), transparent 18%); }
.hd .hs-cover .hs-fr { border-radius: 0 3px 3px 0; box-shadow: inset 4px 0 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.12); }
.hd .hs-cover .hs-bk { background: #f4f1ea; }
.hd .hs-tag { position: absolute; left: 0; top: 8%; z-index: 3; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 700; padding: 4px 8px 4px 12px; }
.hd .hs-base .hs-tag { opacity: 0; transition: opacity .3s; }
.hd .hs-book.end .hs-base .hs-tag { opacity: 1; transition-delay: .8s; }
/* 퀘스핀 표지 (검은 바탕 + 퀘스) */
.hd .hs-qcover { position: absolute; inset: 0; background: var(--ink); color: var(--bg); overflow: hidden; container-type: inline-size; }
.hd .hs-qcover::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 46%; background: radial-gradient(ellipse 70% 60% at 50% 100%, rgba(10,132,214,.28), transparent 70%); }
.hd .hs-qc-top { position: absolute; left: 9%; top: 7%; display: flex; align-items: center; gap: 3cqw; font-weight: 900; font-size: 4cqw; letter-spacing: .3em; }
.hd .hs-qc-top img { width: 8cqw; height: 8cqw; object-fit: contain; filter: brightness(0) invert(1); }
.hd .hs-qc-ttl { position: absolute; left: 9%; right: 9%; top: 17%; z-index: 2; }
.hd .hs-qc-ttl b { display: block; margin-top: 3cqw; font-size: 12.5cqw; line-height: 1.12; font-weight: 900; letter-spacing: -.03em; }
.hd .hs-qc-ttl em { display: block; margin-top: 4cqw; font-style: normal; font-size: 3.6cqw; color: #5cb6f0; font-weight: 700; }
.hd .hs-qcover .hs-qc-fox { position: absolute; right: 4%; bottom: 7%; width: 46%; height: auto; object-fit: contain; filter: drop-shadow(0 2cqw 4cqw rgba(0,0,0,.6)); }
.hd .hs-qc-bot { position: absolute; left: 9%; right: 9%; bottom: 4.5%; display: flex; justify-content: space-between; border-top: 1px solid #2a3140; padding-top: 2.5cqw; font-size: 3.2cqw; color: #c9d1db; z-index: 2; }
.hd .hs-inside { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 12%; color: #3d3a33; }
.hd .hs-inside b { font-size: calc(var(--pw) * .055); font-weight: 900; }
.hd .hs-inside span { margin-top: 8px; font-size: calc(var(--pw) * .036); color: #7a756a; line-height: 1.6; }

/* 다 넘긴 뒤 네 장이 떠올라 벌어짐 (커버플로 — --q 0→1, --o 가운데에서 몇 칸) */
.hd .hs-stack { position: absolute; left: 50%; top: 50%; width: var(--pw); height: var(--ph); transform-style: preserve-3d; pointer-events: none;
  opacity: min(1, calc(var(--q, 0) * 7)); transform: translate(-50%, -50%) scale(calc(1 - var(--q, 0) * .22)); }
.hd .hs-stack.live { pointer-events: auto; }
.hd .hs-ly { position: absolute; inset: 0; background: var(--bg); transform-style: preserve-3d; cursor: pointer; outline: none;
  --s: clamp(-1, var(--o, 0), 1); --a: max(var(--o, 0), calc(var(--o, 0) * -1));
  transform: translateX(calc(var(--q, 0) * (var(--o, 0) * var(--pw) * .5 + var(--s) * var(--pw) * .28))) translateZ(calc(var(--q, 0) * (var(--a) * -90px - min(1, var(--a)) * 60px))) rotateY(calc(var(--q, 0) * var(--s) * -48deg));
  z-index: calc(10 - var(--a)); transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .5s;
  filter: brightness(calc(1 - var(--q, 0) * min(1, var(--a)) * .35));
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 calc(var(--q, 0) * 24px) calc(var(--q, 0) * 40px) rgba(0,0,0,.28); }
.hd .hs-ly:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
.hd .hs-stack.live .hs-ly { cursor: zoom-in; }
.hd .hs-ly > img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.hd .hs-ly.hs-cv { background: var(--ink); }
.hd .hs-ly .hs-lt { position: absolute; left: 0; top: 6%; z-index: 3; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--bg); background: var(--ink); padding: 4px 8px 4px 12px; }
.hd .hs-ly.hs-cv .hs-lt { display: none; }
.hd .hs-nav { position: absolute; left: 50%; bottom: calc(50% - var(--ph) * .5 * .78 - 56px); transform: translateX(-50%); display: flex; align-items: center; gap: 16px; opacity: calc((var(--q, 0) - .8) * 5); pointer-events: none; }
.hd .hs-stack.live ~ .hs-nav { pointer-events: auto; }
.hd .hs-nav button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: var(--bg); font: inherit; font-size: 15px; cursor: pointer; }
.hd .hs-nav button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.hd .hs-nav span { min-width: 120px; text-align: center; color: #c9d1db; font-size: 13px; font-weight: 700; }
.hd .hs-hint2 { position: absolute; left: 50%; bottom: calc(50% - var(--ph) * .5 * .78 - 88px); transform: translateX(-50%); white-space: nowrap; color: #8293a8; font-size: 13px; opacity: calc((var(--q, 0) - .8) * 5); pointer-events: none; }
.hd .hs-down { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); font-size: 13px; color: #8293a8; display: flex; flex-direction: column; align-items: center; gap: 8px; opacity: calc(1 - var(--t) * 1.4); }
.hd .hs-down i { width: 1px; height: 24px; background: currentColor; }

/* 크게 보기 창 */
.hs-zm { position: fixed; inset: 0; z-index: 200; background: rgba(5, 7, 12, .92); display: flex; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; opacity: 0; pointer-events: none; transition: opacity .25s; }
.hs-zm.on { opacity: 1; pointer-events: auto; }
.hs-zm .hs-pg { height: min(88vh, 1100px); aspect-ratio: 210 / 297; max-width: calc(100vw - 128px); background: var(--bg); box-shadow: 0 24px 64px rgba(0,0,0,.5); transform: scale(.94); transition: transform .25s; container-type: inline-size; position: relative; overflow: hidden; }
.hs-zm.on .hs-pg { transform: none; }
.hs-zm .hs-pg > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hs-zm button { width: 40px; height: 40px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: var(--bg); font: inherit; font-size: 18px; cursor: pointer; flex: none; }
.hs-zm button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.hs-zm .hs-x { position: absolute; top: 16px; right: 16px; }
.hs-zm .hs-cap { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: #c9d1db; font-size: 13px; font-weight: 700; }

/* 좁은 화면: 책이 위, 글이 아래 */
@media (max-width: 900px) {
  .hd .hs-hero { grid-template-columns: 1fr; grid-template-rows: auto 260px; align-content: center; padding: 32px 16px 48px; gap: 16px; }
  .hd .hs-desk { order: -1; }
  .hd .hs-cast .hs-c { height: calc(var(--ph) * 1.1); }
  .hd .hs-cast .hs-leave { display: none; }
  .hd .hs-copy { height: 260px; perspective: none; }
  .hd .hs-ln { top: 60%; filter: blur(calc((1 - var(--in)) * 6px)); transform: translateY(-50%) translateY(calc((1 - var(--in)) * 24px + var(--out) * -24px)); }
  .hd .hs-clk { top: 0; }
  .hd .hs-ln h1, .hd .hs-ln p { font-size: 22px; } .hd .hs-ln p br { display: none; }
  .hd .hs-ln h1 { color: var(--bg); }
.hd .hs-ln p.hs-s { margin-top: 8px; font-size: 15px; } .hd .hs-ln .hs-who { margin-bottom: 8px; }
  .hd .hs-ln .hs-cta { margin-top: 16px; gap: 16px; }
  .hd .hs-hint2 { display: none; }   /* "사진을 누르면 크게" 안내가 아래 시계와 겹침 — 좁은 화면은 빼고 화살표 단추만 */
}
@media (max-width: 600px) { .hs-zm { gap: 8px; padding: 64px 8px; } .hs-zm .hs-pg { max-width: calc(100vw - 112px); height: auto; width: calc(100vw - 112px); } .hs-zm button { width: 32px; height: 32px; } }
@media (prefers-reduced-motion: reduce) { .hd .hs-leaf, .hd .hs-book, .hd .hs-ly, .hd .hs-tilt, .hs-zm, .hs-zm .hs-pg { transition: none !important; } }
