:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #111111;
  --line: #e7e7e7;
  --line-strong: #d5d5d5;
  --lightbox-zoom: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  overflow: hidden;
}

.page-wrap {
  width: min(1920px, 90vw);
  margin: 0 auto;
  padding: 0.5rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.hero {
  text-align: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

h1 {
  margin: 0.3rem 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: #5c5c5c;
}

.book-shell {
  border: 1px solid var(--line);
  /*background: var(--panel);*/
  background: #e6e6e6;
  padding: 0.8rem;
  flex: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  display: flex;
}

.book {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  width: 100%;
}

.page {
  background: #f9f9f9;
  border: 1px solid var(--line);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  transform-origin: center;
  position: relative;
}

.page.turn-left {
  animation: turnLeft 320ms ease;
}

.page.turn-right {
  animation: turnRight 320ms ease;
}

@keyframes turnLeft {
  0% { transform: translateX(0); }
  50% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}

@keyframes turnRight {
  0% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
  100% { transform: translateX(0); }
}

.page-title {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: #666;
  position: absolute;
  bottom: 0.85rem;
  left: 0.85rem;
  right: 0.85rem;
}

.page.right .page-title {
  left: auto;
  right: 0.85rem;
  text-align: right;
}

.page-grid {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  padding-bottom: 2rem;
}

.photo-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  height: 100%;
}

.photo-card button {
  all: unset;
  cursor: zoom-in;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: transform 300ms ease-out, box-shadow 300ms ease-out;
}

.photo-card button:hover,
.photo-card button:focus-visible {
  border-color: var(--line-strong);
  transform: scale(1.01);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  display: block;
  filter: contrast(0.99) saturate(0.95);
}

.photo-card figcaption {
  font-size: 0.78rem;
  color: #666;
  letter-spacing: 0.03em;
}

.controls {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.arrow-hint {
  font-size: 0.85rem;
  color: #888;
  margin: 0;
  letter-spacing: 0.02em;
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: none;
  padding: 0;
  background: transparent;
  overflow: visible;
  display: none;
}

.lightbox[open] {
  display: block;
}

.lightbox::backdrop {
  background: #f5f5f5;
}

.lightbox::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(80vw, calc(80vh * 16 / 9));
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
  pointer-events: none;
  z-index: 0;
}

.lightbox img {
  position: absolute;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
  display: block;
  background: #fff;
  transform: scale(var(--lightbox-zoom));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transform-origin: center;
  opacity: 1;
  transition: opacity 500ms ease-in-out;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}

.lightbox img.fade-out {
  opacity: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox img.fade-in {
  animation: fadeIn 500ms ease-in-out;
}

.lightbox-hint {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 1rem;
  color: #999;
  margin: 0;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.lightbox-close {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #222;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  margin: 0 0 0.45rem;
  display: none;
}

#lightboxCaption {
  position: relative;
  z-index: 1;
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #666;
  display: none;
}

@media (max-width: 900px) {
  .book {
    grid-template-columns: 1fr;
  }

  .page {
    min-height: 300px;
  }
}
