:root {
  --ink: #141210;
  --slate: #2a2520;
  --paper: #f4efe6;
  --warm: #d9b48a;
  --amber: #c4894a;
  --mute: #8a8174;
  --shadow: rgba(8, 6, 4, 0.55);
  --album-black: #141414;
  --album-black-deep: #0a0a0a;
  --album-seam: #2a2a2a;
  --desk: #c4b49a;
  --deck-w: min(320px, 72vw);
  --deck-h: calc(var(--deck-w) * 1.2 + 40px);
  --page-w: min(320px, 46vw);
  --page-h: calc(var(--page-w) * 1.22);
  --cover-pad: clamp(10px, 1.4vw, 16px);
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 0.82, 0.28, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  color: var(--paper);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  background: var(--ink);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(196, 137, 74, 0.22), transparent 62%),
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(42, 37, 32, 0.9), transparent 55%),
    linear-gradient(165deg, #1c1814 0%, #0f0d0b 48%, #181410 100%);
}

.lamp {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 220, 170, 0.14), transparent 28%),
    radial-gradient(ellipse 50% 35% at 50% 55%, rgba(212, 168, 110, 0.12), transparent 70%);
  animation: breathe 8s ease-in-out infinite;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  padding: clamp(1.5rem, 4vw, 3rem) 1.25rem 1.5rem;
  gap: 1.25rem;
}

.brand {
  text-align: center;
  max-width: 28rem;
  animation: rise-in 900ms var(--ease-out) both;
}

.brand__mark {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--paper);
}

.brand__title {
  margin: 0.15rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--warm);
}

.brand__note {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--mute);
  letter-spacing: 0.02em;
}

.view-switch {
  display: inline-flex;
  gap: 0.15rem;
  margin-top: 1.1rem;
  padding: 0.2rem;
  border: 1px solid rgba(217, 180, 138, 0.28);
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.35);
}

.view-switch__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease;
}

.view-switch__btn:hover,
.view-switch__btn:focus-visible {
  color: var(--paper);
  outline: none;
}

.view-switch__btn.is-active {
  background: rgba(217, 180, 138, 0.18);
  color: var(--warm);
}

.is-hidden {
  display: none !important;
}

.shelf-area,
.album-area,
.deck-area {
  display: grid;
  place-items: center;
  width: 100%;
  animation: rise-in 1000ms var(--ease-out) 120ms both;
}

/* —— Shelf of standing albums —— */
.shelf {
  width: min(720px, 94vw);
  --spine-w: clamp(34px, 5vw, 44px);
  --album-h: clamp(210px, 34vw, 280px);
  --album-face: var(--album-h);
  --leather: #121212;
  --leather-hi: #2a2a2a;
}

.shelf-scene {
  position: relative;
  width: 100%;
  min-height: calc(var(--album-h) + 120px);
  perspective: 1600px;
  perspective-origin: 50% 55%;
  overflow: visible;
}

.shelf-board {
  position: absolute;
  inset: 8% 4% 0;
  pointer-events: none;
  z-index: 0;
}

.shelf-board__wall {
  position: absolute;
  inset: 0 0 28% 0;
  background:
    linear-gradient(180deg, #ece7df 0%, #ddd5c8 100%);
  border-radius: 2px 2px 0 0;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.05);
}

.shelf-board__side {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 22%;
  width: 14px;
  background: linear-gradient(90deg, #cbb89a, #b49a78);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
}

.shelf-board__plank {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  height: 22%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 35%),
    repeating-linear-gradient(
      90deg,
      rgba(90, 70, 45, 0.07) 0 2px,
      transparent 2px 8px
    ),
    linear-gradient(180deg, #d7c7ab 0%, #c2ad8c 55%, #a8906e 100%);
  border-radius: 2px;
  box-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.25) inset,
    0 18px 36px rgba(0, 0, 0, 0.35);
}

.shelf-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0;
  min-height: calc(var(--album-h) + 80px);
  padding: 2.5rem 2.5rem 4.5rem 2.75rem;
  transform-style: preserve-3d;
  overflow: visible;
}

.shelf-album {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  width: var(--spine-w);
  height: var(--album-h);
  cursor: pointer;
  transform-style: preserve-3d;
  transition:
    transform 420ms cubic-bezier(0.22, 0.9, 0.28, 1),
    filter 420ms ease,
    opacity 420ms ease;
  transform: translate3d(0, 0, 0);
  position: relative;
  flex: 0 0 auto;
  overflow: visible;
}

.shelf-album:focus-visible {
  outline: 1px solid rgba(217, 180, 138, 0.7);
  outline-offset: 6px;
}

.shelf-album__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.22, 0.85, 0.25, 1);
  transform: rotateY(0deg);
}

