/* gallery.css — 갤러리 모드 (gallery.js 와 함께 씀)
   1. 홈: 프로젝트 표지 썸네일이 가로로 한 줄. 휠·트랙패드·드래그·←→ 로 좌우 이동
   2. 썸네일을 클릭하거나 위에 잠시 머무르면, 썸네일이 화면 크기로 바뀌며 상하 스크롤 보기로
   슬라이드 자체의 디자인은 style.css 그대로 사용합니다. */

.gal {
    --bg: #eeeeee;                    /* 레퍼런스(rauno.me)처럼 밝은 회색 */
    --bg0: rgba(238, 238, 238, 0);
    --card: #ffffff;
    --tick: rgba(17, 18, 20, .3);
    --tick-strong: rgba(17, 18, 20, .6);
    --hover: rgba(17, 18, 20, .06);
    --shadow: rgba(0, 0, 0, .14);
    --fg: #111214;
    --dim: rgba(17, 18, 20, .5);
    --faint: rgba(17, 18, 20, .1);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --smart: cubic-bezier(.4, 0, .2, 1);   /* 피그마 스마트 애니메이트처럼 (gallery.js ZOOM_EASE 와 같게) */
    position: fixed; inset: 0;
    background: var(--bg); color: var(--fg);
    font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    font-size: 14px; line-height: 1.5;
    overflow: hidden;
}
.gal button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.gal p { margin: 0; }
.gal img { -webkit-user-drag: none; }
body.is-gallery .deck { display: none; }

/* ---------- 1. 홈 (가로 썸네일) ---------- */
.gal-home { position: absolute; inset: 0; display: flex; flex-direction: column; transition: opacity .5s ease .15s; }
/* 열릴 때: 고른 썸네일은 화면 크기로 바뀌고(gallery.js), 나머지는 양옆·위아래로 비켜나며 사라짐 */
.gal[data-mode="project"] .gal-home { opacity: 0; pointer-events: none; transition: opacity .45s ease .2s; }
.gal-item, .gal-head { transition: translate .8s var(--smart); }
.gal[data-mode="project"] .gal-item.is-before { translate: -35vw 0; }
.gal[data-mode="project"] .gal-item.is-after  { translate: 35vw 0; }
.gal[data-mode="project"] .gal-head { translate: 0 -24px; }
/* 닫히는 동안엔 보던 장이 썸네일 자리로 줄어드는 게 보이도록 상하 보기를 잠깐 남겨둠 */
.gal.is-leaving .gal-view { visibility: visible; pointer-events: none; overflow: hidden; }

.gal-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 32px; padding: 28px 36px 0; }
.gal-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.gal-role, .gal-contact { color: var(--dim); }
.gal-contact { text-align: right; font-variant-numeric: tabular-nums; }
.gal-head { position: relative; z-index: 3; }

/* 디자이너 더 보기 → 마우스를 올리면(또는 키보드로 고르면) 강점 카드가 펼쳐짐 */
.gal-about { position: relative; width: max-content; }
.gal-about-btn { display: inline-flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; font-weight: 600; line-height: 1.4; text-align: left; color: var(--fg); }
.gal-about-contact { font-size: 14px; line-height: 1.7; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gal-about-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.2; transition: transform .35s var(--ease); }
.gal-about:hover .gal-about-btn svg, .gal-about:focus-within .gal-about-btn svg { transform: rotate(45deg); }
.gal-about-pop {
    position: absolute; left: calc(100% + 20px); top: 50%;
    display: flex; gap: 24px; white-space: nowrap;
    opacity: 0; translate: -6px -50%; pointer-events: none;
    transition: opacity .25s ease, translate .35s var(--ease);
}
.gal-about-pop::before { content: ""; position: absolute; left: -20px; top: 0; bottom: 0; width: 20px; }   /* 버튼→연락처로 마우스를 옮겨도 닫히지 않게 */
.gal-about:hover .gal-about-pop, .gal-about:focus-within .gal-about-pop { opacity: 1; translate: 0 -50%; pointer-events: auto; }
.gal-about-lead { font-size: 15px; font-weight: 600; line-height: 1.5; margin-bottom: 16px !important; }
.gal-about-pop ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.gal-about-pop li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; row-gap: 2px; }
.gal-about-pop li::before { content: counter(s, decimal-leading-zero); grid-row: span 2; font-size: 12px; line-height: 1.6; color: var(--dim); font-variant-numeric: tabular-nums; }
.gal-about-pop li b { font-size: 14px; font-weight: 600; }
.gal-about-pop li span { font-size: 13px; line-height: 1.55; color: var(--dim); }

