/* ========================================================
   전시의 재구성: 국립현대미술관 서도호 인터랙티브 웹 전시관
   Stylesheet
   ======================================================== */

@font-face {
  font-family: 'Ria';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-1@1.0/RiaSans-ExtraBold.woff2') format('woff2');
  font-weight: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Familjen+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@300;400;500;600&family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
  --bg-white: #FFFFFF;
  --bg-warm-light: #F8F7F4;
  --bg-gallery: #F3F1EC;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(20, 20, 20, 0.12);

  --ink: #111111;
  --ink-secondary: #4A4844;
  --ink-muted: #7E7C76;
  --ink-soft: rgba(17, 17, 17, 0.35);
  --line-soft: rgba(17, 17, 17, 0.12);

  --thread-color: #176554;
  --thread-glow: rgba(23, 101, 84, 0.35);
  --accent-red: #D94638;

  --font-ria: "Ria", "Familjen Grotesk", sans-serif;
  --font-display: "Familjen Grotesk", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --gl: max(28px, env(safe-area-inset-left, 0px));
  --gr: max(28px, env(safe-area-inset-right, 0px));
  --hud-top: calc(env(safe-area-inset-top, 0px) + 18px);
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  --bg-white: #0E0F0E;
  --bg-warm-light: #141614;
  --bg-gallery: #181A18;
  --card-bg: rgba(24, 26, 24, 0.95);
  --card-border: rgba(235, 230, 218, 0.15);

  --ink: #F0ECE2;
  --ink-secondary: #B8B5AB;
  --ink-muted: #828078;
  --ink-soft: rgba(240, 236, 226, 0.35);
  --line-soft: rgba(240, 236, 226, 0.12);

  --thread-color: #6FC2A9;
  --thread-glow: rgba(111, 194, 169, 0.45);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-snap-type: y proximity;
}

body {
  background: var(--bg-white);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.65;
  font-weight: 300;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================================
   HUD & Navigation Header
   ======================================================== */
#bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.05);
}
#barFill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--thread-color);
  box-shadow: 0 0 10px var(--thread-glow);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.08s linear;
}

#hud {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--hud-top);
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: var(--gl);
  padding-right: var(--gr);
  pointer-events: none;
}
.hud-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}
.hud-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: contrast(1.1);
}
:root[data-theme="dark"] .hud-logo-img {
  filter: invert(1) brightness(1.2);
}
.hud-title {
  font-family: var(--font-ria);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}
.hud-where {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-secondary);
  text-transform: uppercase;
}
.btn-icon {
  background: var(--card-bg);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 0; /* 라운딩 제거 */
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.btn-icon:hover {
  border-color: var(--thread-color);
  color: var(--thread-color);
  transform: translateY(-1px);
}

/* ========================================================
   Scenes & Sticky Stage
   ======================================================== */
.scene {
  position: relative;
  width: 100%;
}
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  padding-left: var(--gl);
  padding-right: var(--gr);
}

.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.copy {
  z-index: 20;
}
.copy h2 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.4vw, 3.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.copy p {
  font-size: clamp(0.95rem, 1.15vw, 1.08rem);
  color: var(--ink-secondary);
  max-width: 44ch;
  line-height: 1.75;
}

/* ========================================================
   SCENE 0: Intro (Slide 48 + Ria 폰트 적용)
   ======================================================== */
#s0 {
  height: 260vh;
  background: var(--bg-white);
}
.intro-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  will-change: transform, opacity;
}

/* 거대한 영문 아웃라인 DO HO SUH (Ria 폰트) */
.intro-bg-title {
  position: absolute;
  top: 10%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-ria);
  font-size: clamp(4.5rem, 15vw, 13rem);
  letter-spacing: -0.01em;
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1.8px rgba(20, 20, 20, 0.28);
  pointer-events: none;
  user-select: none;
}
:root[data-theme="dark"] .intro-bg-title {
  -webkit-text-stroke: 1.8px rgba(240, 236, 226, 0.3);
}

/* 전면 한글 볼드 서도호 (Ria 폰트) */
.intro-fg-title {
  position: absolute;
  top: 24%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-ria);
  font-size: clamp(3.8rem, 12.5vw, 10.5rem);
  letter-spacing: -0.03em;
  line-height: 0.9;
  color: #FFFFFF;
  -webkit-text-stroke: 3.5px #111111;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 10;
  user-select: none;
}
:root[data-theme="dark"] .intro-fg-title {
  color: #111211;
  -webkit-text-stroke: 3.5px #ECE8DC;
}

/* 중앙 하단: 서도호 컬러풀 패브릭 하우스들 (maingome.png) */
.intro-houses-wrapper {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: min(96vw, 1380px);
  z-index: 15;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.intro-houses-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.08));
}

