/* 공개 갤러리 — 작품보다 인터페이스가 먼저 보이지 않아야 한다 (기획서 9) */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 다크 / 화이트 모드 (기획서 2.4 — 달·해) */
body[data-theme="dark"] {
  --bg: #0a0a0b;
  --fg: 216 213 207;
  --panel: 10 10 11;
  --shadow: rgba(0, 0, 0, 0.65);
}

body[data-theme="light"] {
  --bg: #edeae3;
  --fg: 38 35 30;
  --panel: 246 244 239;
  --shadow: rgba(60, 52, 40, 0.28);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: rgb(var(--fg) / 0.88);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* ---------- 배경 세계 (작품 뒤에 항상 존재하는 3D 월드) ----------
   작품이 걸려 있을 때는 흐릿한 기척으로만, 감은 눈으로 걷어내면
   온전히 드러나며 돌덩이를 잡을 수 있게 된다 */
#backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.34;
  filter: saturate(0.6);
  transition: opacity 0.9s ease, filter 0.9s ease;
}

#stage.veiled #backdrop {
  pointer-events: auto;
  opacity: 1;
  filter: none;
}

/* ---------- 상단 헤더 (기획서 2.1) ---------- */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 18px 28px;
  pointer-events: none;
}

#site-header a { pointer-events: auto; text-decoration: none; }

#brand {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: rgb(var(--fg) / 0.85);
}

#site-nav { display: flex; gap: 22px; }

#site-nav a {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgb(var(--fg) / 0.42);
  transition: color 0.25s ease;
}

#site-nav a:hover, #site-nav a.on { color: rgb(var(--fg) / 0.85); }

/* ---------- 날짜 코드 (우측 상단, YYYYMMDDk) ---------- */
#date-code {
  position: fixed;
  top: 22px;
  right: 28px;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: rgb(var(--fg) / 0.55);
  z-index: 40;
  pointer-events: none;
}

/* ---------- 중앙 작품 ---------- */
#artwork {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#artwork img {
  pointer-events: auto;
  cursor: zoom-in;
  max-width: 56vw;
  max-height: 62vh;
  object-fit: contain;
  box-shadow: 0 24px 80px var(--shadow);
  transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              max-height 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease;
}

#stage[data-state="zoom"] #artwork img {
  max-width: 82vw;
  max-height: 84vh;
  cursor: default;
}

#artwork img.switching { opacity: 0; }

/* 감은 눈: 작품이 흩날려 사라진 상태 */
#stage.veiled #artwork img { visibility: hidden; }

#scatter {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* ---------- 커서 라벨 (빈 공간의 방향성을 인터페이스로) ---------- */
#cursor-label {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: rgb(var(--fg) / 0.75);
  transform: translate(14px, 14px);
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

#cursor-label.visible { opacity: 1; }

/* ---------- 패널 공통 ---------- */
#panel-top, #panel-bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 36px clamp(24px, 8vw, 120px);
  background: rgb(var(--panel) / 0.92);
  backdrop-filter: blur(14px);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 상단: 주제 및 리스트 ---------- */
#panel-top {
  top: 0;
  transform: translateY(-100%);
  border-bottom: 1px solid rgb(var(--fg) / 0.08);
}

#stage.top-open #panel-top { transform: translateY(0); }

.panel-eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgb(var(--fg) / 0.4);
  margin-bottom: 8px;
}

#topic-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#topic-position {
  margin-top: 4px;
  font-size: 12px;
  color: rgb(var(--fg) / 0.45);
  font-family: ui-monospace, monospace;
}

#topic-list {
  list-style: none;
  display: flex;
  gap: 16px;
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 6px;
}

#topic-list li {
  flex: 0 0 auto;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.25s ease;
}

#topic-list li:hover { opacity: 0.9; }

#topic-list li.current {
  opacity: 1;
  outline: 1px solid rgb(var(--fg) / 0.5);
  outline-offset: 3px;
}

#topic-list img {
  display: block;
  height: 72px;
  width: auto;
}

#topic-list .thumb-title {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgb(var(--fg) / 0.7);
}

/* ---------- 하단: 상세 정보 ---------- */
#panel-bottom {
  bottom: 0;
  transform: translateY(100%);
  border-top: 1px solid rgb(var(--fg) / 0.08);
  max-height: 46vh;
  overflow-y: auto;
}

