:root {
  color-scheme: dark;
  --ink: #f7f3ea;
  --line: rgba(247, 243, 234, 0.28);
  --blue: #89ddff;
  --gold: #f0c66d;
  --mx: 50%;
  --my: 50%;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

@font-face {
  font-family: "PortfolioScript";
  src: url("fonts/dancing-script-600.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 600;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  touch-action: manipulation;
  background:
    linear-gradient(135deg, #030406 0%, #06090d 38%, #11070c 64%, #04100d 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

#chrome-canvas,
.surface-vignette {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#chrome-canvas {
  z-index: 0;
  filter: blur(10px) saturate(1.08);
  transform: scale(1.035);
  transform-origin: center;
}

.surface-vignette {
  z-index: 1;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 18% 72%, rgba(255, 255, 255, 0.06)),
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.24), transparent 17rem),
    radial-gradient(circle at 50% 115%, rgba(0, 0, 0, 0.88), transparent 34rem),
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.62));
  mix-blend-mode: screen;
}

.loading-page {
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
}

.loader-shell {
  position: relative;
  z-index: 2;
}

.loader-shell {
  display: grid;
  width: min(920px, calc(100vw - 32px));
  min-height: 100svh;
  padding: clamp(24px, 5vw, 56px);
  place-items: center;
}

.camera-stage {
  --camera-frame-height: clamp(260px, 43svh, 480px);
  --camera-frame-width: min(84vw, 520px);
  align-self: center;
  display: grid;
  width: 100%;
  gap: clamp(16px, 3vw, 26px);
  grid-template-rows: auto minmax(0, var(--camera-frame-height)) auto;
  justify-items: center;
  align-content: center;
}

.brand-title {
  position: relative;
  margin: 0;
  max-width: min(100%, 760px);
  color: transparent;
  background:
    linear-gradient(102deg, rgba(247, 243, 234, 0.34), rgba(255, 255, 255, 0.86), rgba(137, 221, 255, 0.34), rgba(247, 243, 234, 0.48));
  background-size: 230% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  font-family: "PortfolioScript", "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(3rem, 7.8vw, 6.8rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.04;
  text-align: center;
  text-wrap: balance;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 22px rgba(247, 243, 234, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.42);
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.16);
  animation: title-sheen 5.8s ease-in-out infinite;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.camera-frame {
  display: grid;
  width: var(--camera-frame-width);
  height: var(--camera-frame-height);
  min-width: 0;
  min-height: 0;
  overflow: visible;
  place-items: center;
}

.camera-trigger {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  outline: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  place-items: center;
  transform: translateZ(0);
}

.camera-trigger:focus-visible {
  outline-color: var(--blue);
  outline-offset: 10px;
}

.camera-tilt {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  transform:
    perspective(950px)
    rotateX(var(--tilt-x))
    rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  transition: transform 120ms ease-out;
}

.camera-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.88;
  mix-blend-mode: screen;
  filter:
    drop-shadow(0 22px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 20px rgba(247, 243, 234, 0.2));
  animation: camera-float 5.4s ease-in-out infinite alternate;
  user-select: none;
}

.capture-hint {
  margin: clamp(10px, 2vw, 18px) 0 0;
  color: rgba(247, 243, 234, 0.62);
  font-size: clamp(0.76rem, 1.4vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(247, 243, 234, 0.18);
}

.time-warp {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  perspective: 900px;
  place-items: center;
}

.time-warp::before,
.time-warp::after {
  position: absolute;
  inset: -12%;
  content: "";
  opacity: 0;
  transform: scale(0.72);
}

.time-warp::before {
  background:
    conic-gradient(
      from 0.08turn,
      transparent 0 8%,
      rgba(255, 255, 255, 0.68) 9% 10%,
      transparent 11% 21%,
      rgba(137, 221, 255, 0.5) 22% 23%,
      transparent 24% 37%,
      rgba(255, 154, 200, 0.4) 38% 39%,
      transparent 40% 100%
    );
  filter: blur(1px);
  mix-blend-mode: screen;
}

.time-warp::after {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.28) 8%, transparent 20%),
    repeating-radial-gradient(circle at center, transparent 0 48px, rgba(255, 255, 255, 0.28) 50px 51px, transparent 55px 88px);
  filter: blur(0.4px);
}

.time-ring,
.time-streak {
  position: absolute;
  display: block;
  pointer-events: none;
}

.time-ring {
  width: min(86vw, 820px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  box-shadow:
    0 0 34px rgba(137, 221, 255, 0.34),
    inset 0 0 42px rgba(255, 255, 255, 0.2);
  opacity: 0;
  transform: translateZ(-260px) scale(0.32) rotate(0deg);
}

.time-ring-b {
  width: min(68vw, 620px);
  border-color: rgba(255, 154, 200, 0.42);
}

.time-ring-c {
  width: min(48vw, 440px);
  border-color: rgba(216, 255, 143, 0.32);
}

.time-streak {
  left: 50%;
  top: 50%;
  width: min(62vw, 720px);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  opacity: 0;
  transform-origin: left center;
}

.time-streak-a {
  transform: rotate(12deg) translateX(-50%);
}

.time-streak-b {
  transform: rotate(138deg) translateX(-50%);
}

.time-streak-c {
  transform: rotate(82deg) translateX(-50%);
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 1) 0 13%, rgba(255, 255, 255, 0.78) 25%, rgba(137, 221, 255, 0.22) 45%, transparent 72%),
    linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.54), transparent);
  opacity: 0;
}

