:root {
  --ink: #f8f4ec;
  --muted: rgba(248, 244, 236, 0.72);
  --gold: #c5a06d;
  --panel: rgba(10, 22, 19, 0.72);
  --line: rgba(248, 244, 236, 0.14);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(10, 22, 19, 0.55), rgba(10, 22, 19, 0.94)),
    url("assets/hero-clean.jpg") center / cover fixed,
    #0d201c;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(8, 18, 16, 0.28);
}

button {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 28px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  margin-bottom: 10px;
}

.logo {
  width: min(190px, 50vw);
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.42));
}

.masthead div {
  text-align: right;
}

.masthead p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 4.5rem);
  font-weight: 500;
  line-height: 0.9;
}

.page-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  width: min(760px, 100%);
  margin: 0 auto 18px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(248, 244, 236, 0.08);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.page-tabs::-webkit-scrollbar {
  display: none;
}

.page-tabs button {
  flex: 1 0 0;
  min-height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
}

.page-tabs button[aria-current="true"] {
  background: var(--ink);
  color: #10251f;
}

.book-stage {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 14px;
}

.book {
  display: flex;
  gap: min(4vw, 34px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 18px max(22px, calc((100% - 460px) / 2)) 28px;
  perspective: 1200px;
  scrollbar-width: none;
}

.book::-webkit-scrollbar {
  display: none;
}

.page-card {
  flex: 0 0 min(460px, 82vw);
  scroll-snap-align: center;
  transform: rotateY(var(--tilt, 0deg)) translateY(var(--lift, 0));
  transform-origin: center;
  transition: transform 220ms ease, filter 220ms ease, opacity 220ms ease;
  filter: saturate(var(--sat, 0.88)) brightness(var(--bright, 0.82));
  opacity: var(--opacity, 0.74);
}

.page-card.is-active {
  filter: saturate(1) brightness(1);
  opacity: 1;
}

.page-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  user-select: none;
}

.turn-button {
  width: 48px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(248, 244, 236, 0.08);
  color: var(--ink);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  backdrop-filter: blur(18px);
}

.turn-button:disabled {
  opacity: 0.28;
  cursor: default;
}

.page-status {
  display: flex;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.86rem;
}

.page-status span:first-child {
  color: var(--ink);
  font-weight: 750;
}

.viewer {
  width: min(940px, calc(100vw - 22px));
  max-height: calc(100vh - 22px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.viewer::backdrop {
  background: rgba(4, 11, 10, 0.86);
  backdrop-filter: blur(8px);
}

.viewer img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 22px);
  object-fit: contain;
  border-radius: 8px;
}

.viewer__close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(8, 18, 16, 0.72);
  color: #fff;
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .shell {
    padding: 18px 0 22px;
  }

  .masthead {
    min-height: 72px;
    padding: 0 18px;
  }

  .logo {
    width: min(165px, 48vw);
  }

  .masthead h1 {
    font-size: 2.25rem;
  }

  .page-tabs {
    width: calc(100% - 24px);
    margin-bottom: 6px;
  }

  .page-tabs button {
    min-height: 36px;
    padding-inline: 13px;
  }

  .book-stage {
    display: block;
  }

  .turn-button {
    display: none;
  }

  .book {
    gap: 18px;
    padding: 14px 10vw 18px;
  }

  .page-card {
    flex-basis: min(78vw, 350px);
  }

  .page-card img {
    border-radius: 5px;
  }
}

@media (max-width: 420px) {
  .masthead div {
    display: none;
  }

  .masthead {
    justify-content: center;
  }

  .logo {
    width: min(190px, 58vw);
  }

  .page-tabs {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    background: rgba(248, 244, 236, 0.1);
  }

  .book {
    padding-inline: 7vw;
  }

  .page-card {
    flex-basis: min(82vw, 340px);
  }
}
