/* -------------------------------------------------------------- archive */

.arch-hero {
  width: min(var(--mag-max), 100%);
  margin: 0 auto;
  padding: clamp(56px, 10vh, 120px) var(--mag-gutter) clamp(24px, 4vh, 48px);
  display: grid;
  justify-items: center;
  gap: 20px;
  text-align: center;
}

.arch-hero h1 {
  margin: 0;
  font-family: var(--mag-serif);
  font-size: 2.7rem;
  font-weight: 700;
  line-height: 1.28;
  word-break: keep-all;
}

.arch-hero__standfirst {
  max-width: 28rem;
  margin: 0;
  color: var(--mag-ink-soft);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.9;
  word-break: keep-all;
}

/* ----------------------------------------------------------------- shelf */

.arch-shelf-wrap {
  width: min(var(--mag-max), 100%);
  margin: 0 auto;
  padding: clamp(32px, 6vh, 72px) var(--mag-gutter) 0;
}

.arch-shelf {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: clamp(40px, 6vw, 96px);
  padding: 48px clamp(8px, 2vw, 24px) 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: clamp(8px, 2vw, 24px);
  scrollbar-width: thin;
  scrollbar-color: var(--mag-rule-strong) transparent;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
  user-select: none;
}

.arch-shelf.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.arch-shelf .arch-book {
  cursor: inherit;
}

.arch-shelf img {
  -webkit-user-drag: none;
}

.arch-shelf::-webkit-scrollbar {
  height: 5px;
}

.arch-shelf::-webkit-scrollbar-track {
  background: transparent;
}

.arch-shelf::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--mag-rule-strong);
}

.arch-shelf__ledge {
  height: 1px;
  background: var(--mag-rule-strong);
  box-shadow: 0 1px 0 rgba(26, 24, 21, 0.06);
}

/* ------------------------------------------------------------------ book */

.arch-book {
  --book-w: clamp(170px, 19vw, 230px);
  --book-d: 30px;
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 22px;
  padding-bottom: 26px;
  scroll-snap-align: start;
}

.arch-book__body {
  position: relative;
  display: block;
  width: var(--book-w);
  aspect-ratio: 1500 / 2093;
  perspective: 1300px;
  perspective-origin: 50% 42%;
}

/* the rotating volume — spine, back cover, front cover */
.arch-book__vol {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transform: rotateY(32deg);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.arch-book:hover .arch-book__vol,
.arch-book:focus-visible .arch-book__vol {
  transform: rotateY(8deg) translateY(-18px) translateZ(26px);
}

.arch-book:focus-visible {
  outline: none;
}

.arch-book:focus-visible .arch-book__caption strong {
  text-decoration: underline;
  text-underline-offset: 0.24em;
}

/* floor shadow — stays on the ground, reacts to the lift */
.arch-book__body::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -10%;
  bottom: -25px;
  height: 20px;
  background: radial-gradient(
    50% 100% at 42% 0,
    rgba(26, 24, 21, 0.32),
    transparent 74%
  );
  filter: blur(3px);
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.arch-book:hover .arch-book__body::after,
.arch-book:focus-visible .arch-book__body::after {
  opacity: 0.55;
  transform: scaleX(0.86) translateY(2px);
}

/* back cover — gives the volume its mass */
.arch-book__back {
  position: absolute;
  inset: 0;
  transform: translateZ(calc(var(--book-d) * -1));
  background: #362f27;
  border-radius: 0 4px 4px 0;
  backface-visibility: visible;
}

.arch-book__cover {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: inline-size;
  background: #504238;
  border-radius: 0 3px 3px 0;
  backface-visibility: hidden;
  box-shadow: inset 3px 0 6px -3px rgba(255, 255, 255, 0.28);
}

/* page-block hint along the fore-edge of the front cover */
.arch-book__cover::after {
  content: "";
  position: absolute;
  top: 1%;
  right: 0;
  bottom: 1%;
  width: 5px;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(247, 244, 238, 0.85) 0 1px,
      rgba(214, 207, 194, 0.85) 1px 2px
    );
  opacity: 0.55;
}

.arch-book__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95) contrast(0.96) brightness(0.9);
}

.arch-book__cover-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #fff;
}

/* soft sheen that sweeps across the cover as the book is pulled out */
.arch-book__cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.13) 50%,
    transparent 62%
  );
  transform: translateX(-130%);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.arch-book:hover .arch-book__cover::before,
.arch-book:focus-visible .arch-book__cover::before {
  transform: translateX(130%);
}

.arch-book__cover-title {
  position: absolute;
  top: 4cqw;
  left: 6.5cqw;
  font-size: 11cqw;
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: 0;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.95);
}

.arch-book__cover-season {
  position: absolute;
  top: 13cqw;
  right: 5cqw;
  color: var(--mag-accent);
  font-family: var(--mag-serif);
  font-size: 8cqw;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}