#stage.bottom-open #panel-bottom { transform: translateY(0); }

#detail-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#detail-artist {
  margin-top: 4px;
  font-size: 13px;
  color: rgb(var(--fg) / 0.55);
}

#detail-desc {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.75;
  max-width: 560px;
  color: rgb(var(--fg) / 0.85);
}

#detail-meta {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 32px;
  max-width: 720px;
}

#detail-meta dt {
  font-size: 11px;
  letter-spacing: 0.24em;
  color: rgb(var(--fg) / 0.4);
  margin-bottom: 5px;
}

#detail-meta dd {
  font-size: 13px;
  line-height: 1.6;
  color: rgb(var(--fg) / 0.8);
}

#detail-meta dd#detail-date { font-family: ui-monospace, monospace; }

#detail-memo-row.empty { display: none; }

/* ---------- 우측 하단 컨트롤 도크 (기획서 2.4) ---------- */
#dock {
  position: fixed;
  bottom: 22px;
  right: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgb(var(--fg) / 0.16);
  background: rgb(var(--panel) / 0.72);
  backdrop-filter: blur(8px);
  color: rgb(var(--fg) / 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s ease, border-color 0.25s ease,
              opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.dock-btn:hover { color: rgb(var(--fg) / 0.95); border-color: rgb(var(--fg) / 0.4); }

.dock-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 접힌 상태: 토글만 남고 나머지는 오른쪽(토글 방향)으로 숨는다 */
#dock:not(.open) .dock-btn:not(#dock-toggle) {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}

/* 펼칠 때 왼쪽 방향으로, 분리된 독립 버튼 형태로 전개 (스태거) */
#dock.open .dock-btn:nth-child(1) { transition-delay: 0.16s; }
#dock.open .dock-btn:nth-child(2) { transition-delay: 0.12s; }
#dock.open .dock-btn:nth-child(3) { transition-delay: 0.08s; }
#dock.open .dock-btn:nth-child(4) { transition-delay: 0.04s; }
#dock.open .dock-btn:nth-child(5) { transition-delay: 0s; }

#dock .dock-btn.active { color: rgb(var(--fg) / 0.95); border-color: rgb(var(--fg) / 0.5); }

/* ---------- 오버레이 (설명서 / 소개) ---------- */
.overlay[hidden] { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(var(--panel) / 0.5);
  backdrop-filter: blur(4px);
}

.overlay-card {
  position: relative;
  width: min(560px, 90vw);
  max-height: 78vh;
  overflow-y: auto;
  background: rgb(var(--panel) / 0.96);
  border: 1px solid rgb(var(--fg) / 0.12);
  box-shadow: 0 30px 80px var(--shadow);
  padding: 34px 38px 38px;
  animation: card-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.overlay-card h2 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.overlay-card p, .overlay-card li {
  font-size: 13.5px;
  line-height: 1.8;
  color: rgb(var(--fg) / 0.82);
}

.overlay-card ol { padding-left: 20px; display: grid; gap: 10px; }

.overlay-card code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: rgb(var(--fg) / 0.95);
}

.overlay-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: rgb(var(--fg) / 0.45);
  font-size: 14px;
  cursor: pointer;
}

.overlay-close:hover { color: rgb(var(--fg) / 0.95); }

/* ---------- 관리자 진입 모달 (기획서 2.5: 버튼이 아니라 배경 상호작용으로) ---------- */
.entry-actions { margin-top: 22px; }

.entry-btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid rgb(var(--fg) / 0.35);
  color: rgb(var(--fg) / 0.9);
  text-decoration: none;
  font-size: 12.5px;
  letter-spacing: 0.18em;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.entry-btn:hover {
  background: rgb(var(--fg) / 0.08);
  border-color: rgb(var(--fg) / 0.6);
}

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
  #artwork img { max-width: 78vw; max-height: 52vh; }
  #stage[data-state="zoom"] #artwork img { max-width: 92vw; max-height: 70vh; }
  #topic-list img { height: 56px; }
  #panel-top, #panel-bottom { padding: 24px 20px; }
  #site-header { gap: 20px; padding: 16px 20px; }
  .dock-btn { width: 36px; height: 36px; }
}
