:root {
  --bg: #fbf9f4;
  --ink: #26221e;
  --ink-soft: #7c756c;
  --line: rgba(38, 34, 30, 0.14);
  --accent: #6f7a55;
  --orange: #e8893a;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Pretendard", -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gnb-h: 84px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
p, h1, h2 { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 4px; border-radius: 3px; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  /* 대비를 키운 회색 노이즈를 낮은 불투명도로 얹어 바탕과 플레이어에 은은한 필름 그레인 */
  opacity: 0.07;
  background-size: 200px 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='3' intercept='-1'/%3E%3CfeFuncG type='linear' slope='3' intercept='-1'/%3E%3CfeFuncB type='linear' slope='3' intercept='-1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- GNB ---------- */
.gnb {
  position: relative;
  z-index: 10;
  height: var(--gnb-h);
  margin: 0 clamp(20px, 3vw, 44px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.logo { justify-self: start; display: flex; align-items: center; gap: 8px; }
.logo-tape { display: block; width: 21px; height: 15px; fill: #4a4641; }
.logo img { display: block; height: 15px; width: auto; } /* 로고 이미지는 진회색(#4a4641)으로 칠해 둠 */

.gnb-center {
  font: 400 11px var(--mono);
  letter-spacing: 0.32em;
  color: var(--ink-soft);
}

.sns { justify-self: end; display: flex; gap: 4px; }
.sns a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-out);
}
.sns a:hover { background: rgba(38, 34, 30, 0.07); }
.sns a:active { transform: scale(0.94); }
.sns svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sns svg .fill { fill: var(--ink); stroke: none; }
.sns .sound {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-out);
}
.sns .sound:hover { background: rgba(38, 34, 30, 0.07); }
.sns .sound:active { transform: scale(0.94); }
.sound[aria-pressed="true"] .sound-off,
.sound[aria-pressed="false"] .sound-on { display: none; }

/* 음량 슬라이더: 소리가 켜져 있을 때만 펼쳐짐 */
.sns .volume {
  -webkit-appearance: none;
  appearance: none;
  align-self: center;
  width: 0;
  height: 38px;
  margin: 0 0 0 -4px; /* 접혀 있을 땐 flex gap(4px)만큼 당겨서 아이콘 간격을 똑같이 */
  background: none;
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition: width 0.3s var(--ease-out), margin 0.3s var(--ease-out), opacity 0.2s ease, visibility 0.3s;
}
.sound[aria-pressed="true"] + .volume {
  width: 72px;
  margin: 0 6px 0 0;
  opacity: 1;
  visibility: visible;
}
.volume::-webkit-slider-runnable-track { height: 1px; background: var(--ink-soft); }
.volume::-moz-range-track { height: 1px; background: var(--ink-soft); }
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
}
.volume::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--ink); }

/* ---------- layout ---------- */
.stage {
  min-height: calc(100vh - var(--gnb-h));
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 72px) 96px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.7fr) minmax(0, 0.75fr);
  align-items: center;
  gap: clamp(24px, 3vw, 56px);
}

/* ---------- intro (left) ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 400 11px var(--mono);
  letter-spacing: 0.24em;
  color: var(--ink-soft);
}
.eyebrow-box {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0;
}

.headline {
  margin: 36px 0 32px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 4.2vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.headline span, .headline em { display: block; }
.headline em { color: var(--accent); }

.lede {
  font-size: 16px;
  line-height: 1.9;
  color: #5b554d;
  letter-spacing: -0.01em;
}

.rule { display: block; width: 40px; height: 1px; margin: 40px 0 28px; background: var(--line); }

.byline { display: flex; align-items: flex-start; gap: 18px; }
.byline-plus { font: 300 22px/1 var(--sans); color: var(--ink-soft); margin-top: -2px; }
.byline-name { font: 500 11px var(--mono); letter-spacing: 0.2em; }
.byline-role { margin-top: 6px; font: 400 10px var(--mono); letter-spacing: 0.2em; color: var(--ink-soft); }
.byline-mail {
  display: inline-block;
  margin-top: 10px;
  font: 400 11px var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.byline-mail:hover { color: var(--ink); text-decoration-color: currentColor; }
/* 아이콘 네모는 칸 안쪽 약 4px부터 그려지므로 그만큼 당겨 이름과 왼쪽 끝을 맞춤 */
.tools { display: flex; gap: 10px; margin: 18px 0 0 -4px; padding: 0; list-style: none; }
.tools svg {
  display: block;
  width: 32px; /* 보이는 네모는 약 23px */
  height: 32px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.1;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}