.captured .flash {
  animation: camera-flash 900ms cubic-bezier(0.14, 0.86, 0.16, 1) both;
}

.captured .time-warp {
  animation: time-warp-open 900ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-warp::before {
  animation: time-dial-spin 900ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-warp::after {
  animation: time-radial-pulse 900ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-ring-a {
  animation: time-ring-flight 900ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-ring-b {
  animation: time-ring-flight 900ms 45ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-ring-c {
  animation: time-ring-flight 900ms 90ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-streak-a {
  animation: time-streak-flight 760ms 45ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-streak-b {
  animation: time-streak-flight 760ms 90ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .time-streak-c {
  animation: time-streak-flight 760ms 130ms cubic-bezier(0.12, 0.86, 0.16, 1) both;
}

.captured .camera-trigger {
  animation: shutter-hit 820ms ease both;
}

.captured .loader-shell {
  animation: loader-departure 820ms cubic-bezier(0.2, 0.8, 0.1, 1) both;
}

.captured #chrome-canvas {
  animation: chrome-departure 900ms cubic-bezier(0.2, 0.8, 0.1, 1) both;
}

.captured .surface-vignette {
  animation: surface-departure 900ms cubic-bezier(0.2, 0.8, 0.1, 1) both;
}

.book-page.arriving .book-nav,
.book-page.arriving .book-shell,
.book-page.arriving .gallery-nav,
.book-page.arriving .gallery-shell {
  animation: page-arrival 980ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes camera-flash {
  0% {
    opacity: 0;
  }
  6% {
    opacity: 0.98;
  }
  18% {
    opacity: 0.4;
  }
  46% {
    opacity: 0.2;
  }
  78% {
    opacity: 0.82;
  }
  100% {
    opacity: 1;
  }
}

@keyframes time-warp-open {
  0% {
    opacity: 0;
    transform: scale(0.9);
    filter: blur(10px) saturate(0.8);
  }
  12% {
    opacity: 1;
    transform: scale(1);
    filter: blur(3px) saturate(1.16);
  }
  64% {
    opacity: 1;
    transform: scale(1.12);
    filter: blur(0) saturate(1.28);
  }
  100% {
    opacity: 1;
    transform: scale(1.32);
    filter: blur(10px) saturate(0.88);
  }
}

@keyframes time-dial-spin {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(0deg);
  }
  16% {
    opacity: 0.62;
  }
  100% {
    opacity: 0.22;
    transform: scale(2.1) rotate(270deg);
  }
}

@keyframes time-radial-pulse {
  0% {
    opacity: 0;
    transform: scale(0.42);
  }
  18% {
    opacity: 0.72;
  }
  72% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}

@keyframes time-ring-flight {
  0% {
    opacity: 0;
    transform: translateZ(-360px) scale(0.22) rotate(0deg);
  }
  18% {
    opacity: 0.85;
  }
  68% {
    opacity: 0.48;
  }
  100% {
    opacity: 0;
    transform: translateZ(260px) scale(1.65) rotate(132deg);
  }
}

@keyframes time-streak-flight {
  0% {
    opacity: 0;
    width: 0;
    filter: blur(0);
  }
  22% {
    opacity: 0.9;
    width: min(70vw, 780px);
  }
  100% {
    opacity: 0;
    width: min(132vw, 1420px);
    filter: blur(7px);
  }
}

@keyframes shutter-hit {
  0%,
  100% {
    transform: scale(1);
  }
  16% {
    transform: scale(0.985);
  }
  34% {
    transform: scale(1.02);
  }
}

@keyframes loader-departure {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  28% {
    opacity: 1;
    transform: scale(0.985);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.055);
    filter: blur(18px);
  }
}

@keyframes chrome-departure {
  0% {
    filter: blur(10px) saturate(1.08);
    opacity: 1;
    transform: scale(1.035);
  }
  100% {
    filter: blur(28px) saturate(0.72);
    opacity: 0.35;
    transform: scale(1.09);
  }
}

@keyframes surface-departure {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.28;
  }
}

@keyframes page-arrival {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(1.015);
    filter: blur(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes title-sheen {
  0%,
  42% {
    background-position: 0% 50%;
  }
  72%,
  100% {
    background-position: 100% 50%;
  }
}

@media (max-width: 860px) {
  .loader-shell {
    padding: 22px 0;
  }

  .camera-stage {
    gap: clamp(14px, 2.6svh, 18px);
  }
}

@media (max-width: 560px) {
  #chrome-canvas {
    filter: blur(16px) saturate(1.08);
    transform: scale(1.08);
  }

  .loader-shell {
    width: min(100% - 24px, 1180px);
    min-height: 100dvh;
    padding: clamp(16px, 4svh, 30px) 0;
  }

  .camera-stage {
    --camera-frame-height: min(34svh, 320px);
    --camera-frame-width: min(76vw, 350px);
    max-height: calc(100dvh - 28px);
    gap: clamp(12px, 2.4svh, 18px);
  }

  .brand-title {
    max-width: 12ch;
    font-size: clamp(2.8rem, 15vw, 4.6rem);
    line-height: 0.98;
  }

  .capture-hint {
    max-width: 24ch;
    min-height: 1.35em;
    font-size: 0.76rem;
  }

}

@media (max-width: 560px) and (max-height: 700px) {
  .loader-shell {
    padding: 12px 0;
  }

  .camera-stage {
    --camera-frame-height: min(27svh, 250px);
    --camera-frame-width: min(64vw, 300px);
    gap: 10px;
  }

  .brand-title {
    font-size: clamp(2.45rem, 12vw, 3.75rem);
  }

  .capture-hint {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
  }

  .time-ring {
    width: 82vw;
  }

  .time-streak {
    width: 78vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* Book portfolio */
.book-page {
  min-height: 100svh;
  background:
    linear-gradient(135deg, #030406 0%, #06090d 42%, #10080c 66%, #04100d 100%);
  color: #1f1c18;
  font-family: Arial, Helvetica, ui-sans-serif, system-ui, sans-serif;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

body[data-view="book"] {
  overflow: hidden;
}

body[data-view="gallery"] {
  overflow-y: auto;
}

.book-page::before {
  position: fixed;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.1), transparent 18rem),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.book-page .surface-vignette {
  opacity: 0.78;
  mix-blend-mode: screen;
}

.book-nav {
  position: relative;
  z-index: 3;
  display: flex;
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 8px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.book-mark,
.book-nav p {
  margin: 0;
  color: rgba(247, 243, 234, 0.78);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.book-shell {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: calc(100svh - 58px);
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 12px 0 24px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
}

.book {
  position: relative;
  align-self: center;
  min-height: min(690px, calc(100svh - 150px));
  perspective: 1800px;
}

.book::before {
  position: absolute;
  inset: 1.5% 49.7% 1.5% auto;
  z-index: 3;
  width: 3px;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(35, 24, 14, 0.55) 16%, rgba(35, 24, 14, 0.6) 84%, transparent);
  box-shadow:
    -20px 0 44px rgba(0, 0, 0, 0.2),
    14px 0 38px rgba(255, 255, 255, 0.24);
}

.book::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: 50%;
  border: 1px solid rgba(87, 64, 39, 0.16);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.92), transparent 32%),
    linear-gradient(180deg, #fbf7ef, #eadfce);
  background-repeat: no-repeat;
  background-size: 240% 100%, 100% 100%;
  background-position: -40% 0, 0 0;
  box-shadow:
    -26px 0 54px rgba(38, 26, 16, 0.18),
    0 28px 80px rgba(55, 40, 24, 0.18);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: rotateY(0deg);
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity, background-position;
}

.book.flipping-next::after {
  animation: book-page-flip-next 640ms cubic-bezier(0.22, 0.61, 0.34, 1) both;
}

.book.flipping-prev::after {
  right: auto;
  left: 0;
  border-right: 0;
  border-left: 1px solid rgba(87, 64, 39, 0.16);
  border-radius: 8px 0 0 8px;
  background-position: 140% 0, 0 0;
  transform-origin: right center;
  animation: book-page-flip-prev 640ms cubic-bezier(0.22, 0.61, 0.34, 1) both;
}

.book-sheet {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  opacity: 0;
  pointer-events: none;
  transform: translateX(22px) rotateY(-8deg) scale(0.985);
  transform-origin: left center;
  will-change: transform, opacity;
  transition:
    opacity 360ms ease,
    transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.book-sheet.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) rotateY(0) scale(1);
}

.book-sheet.turning-next {
  animation: page-turn-next 640ms cubic-bezier(0.22, 0.61, 0.34, 1);
}

.book-sheet.turning-prev {
  animation: page-turn-prev 640ms cubic-bezier(0.22, 0.61, 0.34, 1);
}

.book-sheet::before,
.book-sheet::after {
  position: absolute;
  top: 3%;
  bottom: 3%;
  z-index: -1;
  width: 5px;
  content: "";
  opacity: 0.85;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(224, 209, 181, 0.95) 0 1px,
    rgba(166, 144, 109, 0.45) 1px 2px,
    transparent 2px 4px
  );
}

.book-sheet::before {
  left: -4px;
  border-radius: 3px 0 0 3px;
}

.book-sheet::after {
  right: -4px;
  border-radius: 0 3px 3px 0;
}

.paper-page {
  position: relative;
  display: flex;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(87, 64, 39, 0.16);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.78), transparent 40%),
    linear-gradient(180deg, #fbf7ef, #ece3d6);
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 52px);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.paper-page:nth-child(1) {
  border-radius: 8px 0 0 8px;
}

.paper-page:nth-child(2) {
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

.page-number {
  color: rgba(31, 28, 24, 0.38);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.book-kicker {
  margin: 0 0 12px;
  color: rgba(31, 28, 24, 0.46);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cover-page h1,
.paper-page h2 {
  margin: 0;
  color: #1f1c18;
  font-family: "PortfolioScript", "Segoe Script", "Brush Script MT", cursive;
  font-weight: 600;
  line-height: 0.95;
}

.cover-page h1 {
  font-size: clamp(4.6rem, 10vw, 9rem);
}

.paper-page h2 {
  font-size: clamp(3rem, 6vw, 6rem);
}

.cover-note,
.paper-page p,
.quote-page blockquote {
  max-width: 32rem;
  margin: 0;
  color: rgba(31, 28, 24, 0.72);
  font-size: clamp(1rem, 1.45vw, 1.18rem);
  line-height: 1.65;
}

.intro-page,
.quote-page,
.end-page {
  justify-content: center;
  gap: 30px;
}

.quote-page blockquote {
  color: #1f1c18;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.05;
}

.contents-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.contents-list button,
.paper-link {
  display: inline-flex;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(31, 28, 24, 0.18);
  background: transparent;
  color: #1f1c18;
  cursor: pointer;
  align-items: center;
  gap: 16px;
  font: inherit;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  text-decoration: none;
  transition:
    border-color 200ms ease,
    color 200ms ease,
    gap 200ms ease,
    padding-left 200ms ease;
}

.contents-list button:hover,
.contents-list button:focus-visible {
  padding-left: 6px;
  border-color: rgba(31, 28, 24, 0.5);
  color: #6d3e3c;
  gap: 20px;
}

.contents-list span {
  color: rgba(31, 28, 24, 0.42);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.paper-link {
  width: fit-content;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper-link:hover,
.paper-link:focus-visible {
  padding-left: 6px;
  border-color: rgba(31, 28, 24, 0.5);
  color: #6d3e3c;
}

.contact-links {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.contact-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  padding-bottom: 2px;
  border: 0;
  border-bottom: 1px solid rgba(31, 28, 24, 0.18);
  color: #1f1c18;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    padding-left 200ms ease,
    gap 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

.contact-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-link:hover,
.contact-link:focus-visible {
  padding-left: 6px;
  gap: 16px;
  border-color: rgba(31, 28, 24, 0.5);
  color: #6d3e3c;
}

.photo-page {
  padding: clamp(14px, 2vw, 24px);
}

.book-photo {
  position: relative;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--book-photo);
  background-size: cover;
}

.book-photo::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.42)),
    radial-gradient(circle at 34% 18%, rgba(255, 255, 255, 0.32), transparent 24%);
}

.book-photo-portrait {
  --book-photo:
    radial-gradient(ellipse at 48% 25%, rgba(255, 229, 197, 0.9) 0 8%, transparent 9%),
    linear-gradient(142deg, #1a1010, #6d3e3c 37%, #d8b690 38%, #191817 58%, #2a1d31);
}

/* Reserved for upcoming chapters (02 landscape / 03 light page) — not used yet */
.book-photo-landscape {
  --book-photo:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 74px),
    linear-gradient(165deg, #071112, #1d3038 32%, #9eb8c1 33%, #07090d 53%, #34243b 100%);
}

.contact-page,
.end-page {
  justify-content: center;
  gap: 26px;
}

.end-credits {
  max-width: 24rem;
  margin: -10px 0 0;
  color: rgba(31, 28, 24, 0.46);
  font-size: 0.78rem;
  line-height: 1.6;
}

.book-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.book-controls button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(247, 243, 234, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 243, 234, 0.88);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
}

.book-controls button:disabled {
  cursor: default;
  opacity: 0.38;
}

@keyframes page-turn-next {
  0% {
    transform: rotateY(0) translateX(0) scale(1);
    filter: brightness(1);
  }
  48% {
    transform: rotateY(-9deg) translateX(-12px) scale(0.99);
    filter: brightness(0.88);
  }
  100% {
    transform: rotateY(0) translateX(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes page-turn-prev {
  0% {
    transform: rotateY(0) translateX(0) scale(1);
    filter: brightness(1);
  }
  48% {
    transform: rotateY(9deg) translateX(12px) scale(0.99);
    filter: brightness(0.88);
  }
  100% {
    transform: rotateY(0) translateX(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes book-page-flip-next {
  0% {
    opacity: 1;
    transform: rotateY(0deg) scale(1);
    background-position: -40% 0, 0 0;
  }
  48% {
    opacity: 1;
    transform: rotateY(-82deg) scale(1.012);
    background-position: 90% 0, 0 0;
    box-shadow:
      -42px 0 70px rgba(0, 0, 0, 0.38),
      0 30px 86px rgba(55, 40, 24, 0.2);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotateY(-164deg) scale(1);
    background-position: 220% 0, 0 0;
  }
}

@keyframes book-page-flip-prev {
  0% {
    opacity: 1;
    transform: rotateY(0deg) scale(1);
    background-position: 140% 0, 0 0;
  }
  48% {
    opacity: 1;
    transform: rotateY(82deg) scale(1.012);
    background-position: 10% 0, 0 0;
    box-shadow:
      42px 0 70px rgba(0, 0, 0, 0.38),
      0 30px 86px rgba(55, 40, 24, 0.2);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotateY(164deg) scale(1);
    background-position: -120% 0, 0 0;
  }
}

/* Portfolio book refinements */
.transition-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.92) 26%, rgba(255, 255, 255, 0) 68%),
    rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 480ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-veil.is-fading {
  opacity: 0;
  transform: scale(1.035);
}

.transition-veil.time-veil {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 1) 0 10%, rgba(255, 255, 255, 0.82) 22%, rgba(137, 221, 255, 0.2) 42%, transparent 68%),
    repeating-radial-gradient(circle at 50% 48%, transparent 0 42px, rgba(255, 255, 255, 0.26) 43px 45px, transparent 46px 78px),
    conic-gradient(from 0.18turn, transparent, rgba(255, 255, 255, 0.52), transparent, rgba(255, 154, 200, 0.18), transparent);
  mix-blend-mode: screen;
  animation: time-arrival-veil 920ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.transition-veil.time-veil::before,
.transition-veil.time-veil::after {
  position: absolute;
  inset: -14%;
  content: "";
  opacity: 0.72;
  pointer-events: none;
}

.transition-veil.time-veil::before {
  background:
    linear-gradient(90deg, transparent 0 42%, rgba(255, 255, 255, 0.42) 50%, transparent 58%),
    linear-gradient(0deg, transparent 0 42%, rgba(137, 221, 255, 0.28) 50%, transparent 58%);
  animation: time-arrival-cross 920ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.transition-veil.time-veil::after {
  background:
    repeating-radial-gradient(circle at center, transparent 0 34px, rgba(255, 255, 255, 0.3) 35px 36px, transparent 38px 70px);
  animation: time-arrival-rings 920ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book-page.arriving #chrome-canvas {
  animation: chrome-arrival 920ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book-page.arriving .book {
  animation: book-arrival 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book-page.arriving .book-glow {
  animation: book-impact-flash 760ms 140ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book {
  --drag-progress: 0;
  --drag-opacity: 0;
  --drag-rotation: 0deg;
  touch-action: pan-y;
  cursor: grab;
}

.book-glow {
  position: absolute;
  inset: -10% -6%;
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95), rgba(137, 221, 255, 0.4) 32%, rgba(255, 154, 200, 0.16) 52%, transparent 70%);
  mix-blend-mode: screen;
}

.book.dragging {
  cursor: grabbing;
}

.book.dragging::after {
  opacity: var(--drag-opacity);
  transform: rotateY(var(--drag-rotation));
  transition: none;
  animation: none;
}

.book.dragging-left::after {
  right: 0;
  left: auto;
  border-right: 1px solid rgba(87, 64, 39, 0.16);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  transform-origin: left center;
}

.book.dragging-right::after {
  right: auto;
  left: 0;
  border-right: 0;
  border-left: 1px solid rgba(87, 64, 39, 0.16);
  border-radius: 8px 0 0 8px;
  transform-origin: right center;
}

.book-page .book-shell {
  padding-top: clamp(8px, 1.4vw, 18px);
}

.book-page .paper-page {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.86), transparent 42%),
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.56), transparent 24rem),
    linear-gradient(180deg, #fffaf0, #e7dccd);
}

.cover-page {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 46%),
    radial-gradient(circle at 72% 18%, rgba(240, 198, 109, 0.18), transparent 18rem),
    linear-gradient(145deg, #1d1713, #3a2a20 50%, #15110e) !important;
  color: rgba(255, 250, 240, 0.86);
  box-shadow:
    inset 0 0 0 1px rgba(240, 198, 109, 0.22),
    inset 0 0 0 9px rgba(8, 6, 4, 0.3),
    inset 0 0 0 10px rgba(240, 198, 109, 0.16),
    0 28px 80px rgba(0, 0, 0, 0.28);
}

.cover-page .book-kicker,
.cover-page .cover-note,
.cover-page h1 {
  color: inherit;
}

.cover-title-block {
  display: grid;
  gap: clamp(16px, 2.4vw, 28px);
}

.cover-page h1 {
  max-width: 8ch;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18),
    0 22px 44px rgba(0, 0, 0, 0.42);
}

.cover-page .cover-note {
  color: rgba(255, 250, 240, 0.68);
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cover-meta span {
  display: inline-flex;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 999px;
  align-items: center;
  color: rgba(255, 250, 240, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.cover-strip {
  display: grid;
  min-height: clamp(190px, 24vw, 280px);
  grid-template-columns: 0.84fr 1.24fr 0.84fr;
  gap: 10px;
}

.cover-strip:has(img:only-child) {
  grid-template-columns: 1fr;
}

.cover-strip img {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 18px 44px rgba(47, 31, 17, 0.2);
}

.photo-page {
  justify-content: stretch;
}

.photo-page-dark {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.1), transparent 18rem),
    linear-gradient(145deg, #161514, #050607) !important;
}

.photo-page-light {
  background:
    radial-gradient(circle at 32% 20%, rgba(240, 198, 109, 0.14), transparent 16rem),
    linear-gradient(145deg, #efe6d6, #fbf7ef) !important;
}

.book-photo {
  display: grid;
  min-height: 100%;
  padding: clamp(9px, 1.1vw, 14px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent),
    #111;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 22px 50px rgba(0, 0, 0, 0.22);
}

.book-photo::after {
  display: none;
}

.photo-page-light .book-photo {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), transparent),
    #f5efe3;
  box-shadow:
    inset 0 0 0 1px rgba(77, 58, 39, 0.12),
    0 20px 42px rgba(68, 46, 24, 0.12);
}

.photo-mat {
  display: grid;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: none;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 0 7px #f7f3ea,
    0 0 0 8px rgba(31, 28, 24, 0.22);
  padding: 0;
  place-items: center;
}

.photo-zoom-trigger {
  position: relative;
  cursor: zoom-in;
}

.photo-mat picture {
  display: contents;
}

.photo-zoom-trigger::after {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  width: 34px;
  height: 34px;
  content: "";
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f3ea' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3Cpath d='M10.5 7.5v6M7.5 10.5h6'/%3E%3C/svg%3E")
    center / 16px no-repeat,
    rgba(8, 9, 11, 0.55);
  opacity: 0;
  transition: opacity 200ms ease;
}

.photo-zoom-trigger:hover::after,
.photo-zoom-trigger:focus-visible::after {
  opacity: 1;
}

.photo-page-light .photo-mat {
  box-shadow:
    0 0 0 1px rgba(31, 28, 24, 0.18),
    0 0 0 7px #fffaf0,
    0 0 0 8px rgba(31, 28, 24, 0.14);
}

.book-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.book-photo figcaption {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 250, 240, 0.76);
  font-size: 0.76rem;
}

.photo-page-light .book-photo figcaption {
  color: rgba(31, 28, 24, 0.62);
}

.book-photo figcaption strong {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-page {
  gap: clamp(18px, 2.4vw, 32px);
}

.book-controls {
  align-items: center;
  flex-wrap: wrap;
}

.book-controls button {
  min-width: 118px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.book-controls button:not(:disabled):hover {
  border-color: rgba(247, 243, 234, 0.48);
  background: rgba(247, 243, 234, 0.15);
  transform: translateY(-1px);
}

@keyframes time-arrival-veil {
  0% {
    opacity: 1;
    transform: scale(1.24) rotate(8deg);
    filter: blur(10px) saturate(0.8);
  }
  42% {
    opacity: 0.72;
    filter: blur(3px) saturate(1.16);
  }
  100% {
    opacity: 0;
    transform: scale(0.92) rotate(0deg);
    filter: blur(0) saturate(1);
  }
}

@keyframes time-arrival-cross {
  0% {
    opacity: 0.8;
    transform: scale(1.3) rotate(28deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.72) rotate(-18deg);
  }
}

@keyframes time-arrival-rings {
  0% {
    opacity: 0.75;
    transform: scale(1.65);
  }
  100% {
    opacity: 0;
    transform: scale(0.42);
  }
}

@keyframes chrome-arrival {
  0% {
    filter: blur(28px) saturate(0.72);
    opacity: 0.45;
    transform: scale(1.09);
  }
  100% {
    filter: blur(10px) saturate(1.08);
    opacity: 1;
    transform: scale(1.035);
  }
}

@keyframes book-arrival {
  0% {
    opacity: 0;
    transform: translateY(46px) scale(0.78) rotateX(12deg);
    filter: blur(16px) brightness(1.6) saturate(1.3);
  }
  55% {
    opacity: 1;
    transform: translateY(-6px) scale(1.035) rotateX(-2deg);
    filter: blur(2px) brightness(1.15) saturate(1.1);
  }
  78% {
    transform: translateY(2px) scale(0.992) rotateX(1deg);
    filter: blur(0) brightness(1) saturate(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0);
    filter: blur(0) brightness(1) saturate(1);
  }
}

@keyframes book-impact-flash {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  22% {
    opacity: 0.95;
    transform: scale(0.74);
  }
  46% {
    opacity: 0.45;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

/* Gallery (accueil) */
.view-gallery {
  padding-bottom: 40px;
}

.site-credits {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: rgba(247, 243, 234, 0.4);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.site-credits p {
  margin: 4px 0;
}

.gallery-nav {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: clamp(56px, 11vw, 110px) 0 clamp(24px, 4vw, 40px);
  text-align: center;
}

.gallery-eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.gallery-title {
  margin: 0;
  color: transparent;
  background: linear-gradient(
    102deg,
    rgba(247, 243, 234, 0.34),
    rgba(255, 255, 255, 0.86),
    rgba(137, 221, 255, 0.34),
    rgba(247, 243, 234, 0.48)
  );
  background-size: 230% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: "PortfolioScript", "Segoe Script", "Brush Script MT", cursive;
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1;
  animation: title-sheen 5.8s ease-in-out infinite;
}

.gallery-shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
}

.library-hint {
  margin: 0 0 clamp(30px, 5vw, 52px);
  color: rgba(247, 243, 234, 0.45);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

.library-shelf {
  position: relative;
  display: grid;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 34px) 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 4.5vw, 52px);
  align-items: end;
  transform: perspective(1400px) rotateX(calc(var(--tilt-x) * 0.3)) rotateY(calc(var(--tilt-y) * 0.3));
  transition: transform 220ms ease-out;
}

.library-shelf::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 14px;
  content: "";
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 46%),
    linear-gradient(180deg, #2c2219, #16100b);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65);
}

.library-book {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border-radius: 3px 10px 10px 3px;
  background: #14100c;
  color: inherit;
  text-decoration: none;
  perspective: 900px;
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 460ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 300ms ease;
}

.library-book.is-visible {
  opacity: 1;
  transform: none;
}

.library-book:nth-child(2) {
  transition-delay: 110ms;
}

.library-book:nth-child(3) {
  transition-delay: 220ms;
}

.library-book::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 6;
  width: 8%;
  content: "";
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.5),
    rgba(0, 0, 0, 0.16) 52%,
    rgba(255, 255, 255, 0.1) 78%,
    transparent
  );
}

.library-book:not(.library-book-coming):hover,
.library-book:not(.library-book-coming):focus-visible {
  transform: translateY(-12px);
  box-shadow:
    0 34px 64px rgba(0, 0, 0, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.library-book.is-opening {
  transform: none;
}

.spread-cover {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: #111;
  transform: rotateY(0deg);
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 14px 0 44px rgba(0, 0, 0, 0.42);
  transition: transform 280ms ease;
}

.spread-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spread-cover::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 38%, rgba(0, 0, 0, 0.8));
}

.cover-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  padding: clamp(16px, 2vw, 24px) clamp(16px, 2vw, 24px) clamp(16px, 2vw, 24px) clamp(22px, 3vw, 32px);
  color: rgba(247, 243, 234, 0.92);
}

.cover-overlay .page-number {
  color: rgba(247, 243, 234, 0.5);
}

.cover-overlay .book-kicker {
  margin-bottom: 6px;
  color: var(--gold);
}

.cover-overlay h2 {
  margin: 0;
  color: inherit;
  font-family: "PortfolioScript", "Segoe Script", "Brush Script MT", cursive;
  font-weight: 600;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.05;
}

.library-book:not(.library-book-coming):hover .spread-cover,
.library-book:not(.library-book-coming):focus-visible .spread-cover {
  transform: rotateY(-7deg);
}

.library-book.is-opening .spread-cover {
  animation: cover-open 420ms cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes cover-open {
  0% {
    opacity: 1;
    transform: rotateY(0deg);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotateY(-100deg);
  }
}

.book-inside {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fbf7ef, #e7dccd);
}

.book-inside::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 14%;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(35, 24, 14, 0.4), transparent);
}

.book-inside img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.library-book-coming {
  cursor: default;
}

.library-book-coming.is-visible {
  opacity: 0.55;
}

.library-book-coming .spread-cover {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 46%),
    radial-gradient(circle at 70% 20%, rgba(240, 198, 109, 0.12), transparent 14rem),
    linear-gradient(145deg, #241b14, #38281e 55%, #181209);
}

.library-book-coming .cover-overlay h2 {
  color: rgba(255, 250, 240, 0.6);
}

@media (max-width: 760px) {
  .library-shelf {
    width: min(300px, 100%);
    padding: 0 0 12px;
    grid-template-columns: 1fr;
    gap: 40px;
    transform: none;
  }

  .library-shelf::after {
    display: none;
  }

  .library-book {
    box-shadow:
      0 22px 40px rgba(0, 0, 0, 0.55),
      inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  .library-book-coming {
    display: none;
  }

  .library-hint {
    margin-bottom: 30px;
  }
}

/* Background audio toggle */
.audio-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 12;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(247, 243, 234, 0.18);
  border-radius: 50%;
  background: rgba(8, 9, 11, 0.45);
  backdrop-filter: blur(12px);
  color: rgba(247, 243, 234, 0.78);
  cursor: pointer;
  opacity: 0.5;
  place-items: center;
  transition:
    opacity 200ms ease,
    background 200ms ease,
    border-color 200ms ease,
    transform 200ms ease;
}

.audio-toggle:hover,
.audio-toggle:focus-visible {
  opacity: 1;
  border-color: rgba(247, 243, 234, 0.4);
  background: rgba(8, 9, 11, 0.66);
  transform: translateY(-1px);
}

.audio-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.audio-toggle .icon-sound-off {
  display: none;
}

.audio-toggle.is-muted .icon-sound-on {
  display: none;
}

.audio-toggle.is-muted .icon-sound-off {
  display: block;
}


/* Photo lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(2, 3, 4, 0.94);
  opacity: 0;
  pointer-events: none;
  place-items: center;
  transition: opacity 220ms ease;
}

.photo-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.photo-lightbox-stage {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
}

.photo-lightbox-stage picture {
  display: contents;
}

#photoLightboxImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pinch-zoom;
  object-fit: contain;
  cursor: zoom-in;
  transform: scale(1) translate(0, 0);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}

#photoLightboxImage.is-zoomed {
  cursor: grab;
  transition: transform 60ms ease-out;
}

#photoLightboxImage.is-panning {
  cursor: grabbing;
}

.photo-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(247, 243, 234, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  cursor: pointer;
  place-items: center;
  transition: background 200ms ease, border-color 200ms ease;
}

.photo-lightbox-close:hover,
.photo-lightbox-close:focus-visible {
  border-color: rgba(247, 243, 234, 0.48);
  background: rgba(247, 243, 234, 0.16);
}

.photo-lightbox-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* ===== Entrance reveals (gallery header & credits) ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

[data-reveal="2"] {
  transition-delay: 130ms;
}

[data-reveal="3"] {
  transition-delay: 260ms;
}

/* ===== Staggered content reveal on book page turn ===== */
.book-sheet.active .paper-page > * {
  animation: page-content-in 600ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.book-sheet.active .paper-page > *:nth-child(2) {
  animation-delay: 80ms;
}

.book-sheet.active .paper-page > *:nth-child(3) {
  animation-delay: 160ms;
}

.book-sheet.active .paper-page > *:nth-child(4) {
  animation-delay: 240ms;
}

.book-sheet.active .paper-page > *:nth-child(5) {
  animation-delay: 320ms;
}

.book-sheet.active .paper-page:nth-child(2) > * {
  animation-delay: 150ms;
}

.book-sheet.active .paper-page:nth-child(2) > *:nth-child(2) {
  animation-delay: 230ms;
}

.book-sheet.active .paper-page:nth-child(2) > *:nth-child(3) {
  animation-delay: 310ms;
}

.book-sheet.active .paper-page:nth-child(2) > *:nth-child(4) {
  animation-delay: 390ms;
}

.book-sheet.active .paper-page:nth-child(2) > *:nth-child(5) {
  animation-delay: 470ms;
}

@keyframes page-content-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== Micro-interactions ===== */
.book-mark {
  position: relative;
}

.book-mark::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 1px;
  content: "";
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.book-mark:hover::after,
.book-mark:focus-visible::after {
  transform: scaleX(1);
}

.book-nav p.label-swap {
  animation: label-swap 340ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes label-swap {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes camera-float {
  from {
    transform: translateY(-5px);
  }
  to {
    transform: translateY(7px);
  }
}

.audio-toggle:active {
  transform: translateY(0) scale(0.9);
}

/* ===== Responsive: book & controls (<=820px) ===== */
@media (max-width: 820px) {
  .book-page,
  body[data-view="book"],
  body[data-view="gallery"] {
    overflow: auto;
  }

  .book-page .book-nav,
  .book-page .book-shell {
    width: min(100% - 20px, 1180px);
  }

  .book-nav {
    align-items: flex-start;
    padding-top: 12px;
  }

  .book-nav p {
    max-width: 18ch;
    line-height: 1.35;
    text-align: right;
  }

  .book-shell {
    min-height: auto;
    padding-bottom: 18px;
  }

  .book {
    min-height: auto;
    perspective: 1200px;
  }

  .book::before {
    display: none;
  }

  .book::after {
    width: 100%;
    border-radius: 8px;
  }

  .book-sheet {
    position: relative;
    display: none;
    grid-template-columns: 1fr;
    transform: none;
  }

  .book-sheet.active {
    display: grid;
    min-height: auto;
  }

  .paper-page,
  .paper-page:nth-child(1) {
    min-height: min(700px, calc(100svh - 150px));
    padding: clamp(20px, 6vw, 34px);
    border: 1px solid rgba(87, 64, 39, 0.16);
    border-radius: 8px;
  }

  .paper-page:nth-child(2) {
    min-height: auto;
    padding: clamp(20px, 6vw, 34px);
    border: 1px solid rgba(87, 64, 39, 0.16);
    border-radius: 8px;
  }

  .paper-page + .paper-page {
    margin-top: 14px;
  }

  .photo-page,
  .photo-page:nth-child(1),
  .photo-page:nth-child(2) {
    padding: 10px;
  }

  .book-photo {
    min-height: min(640px, calc(100svh - 170px));
    gap: 9px;
  }

  .book-photo figcaption {
    min-height: 46px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }

  .book-photo figcaption strong {
    max-width: 100%;
  }

  .cover-page h1 {
    max-width: 8ch;
    font-size: clamp(4rem, 21vw, 6.6rem);
  }

  .paper-page h2 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .cover-strip {
    min-height: clamp(160px, 44vw, 230px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cover-strip:has(img:only-child) {
    grid-template-columns: 1fr;
  }

  .contents-list {
    gap: 11px;
  }

  .contents-list button,
  .paper-link {
    max-width: 100%;
    line-height: 1.15;
  }

  .book-controls {
    position: sticky;
    bottom: 10px;
    z-index: 7;
    display: grid;
    padding: 8px;
    border: 1px solid rgba(247, 243, 234, 0.14);
    border-radius: 999px;
    background: rgba(8, 9, 11, 0.56);
    backdrop-filter: blur(16px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .book-controls button {
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
    border-color: transparent;
    font-size: 0.72rem;
  }

  .audio-toggle {
    right: 12px;
    bottom: 78px;
  }
}

/* ===== Responsive: small phones (<=440px) ===== */
@media (max-width: 440px) {
  .book-page .book-nav,
  .book-page .book-shell {
    width: min(100% - 16px, 1180px);
  }

  .book-mark,
  .book-nav p {
    font-size: 0.66rem;
    letter-spacing: 0.12em;
  }

  .paper-page,
  .paper-page:nth-child(1) {
    min-height: min(670px, calc(100svh - 142px));
  }

  .paper-page:nth-child(2) {
    min-height: auto;
  }

  .book-photo {
    min-height: min(610px, calc(100svh - 158px));
  }

  .cover-note,
  .paper-page p,
  .quote-page blockquote {
    font-size: 0.98rem;
  }
}
