:root {
  --archive-bg: #f0f1f3;
  --archive-ink: #22211f;
  --archive-muted: #85868a;
  --archive-line: #c9cace;
  --archive-serif: 'Playfair Display', 'Noto Serif KR', Georgia, serif;
  --archive-sans: 'DM Sans', 'Noto Sans KR', system-ui, sans-serif;
}

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

body.archive-page {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--archive-bg);
  color: var(--archive-ink);
  font-family: var(--archive-sans);
  -webkit-font-smoothing: antialiased;
}

.archive-page a { color: inherit; text-decoration: none; }

.archive-home {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 14px clamp(22px, 3.2vw, 56px) 28px;
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.archive-brand {
  font-family: var(--archive-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.archive-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--archive-muted);
  font-family: var(--archive-serif);
  font-size: 12px;
  text-transform: uppercase;
}

.archive-nav a { transition: color 180ms ease; }
.archive-nav a:hover,
.archive-nav a:focus-visible,
.archive-nav a[aria-current="page"] { color: var(--archive-ink); }

.archive-stage {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 390px;
  margin: 3vh calc(clamp(22px, 3.2vw, 56px) * -1) 2vh;
  overflow: hidden;
  perspective: 1100px;
}

.archive-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: archive-drift 48s linear infinite;
  will-change: transform;
}

.archive-set {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: clamp(20px, 2.15vw, 38px);
  padding-inline: clamp(28px, 3.2vw, 56px);
}

.archive-track:has(.archive-card:focus-visible) { animation-play-state: paused; }
.archive-track.is-interactive { animation: none; }
.archive-stage:has(.is-interactive) { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.archive-stage.is-dragging { cursor: grabbing; }
.archive-stage.is-dragging .archive-card { pointer-events: none; }

.archive-card {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: clamp(155px, 10.7vw, 198px);
  aspect-ratio: 0.75;
  overflow: visible;
  scroll-snap-align: start;
  transform: rotateY(-5deg) rotateZ(-0.7deg);
  transition: transform 450ms ease, box-shadow 450ms ease;
}

.archive-card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #d9dadd;
  box-shadow: 0 12px 28px rgb(31 31 33 / 8%);
  transition: box-shadow 450ms ease;
}

.archive-card-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.archive-mobile-caption { display: none; }

.archive-card:nth-child(4n + 2) { transform: translateY(5px) rotateY(4deg) rotateZ(1deg); }
.archive-card:nth-child(4n + 3) { transform: translateY(-4px) rotateY(-3deg) rotateZ(-1.2deg); }
.archive-card:nth-child(4n) { transform: translateY(2px) rotateY(5deg) rotateZ(0.6deg); }
.archive-card:focus-visible { outline: 2px solid var(--archive-ink); outline-offset: 5px; }

.archive-overlay {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgb(0 0 0 / 68%);
  color: #fff;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
  pointer-events: none;
}