.tools text {
  fill: var(--ink-soft);
  stroke: none;
  font: 600 7.5px var(--sans);
  text-anchor: middle;
  transition: fill 0.2s ease;
}
.tools li:hover svg { stroke: var(--ink); }
.tools li:hover text { fill: var(--ink); }

/* ---------- player (center) ---------- */
.player {
  /* 플레이어 몸체가 화면 정중앙에 오도록 script.js(centerDeck)에서 이동값을 넣음 */
  transform: translate(var(--dx, 0px), var(--dy, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 덱 이미지 안 좌표(%): 버튼 윗면 12.3%, 몸체 아랫면 74.13%, 몸체 가로 중심 47.5% */
.deck { --gap: 34px; }
.status {
  position: absolute;
  z-index: 2;
  left: 47.5%;
  top: 12.3%;
  transform: translate(-50%, calc(-100% - var(--gap)));
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 11px var(--mono);
  letter-spacing: 0.26em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b7b0a5;
  transition: background-color 0.25s ease;
}
body.playing .status { color: var(--ink); }
body.playing .status-dot { background: var(--orange); animation: blink 1.2s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.deck {
  position: relative;
  max-width: 1012px;   /* 110% */
  /* 그림자 여백까지 포함한 이미지라, 플레이어가 예전 크기로 보이도록 칸보다 조금 넓게(여백은 양옆으로 넘침) */
  width: 128.7%;
  margin-inline: -14.35%;
  aspect-ratio: 1680 / 1260;
  mix-blend-mode: multiply;
}
.deck img, .tape-reels { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.deck-under, .deck-play, .deck-body { inset: 0; width: 100%; height: 100%; }
/* 재생 버튼은 몸체 아래에 깔려 있어서, 아래로 내리면 몸체 속으로 눌려 들어간 것처럼 보임. 세 이미지 모두 같은 캔버스(1680×1260) */
.deck-play { transition: transform 0.18s var(--ease-out), filter 0.18s ease; }
body.playing .deck-play { transform: translateY(0.95%); filter: brightness(0.93); }

.deck-tape { position: absolute; inset: 0; opacity: 0; transform: translateY(-1.5%); transition: opacity 0.3s ease, transform 0.4s var(--ease-out); }
.tape-body, .tape-reels { left: 23.6905%; top: 27.619%; width: 48.8095%; }
/* 릴: 감긴 테이프 + 허브 + 스핀들이 함께 돎. 테이프가 적게 감긴 쪽(왼쪽)이 더 빠름 */
.reel { transform-box: view-box; animation: spin 1.7s linear infinite paused; }
.reel-r { animation-duration: 2.3s; }
body.playing .deck-tape { opacity: 1; transform: none; }
body.playing .reel { animation-play-state: running; }
/* 테이프별 창 색(투명 플라스틱 색). script.js에서 deck에 data-tape 지정 */
.win-tint { fill: transparent; }
.deck[data-tape="nike"] .win-tint { fill: rgba(90, 210, 0, 0.32); }
.deck[data-tape="previous"] .win-tint { fill: rgba(245, 150, 30, 0.3); }
.deck[data-tape="rolex"] .win-tint { fill: rgba(20, 120, 60, 0.26); }
.deck[data-tape="washenjoy"] .win-tint { fill: rgba(70, 175, 235, 0.24); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 테이프가 끼워질 때 살짝 눌리는 느낌 */
.deck.bump { animation: bump 0.32s var(--ease-out); }
@keyframes bump {
  0% { transform: translateY(0); }
  35% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}

/* ---------- tracklist (right) ---------- */
.tracklist {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3.4vh, 36px);
  width: 100%;
  max-width: 340px;
  justify-self: end;
}

.side-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font: 500 11px var(--mono);
  letter-spacing: 0.28em;
}
.side-meta { font-weight: 400; font-size: 10px; letter-spacing: 0.2em; color: var(--ink-soft); }

.tracks { list-style: none; margin: 0; padding: 0; }

.track {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  align-items: center;
  height: clamp(30px, 3.9vh, 38px);
  transition: opacity 0.3s ease;
}

.track-no { font: 400 11px var(--mono); color: var(--ink-soft); }

.track-title {
  justify-self: start;
  font-family: var(--serif);
  font-size: clamp(20px, 2.5vh, 24px);
  line-height: 1;
  transform-origin: left center;
  transition: transform 0.4s var(--ease-out);
  white-space: nowrap;
}

.track-arrow {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}

.tracklist.has-focus .track:not(.is-active) { opacity: 0.28; }
.track.is-active .track-title { transform: scale(1.4); font-style: italic; }
.track.is-active .track-no { color: var(--orange); }
.track.is-active .track-arrow { opacity: 1; transform: none; }

/* ---------- visualizer ---------- */
.viz {
  position: absolute;
  left: 47.5%;
  top: calc(74.13% + var(--gap));
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 34px;
  transform: translate(-50%, 10px);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
  pointer-events: none;
}
body.playing .viz { opacity: 1; transform: translate(-50%, 0); }
.viz span {
  width: 2px;
  height: 100%;
  border-radius: 2px;
  background: var(--ink);
  transform-origin: bottom;
  transform: scaleY(0.08);
}

/* ---------- project viewer (화면의 80% 크기 창) ---------- */
.viewer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.viewer[hidden] { display: none; }
.viewer-backdrop {
  position: absolute;
  inset: 0;
  /* 흐림(backdrop-filter)은 창 안 스크롤 때마다 뒤 화면 전체를 다시 계산해서 무거움 → 단색 딤만 사용 */
  background: rgba(38, 34, 30, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.viewer-window {
  position: relative;
  /* 1440 × 900(16:10, 맥북 13인치 비율) 고정, 화면이 그보다 작으면 화면에 맞춰 줄어듦 */
  width: min(1440px, 92vw);
  height: min(900px, 90vh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(38, 34, 30, 0.28), 0 0 0 1px rgba(38, 34, 30, 0.08);
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.42s var(--ease-out);
}
.viewer.is-open .viewer-backdrop,
.viewer.is-open .viewer-window { opacity: 1; }
.viewer.is-open .viewer-window { transform: none; }

.viewer-bar {
  flex: none;
  height: 48px;
  padding: 0 10px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.viewer-title { display: flex; align-items: baseline; gap: 14px; }
.viewer-no { font: 400 10px var(--mono); letter-spacing: 0.24em; color: var(--orange); }
#viewerTitle { font-family: var(--serif); font-size: 22px; line-height: 1; }
.viewer-desc { font: 400 13px var(--sans); color: var(--ink-soft); letter-spacing: 0; }
.viewer-desc:not(:empty)::before { content: "|"; margin-right: 12px; color: rgba(38, 34, 30, 0.3); }
.viewer-actions { display: flex; gap: 2px; }
.viewer-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-out);
}
.viewer-btn:hover { background: rgba(38, 34, 30, 0.07); }
.viewer-btn:active { transform: scale(0.94); }
.viewer-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

.viewer-body { position: relative; flex: 1; overflow: hidden; background: #fff; }
.viewer-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  border: 0;
  transform-origin: 0 0;
}
body.viewer-open { overflow: hidden; }
/* 창이 열린 동안 뒤 랜딩페이지의 움직이는 요소(그레인 합성, 블렌드, 깜빡임)를 꺼서 합성 부담을 줄임 */
body.viewer-open .grain { display: none; }
body.viewer-open .deck { mix-blend-mode: normal; }
body.viewer-open .status-dot { animation: none; }
.viewer-window { contain: strict; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stage {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "player player" "intro list";
    align-items: start;
  }
  .player { grid-area: player; }
  .intro { grid-area: intro; }
  .tracklist { grid-area: list; }
  .deck { max-width: 600px; }
}

@media (max-width: 720px) {
  :root { --gnb-h: 68px; }
  .gnb-center { display: none; }
  .gnb { grid-template-columns: 1fr 1fr; }
  .stage {
    grid-template-columns: 1fr;
    grid-template-areas: "intro" "player" "list";
    gap: 40px;
  }
  .headline { margin: 24px 0 20px; }
  .tracklist { max-width: none; justify-self: stretch; }
  .track { height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .deck.bump, .reel { animation: none; }
  .track-title { transition: none; }
  body.playing .status-dot { animation: none; }
  .viewer-backdrop, .viewer-window { transition: none; }
}

/* 이미지·영상 선택/드래그 방지 */
img, video { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