/* 썸네일 줄: 화면 세로 가운데. 좌우 위치와 크기(배율)는 gallery.js 가 transform 으로 */
.gal-strip {
    flex: 1; min-height: 0;
    display: flex; align-items: center;
    overflow: hidden; outline: none;
    cursor: grab; touch-action: pan-y;
}
.gal.is-dragging .gal-strip { cursor: grabbing; }
.gal-track { display: flex; gap: var(--gap); width: max-content; transform-origin: 0 50%; will-change: transform; }
.gal-item { flex: none; width: var(--iw); cursor: pointer; outline: none; }
.gal-thumb {
    position: relative; width: var(--iw); height: calc(var(--iw) * 9 / 16);
    border-radius: 10px; overflow: hidden; background: #000;
    box-shadow: 0 0 0 1px var(--faint);
    transform-origin: center; will-change: transform;
    transition: box-shadow .25s ease;
}
.gal-item:hover .gal-thumb, .gal-item:focus-visible .gal-thumb { box-shadow: 0 0 0 1px var(--tick); }
.gal-stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform: scale(var(--ts)); transform-origin: 0 0; pointer-events: none; }
.gal-stage > .slide { opacity: 1; visibility: visible; transition: none; }

/* 홈 배경: 지나가는 프로젝트의 표지를 크게 깔고 강하게 흐림 (진하기는 gallery.js) */
.gal-bgs { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.gal-bg { position: absolute; inset: 0; opacity: 0; filter: blur(90px) saturate(1.3); will-change: opacity; }
.gal-bg-stage { position: absolute; left: var(--bgx); top: var(--bgy); width: 1920px; height: 1080px; transform: scale(var(--bgs)); transform-origin: 0 0; }
.gal-bg-stage > .slide { opacity: 1; visibility: visible; transition: none; }
.gal-bg-stage [data-cover-detail] { visibility: hidden; }
.gal-bg-dim { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(238, 238, 238, .2) 0%, rgba(238, 238, 238, .75) 100%); }
.gal-head, .gal-strip { position: relative; }
.gal-strip { z-index: 1; }

/* 썸네일 위 작은 이름표 */
.gal-cap { margin: 0 0 4px; font-size: 12px; line-height: 1.4; color: var(--dim); white-space: nowrap; transform-origin: left bottom; transition: color .2s ease; }
.gal-no { margin-right: 8px; font-variant-numeric: tabular-nums; opacity: .7; }
.gal-item:hover .gal-cap { color: var(--fg); }

/* ---------- 2. 프로젝트 보기 (상하 스크롤) ---------- */
.gal-view {
    position: absolute; inset: 0; z-index: 2;
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    visibility: hidden; outline: none;
    scrollbar-width: thin; scrollbar-color: var(--tick) transparent;
}
.gal[data-mode="project"] .gal-view { visibility: visible; }
.gal-col { display: flex; flex-direction: column; align-items: center; gap: var(--vgap); padding: var(--padtop) 0 0; }
.gal-col[hidden] { display: none; }
.gal-frame {
    position: relative; flex: none;
    width: calc(1920px * var(--s)); height: calc(var(--h, 1080) * 1px * var(--s));   /* 높이는 대지마다 (data-h) */
    transform-origin: 0 0;          /* 썸네일 ↔ 화면 크기 전환 기준 */
    perspective: 1600px;
    transition: opacity .45s ease;
}
/* 마우스 반응 층: 표지만 커서 쪽으로 살짝 기울고 떠오름 (값은 gallery.js 가 넣음) */
.gal-tilt {
    position: absolute; inset: 0;
    border-radius: 0; overflow: hidden; background: #000;
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--lift, 1));
    transform-origin: center;
}
.gal-col > .gal-frame:first-child .gal-tilt { will-change: transform; border-radius: 10px 10px 0 0; }   /* 맨 위 장만 위쪽 모서리 둥글게 */
.gal-col > .gal-frame:nth-last-child(2) .gal-tilt { border-radius: 0 0 10px 10px; }   /* 맨 아래 장(이전/다음 위)은 아래쪽 */
.gal-frame + .gal-frame { margin-top: -1px; }   /* 장 사이에 회색 실선이 비치지 않게 1px 겹침 */
.gal-tilt > .slide { opacity: 1; visibility: visible; transition: none; transform: scale(var(--s)); transform-origin: 0 0; }
.gal-glow {
    position: absolute; inset: 0; z-index: 5; pointer-events: none;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 22%, transparent 48%);
    mix-blend-mode: soft-light;
    opacity: var(--sh, 0);
}
/* 표지의 세부 내용(data-cover-detail): 홈 썸네일에선 숨기고, 열었을 때 줌인이 끝날 즈음 떠오름 */
.gal-stage [data-cover-detail] { visibility: hidden; }
.gal-frame [data-cover-detail] {
    opacity: 0; translate: 0 28px;
    transition: opacity .7s ease, translate .9s var(--ease);
}
.gal-frame .slide.is-active [data-cover-detail] { opacity: 1; translate: 0 0; transition-delay: .55s; }