.archive-number { margin-bottom: 0.7rem; font-family: var(--archive-serif); font-size: 12px; }
.archive-title { margin: 0; font-family: var(--archive-sans); font-size: 20px; font-weight: 400; line-height: 1.25; white-space: pre-line; overflow-wrap: anywhere; }
.archive-subtitle { margin-top: 0.7rem; font-family: var(--archive-serif); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.archive-card:hover .archive-overlay,
.archive-card:focus-visible .archive-overlay,
.archive-card:active .archive-overlay { opacity: 1; visibility: visible; }

@media (hover: hover) and (pointer: fine) {
  .archive-track:has(.archive-card:hover) { animation-play-state: paused; }
  .archive-card:hover { transform: translateY(-8px) scale(1.025); }
  .archive-card:hover .archive-card-face { box-shadow: 0 18px 34px rgb(31 31 33 / 15%); }
}

@media (hover: none) and (pointer: coarse) {
  .archive-track:has(.archive-card:active) { animation-play-state: paused; }
  .archive-card:active { transform: scale(1.025); }
  .archive-card:active .archive-card-face { box-shadow: 0 18px 34px rgb(31 31 33 / 15%); }
}

.archive-footer { width: 100%; margin: auto auto 0; text-align: center; }
.archive-credit {
  margin-top: -2px;
  color: var(--archive-muted);
  font-family: var(--archive-serif);
  font-size: 12px;
  line-height: 1.6;
}
.archive-contact {
  display: inline-block;
  margin-top: 3px;
  color: var(--archive-muted);
  font-family: var(--archive-serif);
  font-size: 11px;
  line-height: 1.6;
}

body[data-collection="diary"] .archive-credit {
  position: relative;
  top: -1.4px;
}

body[data-collection="diary"] .archive-contact {
  position: relative;
  top: -1.4px;
}

.about-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.about-photo {
  display: block;
  width: 260px;
  max-width: 72vw;
  aspect-ratio: 4 / 5;
  background: #d9dadd;
  object-fit: cover;
}

.about-copy { width: min(100%, 480px); margin-top: 22px; text-align: center; }
.about-name { margin: 0; font: 400 20px/1.4 var(--archive-serif); }
.about-bio { margin-top: 8px; color: #626267; font-size: 14px; line-height: 1.8; }
.about-bio p { white-space: pre-line; }
.about-bio p + p { margin-top: 1em; }
.detail-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 390px;
  padding: 64px clamp(24px, 8vw, 120px) 32px;
}

.detail-back {
  position: absolute;
  top: 24px;
  left: clamp(24px, 8vw, 120px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--archive-muted);
  cursor: pointer;
  font: 10px var(--archive-serif);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-back:hover,
.detail-back:focus-visible { color: var(--archive-ink); }

.detail-back-home { color: var(--archive-muted); font: 11px var(--archive-serif); letter-spacing: 0.12em; }
.detail-back-home:hover,
.detail-back-home:focus-visible { color: var(--archive-ink); }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  width: min(100%, 650px);
}

.detail-copy { max-width: 650px; text-align: center; }
.detail-number { color: var(--archive-muted); font: 11px var(--archive-serif); }
.detail-title { margin: 16px 0 10px; font: 400 38px/1.2 var(--archive-serif); white-space: pre-line; overflow-wrap: anywhere; }
.detail-subtitle { color: var(--archive-muted); font: 14px/1.7 var(--archive-sans); }
.detail-rule { width: 48px; height: 1px; margin: 24px auto; background: var(--archive-line); }
.detail-description { max-width: 520px; margin: 0 auto; color: #626267; font: 13px/1.9 var(--archive-sans); text-align: left; overflow-wrap: anywhere; }
.detail-description p { white-space: pre-line; }
.detail-description p + p { margin-top: 1em; }
.detail-body-image { display: block; width: 100%; height: auto; margin: 24px 0; }
.detail-image { display: block; width: min(100%, 360px); max-width: 100%; aspect-ratio: 0.75; margin: 0 auto 28px; object-fit: cover; background: #d9dadd; }
.detail-image[hidden], .detail-description[hidden] { display: none; }

@media (max-width: 768px) {
  .archive-home { min-height: 100svh; padding: 18px 7.5vw 24px; }
  .archive-nav { gap: 14px; font-size: 11px; }
  .archive-stage { min-height: 0; margin: 0 -7.5vw; }
  .archive-set { gap: 26px; padding-inline: 7.5vw; }
  .archive-card { display: flex; width: min(43vw, 190px); aspect-ratio: auto; flex-direction: column; gap: 9px; transform: rotateY(-3deg) rotateZ(-0.5deg); }
  .archive-card-face { position: relative; inset: auto; flex: 0 0 auto; width: 100%; aspect-ratio: 0.75; }
  .archive-mobile-caption { display: flex; min-height: 42px; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
  .archive-mobile-number { color: var(--archive-muted); font: 10px/1.3 var(--archive-serif); }
  .archive-mobile-title { color: var(--archive-ink); font: 12px/1.4 var(--archive-serif); overflow-wrap: anywhere; }
  .archive-overlay { display: none; }
  .archive-card:nth-child(4n + 2) { transform: translateY(2px) rotateY(3deg) rotateZ(0.7deg); }
  .archive-card:nth-child(4n + 3) { transform: translateY(-2px) rotateY(-2deg) rotateZ(-0.7deg); }
  .archive-card:nth-child(4n) { transform: translateY(1px) rotateY(3deg) rotateZ(0.4deg); }
  .about-stage { padding: 24px 20px; }
  .about-photo { width: 220px; }
  .detail-stage { display: block; min-height: 0; padding: 60px 7.5vw 28px; }
  .detail-back { top: 14px; left: 7.5vw; }
  .detail-layout { width: min(100%, 430px); margin: 0 auto; }
  .detail-copy { width: 100%; margin: 0 auto; text-align: center; }
  .detail-title { margin: 12px 0 8px; font-size: 28px; }
  .detail-rule { margin: 18px auto; }
}

@media (max-width: 350px) {
  .archive-brand { font-size: 10px; }
  .archive-nav { gap: 10px; font-size: 10px; }
}

@keyframes archive-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .archive-track { animation: none; }
  .archive-card,
  .archive-overlay { transition: none; }
}