/* Spine facing the viewer */
.shelf-album__spine {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent 35%, rgba(0, 0, 0, 0.35)),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.04), transparent 50%),
    var(--leather);
  box-shadow:
    1px 0 0 rgba(255, 255, 255, 0.05) inset,
    -1px 0 0 rgba(0, 0, 0, 0.5) inset,
    0 10px 18px rgba(0, 0, 0, 0.35);
  border-radius: 2px 0 0 2px;
  backface-visibility: hidden;
}

.shelf-album__spine-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: rgba(210, 210, 210, 0.28);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.shelf-album__cover {
  position: absolute;
  top: 50%;
  left: 100%;
  width: var(--album-face);
  height: var(--album-face);
  margin-top: calc(var(--album-face) / -2);
  transform: rotateY(90deg);
  transform-origin: left center;
  transform-style: preserve-3d;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.05), transparent 45%),
    var(--leather);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 22px 40px rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
}

.shelf-album__window {
  width: 56%;
  aspect-ratio: 5 / 6;
  padding: 9px 9px 26px;
  background: #efe8dc;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 10px 18px rgba(0, 0, 0, 0.35);
}

.shelf-album__window img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  filter: grayscale(0.1) contrast(1.04);
}

.shelf-album__pages {
  position: absolute;
  top: 3%;
  bottom: 3%;
  left: 100%;
  width: 7px;
  transform: translateX(-1px);
  background: linear-gradient(90deg, #d8d0c2, #efe8da 45%, #cfc6b6);
  box-shadow: 1px 0 2px rgba(0, 0, 0, 0.25);
}

/* Hover / focus: briefly slide out of the shelf */
.shelf-album.is-peek {
  transform: translate3d(0, -6px, 54px);
  z-index: 3;
}

/* Selected: fully out, cover facing the camera */
.shelf-album.is-selected {
  z-index: 5;
  transform: translate3d(22px, -22px, 150px) scale(1.04);
}

.shelf-album.is-selected .shelf-album__body {
  transform: rotateY(-90deg);
}

.shelf-album.is-dimmed {
  opacity: 0.38;
  filter: saturate(0.7);
}

.shelf-album.is-selected.is-dimmed {
  opacity: 1;
  filter: none;
}

/* —— Album / black sleeve book —— */
.album-shell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem 2rem;
}

.album-shell__desk {
  position: absolute;
  inset: 8% 2% -4%;
  border-radius: 4px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 40%),
    repeating-linear-gradient(
      90deg,
      rgba(90, 70, 45, 0.08) 0 2px,
      transparent 2px 7px
    ),
    linear-gradient(180deg, #d2c2a6 0%, #b9a686 48%, #a89270 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 24px 50px rgba(0, 0, 0, 0.35);
  z-index: 0;
  pointer-events: none;
}

.album-cover {
  position: relative;
  z-index: 1;
  padding: var(--cover-pad);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 35%),
    var(--album-black-deep);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 28px 55px rgba(0, 0, 0, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.book {
  --book-w: calc(var(--page-w) * 2);
  position: relative;
  width: var(--book-w);
  height: var(--page-h);
  display: flex;
  perspective: 2400px;
  transform-style: preserve-3d;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  background: var(--album-black);
}

.book:active {
  cursor: grabbing;
}

.book.is-flipping {
  cursor: default;
  pointer-events: none;
}

.book__shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -22px;
  height: 26px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5), transparent 72%);
  filter: blur(3px);
  pointer-events: none;
  z-index: 0;
}

.book__spine {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 14px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.75),
    rgba(40, 40, 40, 0.5) 40%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 0, 0, 0.7)
  );
  z-index: 5;
  pointer-events: none;
}

.page {
  position: relative;
  width: var(--page-w);
  height: var(--page-h);
  background: var(--album-black);
  overflow: hidden;
  z-index: 1;
}

.page--left {
  background:
    linear-gradient(90deg, transparent 88%, rgba(0, 0, 0, 0.55)),
    var(--album-black);
}

.page--right {
  background:
    linear-gradient(270deg, transparent 88%, rgba(0, 0, 0, 0.55)),
    var(--album-black);
}

.page__face {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: clamp(0.55rem, 1.5vw, 0.85rem);
  padding: clamp(0.65rem, 1.8vw, 1rem);
}

/* Clear plastic pocket with heat-seal edge */
.album-pocket {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: stretch;
  background: #0d0d0d;
  box-shadow:
    0 0 0 1px var(--album-seam),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.album-pocket::before {
  content: "";
  position: absolute;
  inset: -3px;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle, rgba(180, 180, 180, 0.55) 0.55px, transparent 0.7px);
  background-size: 4px 4px;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 3px;
  opacity: 0.7;
}

