:root {
  --bg: #0e1014;
  --panel: #171a21;
  --ink: #f4f5f7;
  --muted: #a9afbb;
  --line: #2b303b;
  --accent: #ffd45c;
  --font: 'Noto Sans KR', sans-serif;
}

/* 기본 */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y mandatory; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 var(--font); word-break: keep-all; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 30; padding: 10px 20px; background: var(--accent); color: #111; }
.skip:focus { top: 12px; }

/* 상단 메뉴와 옆 점 메뉴 */
.header { position: fixed; inset: 0 0 auto; z-index: 10; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 56px); background: linear-gradient(#000b, transparent); }
.brand { font-size: 22px; font-weight: 900; }
.header nav { display: flex; gap: clamp(20px, 3vw, 48px); font-size: 15px; font-weight: 700; }
.header nav a { padding: 6px 0; border-bottom: 2px solid transparent; }
.header nav a:hover { border-color: var(--accent); }
body[data-screen="works"] .header nav a[href="#works"],
body[data-screen="about"] .header nav a[href="#about"] { border-color: var(--accent); color: var(--accent); }
.dots { position: fixed; right: 22px; top: 50%; z-index: 10; display: flex; flex-direction: column; gap: 6px; transform: translateY(-50%); }
.dots a { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 24px; font-size: 12px; text-shadow: 0 1px 4px #000; }
.dots a::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff8; box-shadow: 0 0 4px #000a; }
.dots a span { opacity: 0; transition: opacity .2s; }
.dots a:hover span, .dots a:focus-visible span { opacity: 1; }
.dots a[aria-current="true"]::after { height: 28px; border-radius: 4px; background: var(--accent); }

/* 화면 공통 */
.screen { position: relative; min-height: 100vh; min-height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; justify-content: center; }
.inner { width: min(1280px, calc(100% - 128px)); margin-inline: auto; }
h2 { margin: 0 0 24px; font-size: clamp(28px, 3.4vw, 44px); font-weight: 900; line-height: 1.3; }

/* 첫 화면 슬라이드 */
.hero { --bar: 96px; height: 100vh; height: 100svh; overflow: hidden; }
.slides { position: absolute; inset: 0; touch-action: pan-y; }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .7s, visibility .7s; }
.slide.active { opacity: 1; visibility: visible; }
.slide-back, .slide-art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.slide-back { display: none; }
.slide-art { bottom: var(--bar); height: calc(100% - var(--bar)); object-position: center 80%; }
.slide-art { transform: scale(1.04); transition: transform 6s ease-out; }
.slide.active .slide-art { transform: scale(1); }
.slide[data-project="hero"] .slide-art { object-position: 40% center; }
.slide[data-project="otter"] .slide-art, .slide[data-project="cinderella"] .slide-art { object-position: center 30%; }
.slide::after { content: ''; position: absolute; inset: 0 0 var(--bar); background: linear-gradient(to top, #000d 0, #0006 22%, transparent 48%); pointer-events: none; }
.slide-info { position: absolute; z-index: 1; left: clamp(20px, 4vw, 56px); bottom: calc(var(--bar) + 20px); text-shadow: 0 2px 12px #000c; }
.slide-info h2 { margin: 0 0 16px; font-size: clamp(30px, 3.6vw, 52px); }
.slide-genre { margin: 0; font-size: 15px; font-weight: 700; color: var(--accent); }
.button { padding: 12px 34px; border: 0; border-radius: 2px; background: var(--accent); color: #14161b; font-size: 15px; font-weight: 700; text-shadow: none; }
.button:hover { background: #ffe08a; }
.slider-bar { position: absolute; z-index: 2; left: clamp(20px, 4vw, 56px); right: clamp(20px, 4vw, 56px); bottom: 38px; display: flex; align-items: flex-end; gap: 20px; }
.slide-tabs { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.slide-tab { min-width: 0; padding: 8px 0 0; border: 0; background: none; text-align: left; font-size: 14px; color: #ffffffa8; }
.slide-tab span { display: block; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-tab i { display: block; height: 3px; background: linear-gradient(var(--accent), var(--accent)) no-repeat left / 0 100% #ffffff40; }
.slide-tab.active { color: #fff; font-weight: 700; }
.slide-tab.active i { animation: progress 6s linear forwards; }
.hero.paused i, .hero.offscreen i, .hero.hidden-tab i, body.modal-open .hero i { animation-play-state: paused !important; }
@keyframes progress { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
.slide-pause { flex-shrink: 0; width: 76px; padding: 2px 0; border: 1px solid #ffffff59; border-radius: 2px; background: #0006; font-size: 12px; }
.scroll-hint { position: absolute; z-index: 2; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 12px; color: #ffffffb0; white-space: nowrap; }

/* 작업: 세로 패널 */
.works { padding: 88px 0 40px; }
.panels { display: flex; gap: 10px; height: min(66vh, 640px); min-height: 380px; }
.project { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--panel); transition: flex-grow .45s ease; }
.project:hover, .project:focus-within { flex-grow: 2.6; }
.project-open { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: none; text-align: left; }
.project-open:focus-visible { outline-offset: -4px; }
.project img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; filter: brightness(.72); transition: filter .35s, transform .6s ease; }
/* 스카이바운더는 좁은 패널에서 캐릭터를 중심에 두고, 넓어지면 로고까지 보이게 옮깁니다. */
.project[data-project="skybounder"] img { object-position: 19% center; transform-origin: 7% 32%; transform: scale(1.6); transition: filter .35s, transform .6s ease, object-position .45s ease; }
.project[data-project="skybounder"]:hover img, .project[data-project="skybounder"]:focus-within img { object-position: 22% center; transform: scale(1.3); }
.project[data-project="otter"] img { object-position: 56% center; }
.project[data-project="hero"] img { object-position: 30% center; }
.project:hover img, .project:focus-within img { filter: brightness(1); transform: scale(1.03); }
.project-text { position: absolute; inset: auto 0 0; display: block; padding: 90px 20px 22px; background: linear-gradient(transparent, #000e 60%); }
.project-text > * { display: block; }
.project-text strong { font-size: 21px; font-weight: 900; line-height: 1.4; }
.project-summary { margin-top: 6px; font-size: 13px; color: #d5d9e0; }
.project-desc { max-height: 0; overflow: hidden; opacity: 0; font-size: 14px; transition: max-height .4s, opacity .3s, margin .3s; }
.project:hover .project-desc, .project:focus-within .project-desc { max-height: 120px; margin-top: 10px; opacity: 1; }

/* 소개 */
.about-screen { background: var(--panel); padding: 88px 0 0; }
.about-screen > .about { margin-block: auto; padding-bottom: 32px; }
.contact-link { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.contact-link:hover { color: var(--accent); }
.about { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.profile-image { display: block; width: 100%; height: auto; padding: 16px; background: #fff; border-radius: 2px; }
.about-text { margin: 0 0 32px; font-size: clamp(19px, 2vw, 26px); font-weight: 500; line-height: 1.7; }
.profile { margin: 0; font-size: 15px; border-top: 1px solid var(--line); }
.profile > div { display: flex; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.profile dt { width: 90px; flex-shrink: 0; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; }

footer { display: flex; justify-content: space-between; padding: 24px 0 32px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* 상세 창 */
dialog { width: min(920px, calc(100% - 32px)); max-height: 90dvh; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: #000d; }
body.modal-open { overflow: hidden; }
#dialog-content { max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; }
.close-dialog { position: absolute; right: 12px; top: 12px; z-index: 4; width: 40px; height: 40px; border: 1px solid #fff5; border-radius: 2px; background: #000b; color: #fff; }
.dialog-art img { display: block; width: 100%; height: auto; }
.dialog-body { padding: 28px 40px 40px; }
.dialog-body h2 { margin-bottom: 10px; font-size: 30px; }
.dialog-body h3 { font-size: 19px; margin: 40px 0 14px; padding-left: 12px; border-left: 4px solid var(--accent); line-height: 1.3; }
.dialog-body p { margin: 0 0 14px; font-size: 15px; }
.text-link { display: inline-block; margin-right: 16px; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }
.text-link:hover { color: var(--accent); }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin: 22px 0 0; padding: 20px 0; border-block: 1px solid var(--line); }
.detail-fields > div { min-width: 0; }
.detail-fields dt { font-size: 13px; }
.detail-fields dd { font-size: 15px; overflow-wrap: anywhere; }
.work-list, .detail-gallery, .detail-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.work-list h4 { font-size: 15px; margin: 0 0 4px; }
.work-list p { font-size: 14px; margin: 0; color: #d5d9e0; }
.detail-gallery figure { margin: 0; min-width: 0; }
.detail-gallery figure.full { grid-column: 1 / -1; }
.detail-gallery figure a { display: block; }
.detail-gallery.single { grid-template-columns: 1fr; }
.detail-gallery.art figure:not(.full) img { height: 420px; object-fit: contain; }
.detail-gallery.motion { grid-template-columns: repeat(4, 1fr); gap: 16px 12px; align-items: end; }
.detail-gallery img { display: block; width: 100%; height: auto; border-radius: 2px; }
.detail-gallery figcaption { margin-top: 8px; }
.detail-gallery strong, .detail-tools strong { display: block; font-size: 14px; }
.detail-gallery figcaption span, .detail-tools span { display: block; font-size: 13px; color: var(--muted); }
.detail-tools { list-style: none; margin: 0; padding: 0; gap: 0 24px; }
.detail-tools li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dialog-body .production-note { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.copy-link { padding: 0; border: 0; background: none; }
.dialog-body .copy-status { margin: 4px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.copy-status:empty { display: none; }
.story { margin: 0; font-size: 14px; }
.story > div { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.story dt { width: 40px; flex-shrink: 0; }

/* 영상 */
.clip { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 2px; background: #000; }
.clip.portrait { width: min(100%, 360px); aspect-ratio: 9 / 16; margin-inline: auto; }
.detail-gallery.portrait { grid-template-columns: repeat(3, 1fr); gap: 16px 12px; align-items: end; }

/* 세로로 긴 화면: 슬라이드 이미지를 자르지 않고 위쪽에 보여줍니다. */
@media (max-aspect-ratio: 1/1) {
  .slide-back { display: block; filter: blur(18px) brightness(.4); transform: scale(1.1); }
  .slide-art { inset: 18% 0 auto; height: auto; }
  .slide::after { inset: 0; }
  .slide-info { bottom: 128px; right: 20px; }
}

@media (max-width: 700px) {
  html { scroll-snap-type: y proximity; }
  .screen { scroll-snap-stop: normal; }
  .inner { width: calc(100% - 40px); }
  .header { height: 64px; }
  .header nav { font-size: 14px; }
  .dots, .scroll-hint { display: none; }
  .slider-bar { bottom: 24px; gap: 10px; }
  .slide-tabs { gap: 6px; }
  .slide-tab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .slide-tab { padding: 12px 0; }
  .slide-info { bottom: 90px; }
  .hero { --bar: 0px; }
  .works { padding: 76px 0 24px; }
  .panels { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(230px, 36svh); height: auto; }
  .project-text { padding: 60px 12px 14px; }
  .project-text strong { font-size: 16px; }
  .project-summary { font-size: 12px; }
  .project-desc { display: none !important; }
  .about { grid-template-columns: 1fr; gap: 20px; }
  .profile-image { width: 160px; padding: 8px; }
  .dialog-body { padding: 22px 20px 32px; }
  .work-list, .detail-gallery, .detail-tools { grid-template-columns: 1fr; }
  .detail-gallery.portrait, .detail-gallery.motion { grid-template-columns: 1fr 1fr; }
  .detail-gallery.art figure:not(.full) img { height: 260px; }
}

/* 높이가 낮은 화면에서는 일반 스크롤로 바꿉니다. */
@media (max-height: 560px) {
  html { scroll-snap-type: none; }
  .hero { height: auto; min-height: 480px; }
  .panels { height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide, .slide-art, .project, .project img, .project-desc { transition: none; }
  .slide-art { transform: none; }
  .slide-tab.active i { animation: none; background-size: 100% 100%; }
  .slide-pause { display: none; }
}
