@font-face {
  font-family: Cormorant;
  src: url(fonts/CormorantGaramond-SemiBold.woff2) format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Gowun Batang';
  src: url(fonts/GowunBatang-Regular.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+AC00-D7A3;
}
:root {
  color-scheme: dark;
  --ink: #f3ede1;
  --muted: #bfc4d5;
  --paper: #f1eadc;
  --paper-ink: #262b26;
  --title-type: Cormorant, 'Gowun Batang', Batang, Georgia, serif;
  font-family: 'Malgun Gothic', Arial, sans-serif;
  background: #080e1c;
  color: var(--ink);
}
* { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
  outline: none;
  padding: 7px 4px;
}
button:disabled { cursor: default; opacity: .38; }
button:not(:disabled):is(:hover, :focus-visible, :active) {
  text-decoration: underline;
  text-underline-offset: .27em;
}
button[aria-pressed='true'] { text-decoration: underline; text-underline-offset: .27em; }
.message { color: #f1c2ad; font-size: 13px; overflow-wrap: anywhere; text-align: center; padding: 0 12px 12px; }
.message[data-error='false'] { color: var(--muted); }

.gallery {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  align-content: start;
  overflow: hidden;
  background: radial-gradient(ellipse at 28% 80%, #122832, transparent 56%), radial-gradient(ellipse at 80% 16%, #1e203e, transparent 56%), #080e1c;
}
.gallery-depth { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.gallery-depth canvas { width: 100%; height: 100%; display: block; }
.gallery-head {
  min-height: 74px;
  padding: clamp(20px, 3.9vh, 40px) clamp(20px, 5vw, 76px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.gallery-head h1 { font: 600 clamp(30px, 3.6vw, 55px)/.92 var(--title-type); letter-spacing: -.047em; }
.gallery-navigation { display: flex; align-items: center; gap: clamp(13px, 2.1vw, 27px); }
.gallery-text { font-size: 14px; font-weight: 600; white-space: nowrap; }
.language-control { position: relative; z-index: 5; }
.language-menu { position: absolute; right: 0; top: 100%; min-width: 95px; background: #111a2a; padding: 3px 10px; display: grid; }
.language-menu button { text-align: left; }
.collections { display: flex; justify-content: center; gap: clamp(12px, 3.4vw, 49px); padding-inline: 10px; }
.collections .gallery-text { font-weight: 500; color: var(--muted); }
.collections .gallery-text[aria-pressed='true'] { color: var(--ink); font-weight: 700; }
.exhibition {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(14px, 3.6vw, 56px);
  height: clamp(300px, 55svh, 630px);
  overflow: auto hidden;
  padding-inline: max(17vw, calc((100vw - 870px) / 2));
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  perspective: 1100px;
  cursor: grab;
  touch-action: pan-x;
  outline: none;
}
.exhibition::-webkit-scrollbar { display: none; }
.exhibition.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.exhibit {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 min(66vw, 870px);
  height: 100%;
  min-height: 0;
  padding: 8px 0;
  scroll-snap-align: center;
  touch-action: pan-x;
  user-select: none;
}
.exhibit img {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100% - 24px);
  object-fit: contain;
  pointer-events: none;
  transform: scale(.87);
  opacity: .47;
  transition: transform .27s ease, opacity .27s ease;
}
.exhibit[aria-current='true'] img { transform: scale(1); opacity: 1; }
.exhibit:not([aria-current='true']):is(:hover, :focus-visible) img { transform: scale(.92); opacity: .83; }
.exhibition:focus-visible + .exhibition-record h2, .exhibition:has(.exhibit[aria-current='true']:focus-visible) + .exhibition-record h2 {
  text-decoration: underline;
  text-underline-offset: .22em;
}
.empty-exhibition { flex: 0 0 100%; text-align: center; color: var(--muted); font-size: 14px; }
.exhibition-record {
  display: grid;
  grid-template-columns: minmax(75px, 1fr) minmax(130px, auto) minmax(75px, 1fr);
  align-items: center;
  gap: 14px;
  margin: 15px auto 0;
  width: min(870px, calc(100% - 34px));
  text-align: center;
}
.caption { min-width: 0; display: grid; gap: 5px; }
.caption h2 { font: 600 clamp(22px, 2.45vw, 36px)/1.02 var(--title-type); max-width: min(50vw, 560px); margin-inline: auto; overflow-wrap: anywhere; text-wrap: balance; }
:lang(ko) .caption h2 { font-weight: 400; font-size: clamp(18px, 2vw, 28px); }
.caption a { color: var(--muted); font-size: 12px; text-decoration: none; }
.caption a:is(:hover, :focus-visible) { outline: none; text-decoration: underline; text-underline-offset: .25em; }
.exhibition-step:first-child { justify-self: start; }
.exhibition-step:last-child { justify-self: end; }
.entrance-actions { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 8px 0 15px; }
.entrance { font: 600 clamp(23px, 2.9vw, 39px)/1 var(--title-type); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .19em; padding-inline: 16px; }
:lang(ko) .entrance { font-size: clamp(19px, 2.35vw, 30px); }
.entry-effect { position: fixed; inset: 0; z-index: 12; overflow: hidden; pointer-events: none; }
.entry-effect img { position: absolute; object-fit: cover; transform-origin: center; will-change: transform, opacity, filter; }

.viewer {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100vw;
  isolation: isolate;
  overflow: hidden;
  color: #fffdf6;
  background: #182014;
  --control-text: 0 1px 2px #0a100df5, 0 1px 5px #0a100dbc;
}
.viewer:fullscreen { width: 100vw; height: 100vh; }
.viewport { position: absolute; inset: 0; background: center / cover no-repeat url(sample.jpg); touch-action: none; cursor: grab; outline: none; }
.viewport:active { cursor: grabbing; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.viewer button, .viewer output, .viewer .key-guide { text-shadow: var(--control-text); }
.viewer button { padding-inline: 6px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.viewer-toolbar {
  position: absolute;
  top: max(7px, env(safe-area-inset-top));
  left: max(11px, env(safe-area-inset-left));
  right: max(11px, env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0 10px;
  pointer-events: none;
}
.viewer-toolbar button { pointer-events: auto; }
.view-actions, .scene-options { display: flex; flex-wrap: wrap; gap: 0 9px; min-width: 0; }
.view-actions { justify-content: flex-end; order: 2; margin-left: auto; }
.scene-options { position: relative; order: 1; }
#share-status { position: absolute; top: 100%; left: 6px; max-width: min(86vw, 470px); overflow-wrap: anywhere; user-select: text; pointer-events: auto; font-size: 13px; }
#tour-count { position: absolute; right: 22px; bottom: 76px; z-index: 3; font-size: 13px; pointer-events: none; }
.viewer:has(#flight-pad:not([hidden])) #tour-count { right: 92px; }
.view-footer { position: absolute; left: 16px; right: 16px; bottom: max(9px, env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; pointer-events: none; }
.mode { display: flex; gap: 9px; }
.mode button { pointer-events: auto; }
.key-guide, .altitude { margin-left: auto; font-size: 12px; white-space: nowrap; }
.altitude { margin-left: 0; font-variant-numeric: tabular-nums; }
.viewer:has(.viewport:focus-visible) .key-guide { text-decoration: underline; text-underline-offset: .23em; }
.touch-pad, .flight-pad { position: absolute; bottom: 70px; z-index: 2; gap: 1px 6px; touch-action: none; }
.touch-pad { display: none; left: max(11px, env(safe-area-inset-left)); grid-template-columns: repeat(3, minmax(45px, max-content)); }
.touch-pad button:first-child { grid-column: 2; }
.touch-pad button:nth-child(2) { grid-column: 1; }
.flight-pad { display: grid; right: max(11px, env(safe-area-inset-right)); }
.touch-pad button, .flight-pad button { min-width: 44px; }
.original { position: absolute; inset: 0; display: grid; place-items: center; padding: 52px 14px 62px; background: #11151e; z-index: 2; }
.original img { display: block; width: 100%; height: 100%; min-height: 0; min-width: 0; object-fit: contain; }

dialog { max-width: min(740px, calc(100% - 22px)); max-height: calc(100svh - 22px); width: 100%; padding: 16px; border: 0; color: var(--paper-ink); background: var(--paper); }
dialog::backdrop { background: #0a101cdf; }
.dialog-head, .dialog-footer, .tools { display: flex; align-items: center; gap: 7px; }
.dialog-head, .dialog-footer { justify-content: space-between; }
.dialog-head h2 { font: 600 26px/1 var(--title-type); }
.tools { margin: 6px 0; flex-wrap: wrap; }
.tools button, .dialog-head button, .dialog-footer button { font-size: 13px; font-weight: 650; white-space: nowrap; padding-inline: 6px; }
.dialog-footer { margin-top: 7px; }
#exchange-works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(134px, 45%), 1fr));
  gap: 12px;
  margin-block: 12px;
  max-height: min(62svh, 560px);
  overflow: auto;
}
#exchange-works button { display: grid; align-content: start; gap: 6px; overflow-wrap: anywhere; text-align: start; }
#exchange-works img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
#exchange-works span { font-size: 12px; }
#exchange-status { font-size: 12px; }
@media (max-height: 520px) {
  #exchange-works { gap: 8px; margin-block: 7px; }
  #exchange-works img { height: clamp(48px, 20svh, 92px); aspect-ratio: auto; }
}
#apply { text-decoration: underline; text-underline-offset: .24em; }
.mark-image { position: relative; width: max-content; max-width: 100%; margin: auto; touch-action: none; cursor: crosshair; }
.mark-hint { font-size: .78rem; opacity: .78; margin: 0 0 .65rem; text-align: center; }
.mark-image img { display: block; max-width: 100%; max-height: calc(100svh - 248px); min-height: 85px; object-fit: contain; user-select: none; }
#mark-layer { position: absolute; inset: 0; pointer-events: none; }
.mark { position: absolute; border: 1px solid #f7eed4; background: #f7dd9622; }
.mark.is-detected { border-style: dashed; border-color: #d5edff; background: #b4ddff13; }
.mark.has-shape { background: none; }
.mark-shape { position: absolute; inset: 0; background: #9ed7ff50; }
.mark span { color: #fffdf3; text-shadow: 0 1px 3px #06110f; font-size: 11px; padding: 2px 3px; white-space: nowrap; position: absolute; top: 0; left: 0; }

@media (pointer: coarse) {
  .touch-pad { display: grid; }
  .key-guide { display: none; }
  .altitude { margin-left: auto; }
}
@media (max-width: 920px) {
  .view-actions { order: 0; }
  .scene-options { flex-basis: 100%; }
  .original { padding-top: 101px; }
}
@media (max-width: 760px) {
  .gallery-head { min-height: 66px; padding: 21px 17px; }
  .gallery-text { font-size: 13px; }
  .exhibition { height: clamp(270px, 39svh, 480px); padding-inline: 12vw; gap: 3vw; }
  .exhibit { flex-basis: 76vw; }
  .exhibition-record { width: calc(100% - 26px); gap: 8px; margin-top: 9px; }
  .caption h2 { max-width: 47vw; }
  .caption a { font-size: 11px; }
  .entrance-actions { margin-top: 7px; }
  .viewer button { font-size: 12px; padding-inline: 3px; }
  .view-actions, .scene-options { gap: 0 7px; }
  .view-footer { left: 10px; right: 10px; }
  .key-guide { display: none; }
  .altitude { margin-left: auto; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .gallery-head { min-height: 40px; padding-block: 3px; }
  .gallery-head h1 { font-size: 31px; }
  .collections .gallery-text { min-height: 32px; padding-block: 4px; }
  .exhibition { --panel: clamp(250px, 48vw, 465px); height: clamp(153px, 49svh, 235px); padding-inline: calc((100vw - var(--panel)) / 2); gap: 3vw; }
  .exhibit { flex-basis: var(--panel); }
  .exhibit img { max-height: calc(100% - 14px); }
  .exhibition-record { margin-top: 4px; }
  .caption { gap: 3px; }
  .caption h2 { font-size: 22px; }
  :lang(ko) .caption h2 { font-size: 16px; }
  .exhibition-record .gallery-text { min-height: 34px; }
  .entrance-actions { margin: 0 0 6px; }
  .entrance { min-height: 38px; font-size: 27px; }
  .touch-pad, .flight-pad { bottom: 58px; }
  .key-guide { display: none; }
}
@media (prefers-reduced-motion: reduce) { .exhibit img { transition: none; } }