.album-pocket img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
  pointer-events: none;
}

.album-pocket__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(
      125deg,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.04) 18%,
      transparent 36%,
      transparent 62%,
      rgba(255, 255, 255, 0.06) 78%,
      transparent 100%
    );
  mix-blend-mode: soft-light;
}

.album-pocket.is-empty {
  background:
    repeating-linear-gradient(
      -18deg,
      rgba(255, 255, 255, 0.03),
      rgba(255, 255, 255, 0.03) 5px,
      transparent 5px,
      transparent 11px
    ),
    #101010;
}

.album-pocket.is-empty .album-pocket__sheen {
  opacity: 0.35;
}

.flip {
  position: absolute;
  top: 0;
  width: var(--page-w);
  height: var(--page-h);
  transform-style: preserve-3d;
  z-index: 8;
  will-change: transform;
}

.flip--forward {
  right: 0;
  transform-origin: left center;
}

.flip--back {
  left: 0;
  transform-origin: right center;
}

.flip__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--album-black);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.flip--forward .flip__face--front,
.flip--back .flip__face--back {
  background:
    linear-gradient(270deg, transparent 88%, rgba(0, 0, 0, 0.55)),
    var(--album-black);
}

.flip--forward .flip__face--back,
.flip--back .flip__face--front {
  background:
    linear-gradient(90deg, transparent 88%, rgba(0, 0, 0, 0.55)),
    var(--album-black);
}

.flip__face--back {
  transform: rotateY(180deg);
}

.flip__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.25;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.65),
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.5)
  );
}

.meta__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ghost:disabled {
  opacity: 0.35;
  cursor: default;
  border-bottom-color: transparent;
}

.deck {
  position: relative;
  width: var(--deck-w);
  height: var(--deck-h);
  touch-action: none;
  cursor: grab;
  user-select: none;
  overflow: visible;
}

.deck:active {
  cursor: grabbing;
}

.deck.is-animating {
  cursor: default;
  pointer-events: none;
}

.card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(100% - 40px);
  border-radius: 3px;
  transform-origin: 50% 60%;
  will-change: transform, box-shadow, opacity;
  list-style: none;
  pointer-events: auto;
}

.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  pointer-events: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 18px 40px var(--shadow),
    0 4px 10px rgba(0, 0, 0, 0.35);
  background: #ebe4d8;
}

.card.is-top {
  z-index: 20;
}

.card.is-dragging img {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 28px 55px rgba(0, 0, 0, 0.5),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.card.is-flying {
  z-index: 50;
  pointer-events: none;
}

.card.is-tucking {
  pointer-events: none;
}

.card.is-flying img,
.card.is-tucking img {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 32px 60px rgba(0, 0, 0, 0.55),
    0 10px 20px rgba(0, 0, 0, 0.35);
}

.card.is-tucking img {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 10px 22px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
}

.hint {
  margin: 1.4rem 0 0;
  font-size: 0.72rem;
  color: var(--mute);
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0.9;
  transition: opacity 300ms ease;
}

.hint.is-hidden {
  opacity: 0;
}

.hint kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  border: 1px solid rgba(217, 180, 138, 0.35);
  border-radius: 3px;
  color: var(--warm);
  font: inherit;
}

.meta {
  width: min(560px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  animation: rise-in 900ms var(--ease-out) 220ms both;
}

.ghost {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--warm);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.35rem 0.2rem;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, color 200ms ease;
  text-decoration: none;
}

a.ghost {
  display: inline-block;
}

.ghost:hover,
.ghost:focus-visible {
  color: var(--paper);
  border-bottom-color: rgba(217, 180, 138, 0.55);
  outline: none;
}

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

@media (max-width: 720px) {
  :root {
    --page-w: min(290px, 46vw);
    --cover-pad: 10px;
  }
}

@media (max-width: 520px) {
  .stage {
    padding-top: 1.25rem;
    gap: 0.75rem;
  }

  .brand__note {
    display: none;
  }

  .hint {
    margin-top: 1.1rem;
  }

  :root {
    --page-w: min(168px, 46vw);
    --cover-pad: 8px;
  }

  .shelf {
    --album-h: clamp(170px, 48vw, 220px);
    --spine-w: 30px;
  }

  .shelf-row {
    padding: 1.5rem 1rem 3.5rem 1.5rem;
    overflow-x: auto;
  }

  .album-shell {
    padding: 0.75rem 0.35rem 1.25rem;
  }

  .page__face {
    gap: 0.4rem;
    padding: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lamp,
  .brand,
  .album-area,
  .deck-area,
  .meta {
    animation: none;
    transition: none;
  }
}