/* 맨 끝: 이전(왼쪽) · 다음(오른쪽), 둘 다 같은 크기. 썸네일은 너비 그대로, 높이는 절반 */
.gal-end {
    width: calc(1920px * var(--s));
    display: flex; flex-direction: column; gap: 28px;
    margin-top: 40px; padding: 40px 0 72px;
    border-top: 1px solid var(--faint);
}
.gal-pn-row { display: flex; justify-content: space-between; gap: var(--pn-gap); align-items: flex-start; }
.gal-pn { width: calc(1920px * var(--pn-w)); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; }
.gal-pn-next { align-items: flex-end; text-align: right; margin-left: auto; }   /* '이전'이 없어도 오른쪽에 */
.gal-pn-thumb {
    position: relative; display: block; width: 100%; aspect-ratio: 32 / 9;   /* 16:9 의 절반 높이 */
    margin-bottom: 14px; border-radius: 8px; overflow: hidden; background: #000;
    box-shadow: 0 0 0 1px var(--faint);
    transition: box-shadow .25s ease;
}
.gal-pn-thumb .gal-stage { transform: scale(var(--pn-w)) translateY(-25%); }   /* 표지의 가운데 부분이 보이게 */
.gal-pn:hover .gal-pn-thumb { box-shadow: 0 0 0 1px var(--tick); }
.gal-pn-label { color: var(--dim); }
.gal-pn-title { font-size: 16px; font-weight: 500; line-height: 1.4; }   /* 작게 · 얇게 */
.gal-pn-desc { color: var(--dim); font-size: 14px; }
.gal-all { align-self: flex-start; color: var(--dim); transition: color .2s ease, transform .5s var(--ease); }
.gal-all:hover { color: var(--fg); }

/* 위쪽 막대 (상하 보기에서만) */
.gal-bar { visibility: hidden; z-index: 3; }
.gal[data-mode="project"] .gal-bar { visibility: visible; }
.gal-bar {
    position: absolute; left: 0; right: 0; top: 0; height: 64px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px;
    background: linear-gradient(to bottom, var(--bg) 30%, var(--bg0));
    pointer-events: none;
}
.gal-bar > * { pointer-events: auto; }
.gal-bar-left { display: flex; align-items: center; gap: 12px; }
.gal-back { padding: 6px 12px 6px 8px; border-radius: 100px; color: var(--dim); transition: color .2s ease, background .2s ease, transform .5s var(--ease); }
.gal-back:hover { color: var(--fg); background: var(--hover); }
.gal-bar-title { font-weight: 600; }
.gal-bar-title span { color: var(--dim); font-weight: 400; margin-right: 8px; font-variant-numeric: tabular-nums; }
.gal-bar-count { color: var(--dim); font-variant-numeric: tabular-nums; }

/* 커서 쪽으로 끌려오는 버튼 */
[data-magnetic].is-pulled { transition: transform .12s linear; }

/* ---------- 4. 위쪽 가운데 인디케이터 (눈금 = 슬라이드 한 장, 상자 = 지금 위치) ---------- */
/* rauno.me 비율: 눈금 간격 6px · 높이 10px · 굵기 1px / 상자 15×9px / 화면 위에서 약 36px (가운데 기준) */
.gal-ind {
    position: absolute; top: 26px; left: 50%; z-index: 4;
    transform: translateX(-50%);
    height: 20px;                       /* 누르기 쉬운 높이 (보이는 눈금은 10px) */
}
.gal-ind-ticks { display: flex; align-items: center; height: 100%; }
.gal-tick { position: relative; width: 6px; height: 20px; flex: none; }
.gal-tick.is-first:not(:first-child) { margin-left: 4px; }   /* 프로젝트 사이 아주 조금 */
.gal-tick::before {
    content: ""; position: absolute; left: calc(50% - .5px); top: 5px; height: 10px; width: 1px;
    background: var(--tick);
    transition: opacity .2s ease, background .2s ease;
}
.gal-tick:hover::before { background: var(--fg); }
.gal-tick.is-in::before { opacity: 0; }
.gal-ind-box {
    position: absolute; left: 0; top: 5.5px; width: 15px; height: 9px;
    border: 1px solid var(--tick-strong); border-radius: 1.5px;
    pointer-events: none;
}

