:root {
  --paper: #f4eddf;
  --paper-deep: #e0d1b4;
  --ink: #30291e;
  --muted: #736b58;
  --olive: #74795a;
  --olive-dark: #444a33;
  --warm-shadow: rgba(59, 47, 31, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Noto Serif KR", serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.72), transparent 27%),
    radial-gradient(circle at 88% 10%, rgba(129, 136, 93, 0.18), transparent 24%),
    linear-gradient(135deg, rgba(255, 253, 245, 0.88), rgba(218, 202, 170, 0.46)),
    var(--paper);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.48;
  background-image:
    linear-gradient(rgba(74, 64, 44, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 64, 44, 0.035) 1px, transparent 1px),
    radial-gradient(circle, rgba(72, 61, 42, 0.1) 0 0.7px, transparent 1px);
  background-size: 44px 44px, 44px 44px, 7px 7px;
  mix-blend-mode: multiply;
}

button {
  font: inherit;
}

.page {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 54px);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1460px;
  margin: 0 auto clamp(18px, 3vw, 34px);
}

.topbar p,
.kicker {
  margin: 0;
  color: var(--olive-dark);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: break-word;
}

h1,
h2 {
  word-break: keep-all;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 6.7rem);
  font-weight: 500;
  line-height: 0.92;
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
  gap: clamp(18px, 3vw, 34px);
  align-items: stretch;
  max-width: 1460px;
  margin: 0 auto;
}

.stage-shell {
  overflow: visible;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1376 / 768;
  overflow: hidden;
  border: 1px solid rgba(78, 68, 49, 0.18);
  background: #eee5d2;
  box-shadow:
    0 34px 86px rgba(66, 53, 36, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: default;
  isolation: isolate;
  touch-action: manipulation;
}

.stage.is-clickable {
  cursor: pointer;
}

.stage::after {
  position: absolute;
  inset: 0;
  z-index: 20;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 55%, rgba(54, 43, 29, 0.12) 100%),
    linear-gradient(135deg, rgba(255, 252, 238, 0.22), transparent 42%);
  mix-blend-mode: multiply;
}

.background {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.object-layer {
  position: absolute;
  z-index: var(--z);
  width: var(--w);
  height: var(--h);
  left: var(--x);
  top: var(--y);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translateZ(0) scale(1);
  transform-origin: center;
  transition:
    opacity 160ms ease,
    transform 420ms cubic-bezier(0.19, 1, 0.22, 1),
    filter 420ms cubic-bezier(0.19, 1, 0.22, 1);
  will-change: transform, opacity, filter;
}

.object-layer.is-active,
.object-layer.is-selected {
  opacity: 1;
  transform: translateZ(0) scale(1.055);
  filter:
    drop-shadow(0 22px 22px rgba(45, 35, 23, 0.26))
    drop-shadow(0 0 11px rgba(255, 249, 228, 0.82))
    brightness(1.035)
    saturate(1.035);
}

.object-layer.is-selected {
  transform: translateZ(0) scale(1.08);
}

.info-panel {
  display: flex;
  min-height: 410px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid rgba(78, 68, 49, 0.18);
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 0.88), rgba(233, 222, 200, 0.72)),
    rgba(255, 252, 243, 0.84);
  box-shadow: 0 26px 64px rgba(66, 53, 36, 0.13);
}

.info-panel h2 {
  margin: 10px 0 16px;
  font-size: clamp(1.8rem, 3vw, 3.05rem);
  font-weight: 500;
  line-height: 1.02;
}

.detail-copy h2 {
  margin: 10px 0 16px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 500;
  line-height: 1.02;
}

.info-panel p:not(.kicker),
.detail-copy p:not(.kicker) {
  margin: 0;
  color: #625943;
  font-size: clamp(0.98rem, 1.2vw, 1.12rem);
  line-height: 1.78;
}

.detail-button,
.back-button {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 42px;
  border: 0;
  color: var(--olive-dark);
  background: transparent;
  cursor: pointer;
}

.detail-button {
  margin-top: 30px;
  padding: 0 0 5px;
  border-bottom: 1px solid rgba(68, 74, 51, 0.42);
}

.detail-button:disabled {
  cursor: default;
  opacity: 0.44;
}

.detail {
  max-width: 1220px;
  margin: clamp(30px, 5vw, 72px) auto 0;
  padding-top: clamp(24px, 4vw, 54px);
  border-top: 1px solid rgba(78, 68, 49, 0.18);
}

.detail[hidden] {
  display: none;
}

.back-button {
  gap: 10px;
  margin-bottom: clamp(26px, 4vw, 48px);
  padding: 0;
}

.back-button span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(68, 74, 51, 0.34);
  border-radius: 50%;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(280px, 0.7fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: center;
}

.detail-art {
  display: grid;
  min-height: clamp(320px, 52vh, 620px);
  place-items: center;
  border-top: 1px solid rgba(78, 68, 49, 0.14);
  border-bottom: 1px solid rgba(78, 68, 49, 0.14);
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.36), transparent),
    repeating-linear-gradient(0deg, rgba(74, 64, 44, 0.025) 0 1px, transparent 1px 9px);
}

.detail-art img {
  display: block;
  max-width: min(86%, 640px);
  max-height: min(70vh, 640px);
  object-fit: contain;
  filter:
    drop-shadow(0 30px 36px rgba(43, 35, 25, 0.24))
    drop-shadow(0 0 12px rgba(255, 248, 224, 0.88));
}

.transition-veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 252, 241, 0.9), rgba(225, 212, 187, 0.78) 62%, rgba(76, 70, 50, 0.2)),
    rgba(239, 230, 212, 0.64);
  transition: opacity 420ms ease;
}

.transition-veil.is-active {
  opacity: 1;
}

.transition-ghost {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  object-fit: contain;
  transform-origin: center;
  filter:
    drop-shadow(0 30px 42px rgba(49, 39, 28, 0.32))
    drop-shadow(0 0 14px rgba(255, 247, 220, 0.86));
  transition:
    left 640ms cubic-bezier(0.19, 1, 0.22, 1),
    top 640ms cubic-bezier(0.19, 1, 0.22, 1),
    width 640ms cubic-bezier(0.19, 1, 0.22, 1),
    height 640ms cubic-bezier(0.19, 1, 0.22, 1),
    opacity 220ms ease;
}

.transition-ghost.is-fading {
  opacity: 0;
}

@media (max-width: 1040px) {
  .topbar,
  .archive-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: block;
  }

  .topbar p {
    margin-bottom: 8px;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 18px;
  }

  .stage-shell {
    width: calc(100vw - 36px);
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .stage {
    width: 760px;
  }

  .info-panel {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