/* 하단 중앙 Click to start 안내 */
.intro-click-hint {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  color: var(--ink-secondary);
  letter-spacing: 0.04em;
  z-index: 20;
  cursor: pointer;
  animation: pulseHint 2s infinite ease-in-out;
}
@keyframes pulseHint {
  0%, 100% { opacity: 0.5; transform: translate(-50%, 0); }
  50% { opacity: 1; transform: translate(-50%, -4px); }
}

/* 좌측 하단 MMCA 공식 로고 */
.intro-mmca-logo {
  position: absolute;
  bottom: 4%;
  left: var(--gl);
  z-index: 20;
}
.intro-mmca-logo img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
:root[data-theme="dark"] .intro-mmca-logo img {
  filter: invert(1) brightness(1.2);
}

/* ========================================================
   SCENE 1: Room 01 (방안, 방안으로 — Slide 49, 50, 51 연속 심도 이동)
   * 네모박스 라운딩 제거, 상단 라벨 제거
   ======================================================== */
#s1 {
  height: 520vh;
  background: #FFFFFF;
}
.tunnel-view-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.passage-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  will-change: transform, opacity;
  pointer-events: none;
}
#passage1 {
  background-image: url('assets/passage_01.png');
  z-index: 3;
}
#passage2 {
  background-image: url('assets/passage_02.png');
  z-index: 2;
  opacity: 0;
}
#passage3 {
  background-image: url('assets/passage_03.png');
  z-index: 1;
  opacity: 0;
}

/* 설명 네모박스: 라운딩 완전 제거 (border-radius: 0) */
.passage-text-card {
  position: absolute;
  left: var(--gl);
  bottom: calc(8vh + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--card-border);
  padding: 26px 30px;
  border-radius: 0 !important; /* 라운딩 제거 */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  max-width: 480px;
  will-change: opacity, transform;
}
:root[data-theme="dark"] .passage-text-card {
  background: rgba(20, 22, 20, 0.92);
}
.passage-text-card h2 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.15;
}
.passage-text-card p {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-secondary);
}

/* ========================================================
   SCENE 2: Room 02 (화면 꽉 채운 서도호 러빙러빙 캔버스)
   * 스크롤이 머물도록 260vh 높이 및 sticky 스테이지 & scroll-snap 적용
   ======================================================== */
#s2 {
  height: 260vh;
  width: 100%;
  background: #FFFFFF;
  position: relative;
  padding: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.rubbing-stage-full {
  position: sticky;
  top: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
/* 언더레이어: Slide 53 / rubbing_complete.png 고화질 실사 전체 채움 */
#rubbingUnderlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/rubbing_complete.png');
  background-size: cover;
  background-position: center center;
  transition: filter 0.3s ease, transform 0.4s ease;
  z-index: 1;
}
#rubbingUnderlayer.clickable {
  cursor: pointer;
  z-index: 5;
}
#rubbingUnderlayer.clickable:hover {
  filter: brightness(1.06) contrast(1.02);
}

#rubbingCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  transition: opacity 0.8s ease;
}
#rubbingCanvas.cleared {
  opacity: 0;
  pointer-events: none;
}

/* 하단 유일한 설명 문구 */
.rubbing-instruction-bar {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--card-border);
  padding: 12px 28px;
  border-radius: 0 !important; /* 라운딩 제거 */
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  white-space: nowrap;
  transition: all 0.3s ease;
}
:root[data-theme="dark"] .rubbing-instruction-bar {
  background: rgba(18, 20, 18, 0.94);
  color: var(--ink);
}

/* 전부 드러났을 때의 안내 상태 */
.rubbing-instruction-bar.click-prompt {
  background: var(--ink);
  color: var(--bg-white);
  border-color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
  animation: pulsePrompt 1.8s infinite ease-in-out;
}
@keyframes pulsePrompt {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.03); }
}

/* ========================================================
   SCENE 3: Room 03 (Follow the Thread & 실물 사진 미리보기)
   * 네모박스 라운딩 제거
   ======================================================== */
#s3 {
  height: 480vh;
  background: #FFFFFF;
}
#threadSvgContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#threadSvg {
  width: 100%;
  height: 100%;
}