/* 상하 보기에선 위쪽 가로 인디케이터 대신 왼쪽 세로 인디케이터 */
.gal-ind { transition: opacity .3s ease; }
.gal[data-mode="project"] .gal-ind { opacity: 0; pointer-events: none; }
.gal-vind {
    position: absolute; left: 22px; top: 50%; z-index: 4;
    transform: translateY(-50%);
    width: 44px;                        /* 확대될 때 늘어날 자리 + 마우스 닿는 범위 */
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.gal[data-mode="project"] .gal-vind { opacity: 1; pointer-events: auto; transition-delay: .4s; }
.gal-vind-ticks { display: flex; flex-direction: column; }
.gal-vtick { position: relative; width: 44px; height: 10px; flex: none; }
/* --m (0~1): 커서와 가까운 정도 (gallery.js) → 길이·굵기·진하기가 함께 커짐 */
.gal-vtick::before {
    content: ""; position: absolute; left: 5px; top: 50%;
    width: calc(10px + 26px * var(--m, 0)); height: calc(1px + 1.5px * var(--m, 0));
    translate: 0 -50%;
    background: var(--fg); opacity: calc(.3 + .6 * var(--m, 0));
    transition: opacity .2s ease;
}
.gal-vtick.is-in::before { opacity: 0 !important; }
.gal-vind-box {
    position: absolute; left: 2.5px; top: 0; width: 15px; height: 9px;
    border: 1px solid var(--tick-strong); border-radius: 1.5px;
    pointer-events: none;
}

/* 위쪽 가로 눈금: Dock 확대 (--m 0~1, gallery.js) */
.gal-ind { overflow: visible; }
.gal-tick::before { top: 50% !important; height: calc(10px + 22px * var(--m, 0)) !important; width: calc(1px + 1.5px * var(--m, 0)) !important; translate: 0 -50%; background: var(--fg) !important; opacity: calc(.3 + .6 * var(--m, 0)); }
.gal-tick.is-in::before { opacity: 0 !important; }

/* ---------- 눈금 미리보기: 지니(요술램프) 효과 ----------
   눈금 쪽 끝은 좁고 반대쪽은 넓은 깔때기 모양에서 → 제 모양으로 펼쳐짐 (떼면 반대로 빨려 들어감) */
.gal-peek {
    position: fixed; left: 0; top: 0; z-index: 30;
    width: var(--pw); height: var(--ph);
    overflow: hidden; background: #000;
    pointer-events: none; visibility: hidden;
}
.gal-peek-stage { position: absolute; left: 0; top: 0; width: 1920px; transform: scale(var(--ps)); transform-origin: 0 0; }
.gal-peek-stage > .slide { opacity: 1; visibility: visible; transition: none; }
.gal-peek-stage [data-reveal], .gal-peek-stage [data-fill] { opacity: 1; translate: none; scale: none; transition: none; }
.gal-peek-stage [data-cover-detail] { opacity: 1; translate: none; }
.gal-peek.is-on, .gal-peek.is-off { visibility: visible; }
.gal-peek.is-on.is-v  { transform-origin: 0 var(--oy, 50%); animation: genie-v .42s cubic-bezier(.3, .7, .2, 1) both; }
.gal-peek.is-on.is-h  { transform-origin: var(--ox, 50%) 0; animation: genie-h .42s cubic-bezier(.3, .7, .2, 1) both; }
.gal-peek.is-off.is-v { transform-origin: 0 var(--oy, 50%); animation: genie-v .28s cubic-bezier(.6, 0, .8, .4) reverse both; }
.gal-peek.is-off.is-h { transform-origin: var(--ox, 50%) 0; animation: genie-h .28s cubic-bezier(.6, 0, .8, .4) reverse both; }
/* 세로 목차 → 오른쪽으로 빠져나옴 (왼쪽 끝이 눈금) */
@keyframes genie-v {
    0%   { transform: scale(.04, .06); clip-path: polygon(0 calc(var(--oy) - 2px), 100% 30%, 100% 70%, 0 calc(var(--oy) + 2px)); opacity: 0; }
    35%  { transform: scale(.55, .45); clip-path: polygon(0 calc(var(--oy) - 10%), 100% 6%, 100% 94%, 0 calc(var(--oy) + 10%)); opacity: 1; }
    70%  { transform: scale(1.02, .98); clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 96%); }
    100% { transform: none; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 1; }
}
/* 가로 목차 → 아래로 빠져나옴 (위쪽 끝이 눈금) */
@keyframes genie-h {
    0%   { transform: scale(.06, .04); clip-path: polygon(calc(var(--ox) - 2px) 0, calc(var(--ox) + 2px) 0, 70% 100%, 30% 100%); opacity: 0; }
    35%  { transform: scale(.45, .55); clip-path: polygon(calc(var(--ox) - 10%) 0, calc(var(--ox) + 10%) 0, 94% 100%, 6% 100%); opacity: 1; }
    70%  { transform: scale(.98, 1.02); clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%); }
    100% { transform: none; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 1; }
}