.arch-book__cover-script {
  position: absolute;
  right: 3cqw;
  bottom: 12cqw;
  transform: rotate(-6deg);
  color: rgba(255, 255, 255, 0.94);
  font-family: var(--mag-serif);
  font-size: 10cqw;
  font-style: italic;
  line-height: 0.92;
  text-align: right;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

/* spine — left face of the book, folded backwards from the cover's edge */
.arch-book__spine {
  position: absolute;
  top: 0;
  left: calc(var(--book-d) * -1);
  width: var(--book-d);
  height: 100%;
  transform-origin: right center;
  transform: rotateY(-90deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 16px;
  background: linear-gradient(90deg, #2c2620, #3d352c 55%, #332c25);
  color: rgba(247, 244, 238, 0.92);
}

.arch-book__spine-title,
.arch-book__spine-issue {
  writing-mode: vertical-rl;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.arch-book__spine-issue {
  color: rgba(247, 244, 238, 0.6);
}

.arch-book__caption {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.arch-book__caption strong {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.arch-book__caption span {
  color: var(--mag-ink-soft);
  font-family: var(--mag-serif);
  font-size: 0.92rem;
  font-weight: 500;
  word-break: keep-all;
}

/* ghost slot — upcoming issue */

.arch-book--ghost .arch-book__vol {
  transform: none;
  transform-style: flat;
}

.arch-book--ghost .arch-book__body {
  perspective: none;
}

.arch-book--ghost .arch-book__body::after {
  display: none;
}

.arch-book__ghost-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  border: 1px dashed rgba(26, 24, 21, 0.36);
}

.arch-book__ghost-face span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--mag-ink-soft);
}

.arch-book__ghost-face em {
  font-family: var(--mag-serif);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 500;
  color: var(--mag-ink-soft);
}

/* ----------------------------------------------------------------- index */

.arch-index {
  width: min(var(--mag-max), 100%);
  margin: 0 auto;
  padding: clamp(56px, 9vh, 110px) var(--mag-gutter) clamp(64px, 10vh, 128px);
}

.arch-index__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.arch-index__row {
  display: grid;
  grid-template-columns: minmax(72px, 0.16fr) minmax(110px, 0.24fr) 1fr auto;
  gap: clamp(14px, 3vw, 40px);
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--mag-rule);
}

.arch-index__vol {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.arch-index__season {
  color: var(--mag-ink-soft);
  font-family: var(--mag-serif);
  font-size: 0.95rem;
  font-style: italic;
}

.arch-index__title {
  font-family: var(--mag-serif);
  font-size: 1.28rem;
  font-weight: 700;
  word-break: keep-all;
}

.arch-index__go {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--mag-ink-soft);
  word-break: keep-all;
}

a.arch-index__row:hover .arch-index__go,
a.arch-index__row:focus-visible .arch-index__go {
  color: var(--mag-ink);
  text-decoration: underline;
  text-underline-offset: 0.24em;
}

.arch-index__row--soon {
  opacity: 0.52;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 720px) {
  .arch-hero h1 {
    font-size: 2.1rem;
  }

  .arch-hero__standfirst {
    font-size: 0.98rem;
  }

  .arch-shelf {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 32px;
    overflow-x: auto;
    padding-right: var(--mag-gutter);
    padding-left: var(--mag-gutter);
  }

  .arch-index__row {
    grid-template-columns: minmax(64px, auto) 1fr auto;
  }

  .arch-index__season {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arch-book__vol,
  .arch-book__body::after,
  .arch-book__cover::before {
    transition: none;
  }

  .arch-book__cover::before {
    display: none;
  }
}

/* 호별 책등 색상 + 표지 호수 (3개 호 대응) */
.arch-book__spine {
  background: linear-gradient(90deg, #2c2620, #3d352c 55%, #332c25);
  border-left: 3px solid var(--spine, transparent);
}

.arch-book__cover-no {
  position: absolute;
  right: 6cqw;
  bottom: 8cqw;
  font-family: var(--mag-serif);
  font-size: 5cqw;
  color: rgba(255, 255, 255, 0.9);
  writing-mode: vertical-rl;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.arch-book__cover-season { color: var(--cover-accent, #7fe6e8); }

.arch-book__cover-title {
  top: 5cqw;
  left: 5cqw;
  right: 5cqw;
  font-size: 10.4cqw;
  letter-spacing: -0.03em;
  text-align: center;
}

.arch-book__cover-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12,10,8,0.5), transparent 36%, rgba(12,10,8,0.66));
  z-index: -1;
}

/* 4권 이상 수용 — 폭·간격 축소 */
.arch-shelf { gap: clamp(26px, 3.6vw, 62px); }

.arch-book {
  --book-w: clamp(148px, 14.5vw, 198px);
  --book-d: 26px;
}

@media (max-width: 1100px) {
  .arch-shelf { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .arch-shelf .arch-book {
    --book-w: min(168px, calc(100vw - (4 * var(--mag-gutter))));
  }
}