.thread-cards-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.thread-art-item {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.4s var(--transition-smooth), filter 0.35s ease, opacity 0.4s ease;
  will-change: transform, opacity;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.thread-art-item:hover {
  transform: translate(-50%, -50%) scale(1.06) translateY(-8px);
  z-index: 30;
}
.thread-art-figure {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: filter 0.35s ease, transform 0.35s ease;
}

/* 개별 오브제 크기 및 자연스러운 부유감 */
.figure-1 {
  width: min(360px, 34vw);
  max-height: 48vh;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.12));
}
.figure-2 {
  width: min(230px, 22vw);
  max-height: 40vh;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.12));
}
.figure-3 {
  width: min(260px, 25vw);
  max-height: 52vh;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.14));
}
.thread-art-item:hover .figure-1,
.thread-art-item:hover .figure-2,
.thread-art-item:hover .figure-3 {
  filter: drop-shadow(0 24px 45px rgba(0, 0, 0, 0.22));
}

/* ========================================================
   SCENE 5: MMCA Archive & Epilogue
   * 배경 순백(#FFFFFF) 통일 & 네모박스 제거 & 액션 버튼 우측 정렬
   ======================================================== */
#s5 {
  min-height: 120vh;
  background: #FFFFFF;
  padding-block: 14vh 16vh;
  position: relative;
}
.archive-container {
  max-width: 900px;
  margin: 0 auto;
  padding-left: var(--gl);
  padding-right: var(--gr);
}
.archive-hero {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 5vh;
  margin-bottom: 6vh;
}
.archive-hero h2 {
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  line-height: 1.05;
  margin-bottom: 20px;
}
.archive-grid {
  display: block;
  margin-bottom: 8vh;
}
.mmca-solo-info {
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
.mmca-solo-info h3 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.mmca-solo-info ul {
  list-style: none;
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 24px 0;
  margin-bottom: 28px;
}
.mmca-solo-info li {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-secondary);
  display: flex;
  gap: 28px;
}
.mmca-solo-info li strong {
  color: var(--ink);
  font-weight: 600;
  min-width: 95px;
}

.mmca-links-row {
  display: flex;
  align-items: center;
  justify-content: flex-end; /* 웹사이트 방문 버튼을 포함한 액션 우측 정렬 */
  gap: 14px;
  margin-top: 16px;
}
.btn-mmca {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  border-radius: 0 !important;
  transition: all 0.2s ease;
}
.btn-mmca-primary {
  background: var(--ink);
  color: var(--bg-white);
  border: 1px solid var(--ink);
}
.btn-mmca-primary:hover {
  background: #333;
  color: #fff;
  transform: translateY(-1px);
}
.btn-mmca-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-soft);
}
.btn-mmca-secondary:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* ========================================================
   FLOATING 3D ARTWORK MODAL (라운딩 제거)
   ======================================================== */
#artworkModal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--gl);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#artworkModal.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 15, 14, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.modal-content-card {
  position: relative;
  z-index: 10;
  max-width: 1040px;
  width: 100%;
  max-height: 90vh;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0 !important; /* 라운딩 제거 */
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.4s var(--transition-smooth);
}
#artworkModal.active .modal-content-card {
  transform: scale(1) translateY(0);
}
.modal-visual-side {
  background: #0E0F0E;
  border-right: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.modal-photo-container {
  width: 100%;
  height: 100%;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.modal-photo-container img {
  width: 100%;
  height: 100%;
  max-height: 85vh;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.modal-text-side {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--ink-secondary);
  line-height: 1;
  z-index: 20;
  transition: color 0.2s ease;
}
.modal-close-btn:hover {
  color: var(--accent-red);
}
.modal-category {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--thread-color);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.modal-text-side h2 {
  font-family: var(--font-display);
  font-size: 1.95rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 6px;
}
.modal-text-side .modal-en-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 20px;
}
.modal-meta-table {
  width: 100%;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 0;
  margin-bottom: 20px;
  font-size: 13px;
}
.modal-meta-row {
  display: flex;
  margin-bottom: 6px;
}
.modal-meta-row:last-child {
  margin-bottom: 0;
}
.modal-meta-row span:first-child {
  width: 76px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.modal-meta-row span:last-child {
  color: var(--ink);
  font-weight: 400;
  flex: 1;
}

.modal-curator-desc {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-secondary);
  margin-bottom: 24px;
}

/* Audio Docent Player */
.docent-player-bar {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.btn-docent-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--thread-color);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 0 !important; /* 라운딩 제거 */
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-docent-play:hover {
  background: #124c3e;
  transform: translateY(-1px);
}
.docent-audio-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 860px) {
  .archive-grid,
  .modal-content-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .modal-visual-side {
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }
  .modal-text-side {
    padding: 24px 20px;
  }
  .thread-art-card {
    width: 260px;
  }
  .rubbing-instruction-bar {
    font-size: 12.5px;
    padding: 10px 16px;
    width: 90vw;
    text-align: center;
    white-space: normal;
  }
}