/* 썸네일에서 이어 들어온 직후: '아래로 스크롤해서 보기' 안내 (스크롤하면 사라짐, 투명도는 gallery.js) */
.gal-scrollhint {
    position: absolute; left: 50%; bottom: 28px; z-index: 5;
    translate: -50% 0; margin: 0;
    font-size: 13px; font-weight: 500; color: var(--dim);
    opacity: 0; pointer-events: none; visibility: hidden;
}
.gal[data-mode="project"] .gal-scrollhint { visibility: visible; }
.gal-scrollhint span { display: inline-block; animation: hint-bob 1.4s ease-in-out infinite; }
@keyframes hint-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 4px; } }

/* ---------- 5. 마우스 커서 ---------- */
.gal.has-cursor, .gal.has-cursor * { cursor: none !important; }
.gal-cursor { display: none; }
.gal.has-cursor .gal-cursor {
    display: block;
    position: fixed; left: 0; top: 0; z-index: 50;
    width: 84px; height: 84px; margin: -42px 0 0 -42px;
    pointer-events: none;
    transition: opacity .2s ease;
}
.gal-cursor.is-hidden { opacity: 0; }
.gal-cursor-dot {
    position: absolute; inset: 0; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff;                   /* 작은 점: 흰색 + 반전(difference) → 밝은 곳에선 검게, 어두운 곳에선 희게 */
    transform: scale(.12);
    transition: transform .45s var(--smart), background .3s ease;
}
.gal-cursor:not(.is-big):not(.is-mid) { mix-blend-mode: difference; }   /* 작은 점은 어떤 배경에서도 보이게 */
.gal-cursor-label { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; opacity: 0; transition: opacity .2s ease; }
.gal-cursor.is-big .gal-cursor-dot { transform: scale(1); background: #111214; }
.gal-cursor.is-mid .gal-cursor-dot { transform: scale(.62); background: rgba(17, 18, 20, .08); backdrop-filter: blur(6px); }
.gal-cursor.is-mid .gal-cursor-label { color: #111214; font-size: 18px; }
.gal-cursor.is-big .gal-cursor-label, .gal-cursor.is-mid .gal-cursor-label { opacity: 1; }
.gal-cursor.is-link .gal-cursor-dot { transform: scale(.42); }
.gal-cursor.is-down .gal-cursor-dot { transform: scale(.9); }
.gal-cursor.is-down.is-mid .gal-cursor-dot { transform: scale(.55); }
/* 머무르면 열기: 원 둘레가 한 바퀴 차오름 */
.gal-cursor-ring {
    position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px);
    transform: rotate(-90deg); overflow: visible;
}
.gal-cursor-ring circle {
    fill: none; stroke: #111214; stroke-width: 2;
    stroke-dasharray: 301.6; stroke-dashoffset: 301.6;
    opacity: 0; transition: opacity .2s ease;
}
.gal-cursor.is-dwell.is-big .gal-cursor-ring circle { opacity: 1; stroke-dashoffset: 0; transition: opacity .2s ease, stroke-dashoffset var(--dwell, 1.5s) linear; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 700px) {
    .gal-head { grid-template-columns: 1fr; padding: 20px 16px 0; }
    .gal-contact { text-align: left; }
    .gal-about-pop { width: calc(100vw - 32px); }
    .gal-hint, .gal-ind, .gal-vind, .gal-bar-title { display: none; }
    .gal-bar { padding: 0 8px; }
    .gal-tilt { border-radius: 4px; }
    .gal-pn-row { flex-direction: column; }
    .gal-pn-next { align-items: flex-start; text-align: left; margin-left: 0; }
}
@media (hover: none) { .gal-strip { cursor: auto; } }

@media (prefers-reduced-motion: reduce) {
    .gal-home, .gal-item, .gal-head, .gal-cursor-dot { transition: none; }
}
