:root {
  color-scheme: dark;
  --ink: #edf0ee;
  --muted: rgba(237, 240, 238, .64);
  --line: rgba(237, 240, 238, .18);
  --surface: #252b2d;
  --deep: #171b1d;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--surface);
}

body {
  color: var(--ink);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }

a { color: inherit; }

button {
  color: inherit;
  border: 0;
  cursor: pointer;
}

.archive {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(28px, 5vw, 72px);
  background:
    radial-gradient(circle at 82% 17%, rgba(255, 255, 255, .08) 0 9rem, transparent 9.1rem),
    radial-gradient(circle at 14% 82%, rgba(255, 255, 255, .06) 0 14rem, transparent 14.1rem),
    linear-gradient(rgba(27, 32, 34, .31), rgba(27, 32, 34, .31)),
    url("./assets/background.jpg") center / cover fixed;
}

.archive::after {
  content: none;
}

.archive-head,
.works {
  position: relative;
  z-index: 1;
}

.archive-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.archive h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 5rem);
  font-weight: 200;
  letter-spacing: -.035em;
}

.home-link,
.book-link,
.reader-action {
  text-decoration: none;
  color: var(--muted);
  transition: color .25s ease, opacity .25s ease;
}

.home-link {
  font-size: 1.15rem;
}

.home-link:hover,
.home-link:focus-visible,
.book-link:hover .book-title,
.book-link:focus-visible .book-title,
.reader-action:hover,
.reader-action:focus-visible {
  color: var(--ink);
}

.archive-note {
  position: relative;
  z-index: 1;
  max-width: 35rem;
  margin: clamp(24px, 5vh, 58px) 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.6;
}

.works {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(36px, 7vw, 110px);
  width: min(1100px, 100%);
  margin: clamp(42px, 7vh, 90px) auto 0;
}

.book-link {
  display: block;
  outline: none;
}

.cover-wrap {
  position: relative;
  width: min(100%, 410px);
  margin: 0 auto;
}

.cover-wrap::before {
  content: "";
  position: absolute;
  width: 78%;
  aspect-ratio: 1;
  top: 11%;
  left: 11%;
  border-radius: 50%;
  background: rgba(128, 142, 143, .12);
  filter: blur(1px);
  transition: transform .55s ease, background .55s ease;
}

.book-link:hover .cover-wrap::before,
.book-link:focus-visible .cover-wrap::before {
  transform: scale(1.08);
  background: rgba(128, 142, 143, .18);
}

.cover {
  position: relative;
  display: block;
  width: 74%;
  aspect-ratio: 1;
  margin: 0 auto;
  object-fit: cover;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .22);
  transition: transform .55s cubic-bezier(.2,.7,.2,1), box-shadow .55s ease;
}

.book-link:hover .cover,
.book-link:focus-visible .cover {
  transform: translateY(-5px);
  box-shadow: 0 30px 72px rgba(0, 0, 0, .28);
}

.book-copy {
  display: block;
  width: 74%;
  max-width: 303px;
  margin: 25px auto 0;
}

.book-title {
  display: block;
  color: rgba(237, 240, 238, .9);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.35;
  transition: color .25s ease;
}

.book-meta {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: .9rem;
}

.reader {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  padding:
    max(16px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: var(--deep);
}

.reader-top,
.reader-bottom {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 18px;
}

.reader-top { justify-content: space-between; }
.reader-bottom { justify-content: center; }

.reader-action {
  padding: 9px 4px;
  background: transparent;
  font-size: .95rem;
}

.reader-title {
  position: absolute;
  left: 50%;
  max-width: 50%;
  overflow: hidden;
  transform: translateX(-50%);
  color: rgba(237, 240, 238, .52);
  font-size: .86rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.page-image,
.page-half {
  display: block;
  max-width: calc(100vw - 112px);
  max-height: calc(100svh - 142px);
  width: auto;
  height: auto;
  object-fit: contain;
  background-color: white;
  box-shadow: 0 12px 46px rgba(0,0,0,.28);
}

.page-half {
  width: min(calc(100vw - 48px), calc((100svh - 142px) * 1));
  aspect-ratio: 1;
  background-repeat: no-repeat;
  background-size: 200% 100%;
}

.page-half.right { background-position: right center; }
.page-half.left { background-position: left center; }

.nav {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: min(14vw, 150px);
  display: grid;
  place-items: center;
  background: transparent;
  opacity: .48;
  transition: opacity .25s ease;
}

.nav:hover,
.nav:focus-visible { opacity: 1; }
.nav:disabled { cursor: default; opacity: .08; }
.nav-prev { left: 0; }
.nav-next { right: 0; }

.chevron {
  width: 20px;
  height: 20px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
}

.nav-prev .chevron { transform: rotate(-135deg); }
.nav-next .chevron { transform: rotate(45deg); }

.counter {
  color: rgba(237, 240, 238, .48);
  font-size: .84rem;
  letter-spacing: .08em;
}

.reader:fullscreen {
  width: 100vw;
  height: 100vh;
}

@media (max-width: 720px) {
  .archive { padding: 28px 22px 44px; }
  .archive-head { align-items: flex-start; }
  .archive h1 { font-size: 2.65rem; }
  .home-link { padding-top: 7px; font-size: 1.04rem; }
  .archive-note { margin-top: 28px; }
  .works {
    grid-template-columns: 1fr;
    gap: 64px;
    margin-top: 52px;
  }
  .cover-wrap { width: min(100%, 360px); }
  .reader-title { display: none; }
  .page-image,
  .page-half {
    max-width: calc(100vw - 42px);
    max-height: calc(100svh - 136px);
  }
  .nav { width: 54px; }
}

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