:root {
  --ink: #1c1712;
  --muted: #6b5e52;
  --paper: #fffdf8;
  --polaroid: #fffef9;
  --tape: rgba(0, 194, 168, 0.35);
  --accent: #00c2a8;
  --accent-deep: #009e88;
  --cork: #c4a882;
  --cork-deep: #b09068;
  --shadow: rgba(28, 23, 18, 0.28);
  --font-hand: "Caveat", cursive;
  --font-note: "Patrick Hand", cursive;
  --font-ui: "Sora", system-ui, sans-serif;
  --space: clamp(1rem, 3.5vw, 2rem);
  --polaroid-w: min(92vw, 26rem);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--cork);
  line-height: 1.45;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

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

button {
  font: inherit;
}

/* Corkboard atmosphere */
.album-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.18), transparent 32%),
    radial-gradient(circle at 82% 70%, rgba(0, 194, 168, 0.12), transparent 36%),
    repeating-linear-gradient(
      90deg,
      transparent 0 11px,
      rgba(90, 60, 30, 0.04) 11px 12px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 13px,
      rgba(90, 60, 30, 0.035) 13px 14px
    ),
    linear-gradient(145deg, #d2b48c 0%, #c4a882 45%, #b8956c 100%);
}

.album-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Header */
.album-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem var(--space);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px dashed rgba(28, 23, 18, 0.18);
}

.brand-stamp {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-stamp img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.album-hint {
  display: none;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  font-family: var(--font-note);
  font-size: 1.05rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px) rotate(-1deg);
}

.btn-buy {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-buy:hover {
  background: var(--accent-deep);
  color: #fff;
}

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 rgba(28, 23, 18, 0.15);
}

.btn-ghost:hover {
  background: #fff;
}

.btn-copy {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  margin-top: 0.75rem;
}

.btn-copy.copied {
  background: var(--accent);
  color: var(--ink);
}

/* Album stage */
.album {
  width: min(100%, 56rem);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) var(--space) 1.5rem;
}

.album-stage {
  text-align: center;
}

.album-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
  animation: soft-in 0.7s ease both;
}

.album-sub {
  font-family: var(--font-hand);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  color: var(--muted);
  margin-bottom: 1.35rem;
  animation: soft-in 0.7s ease 0.08s both;
}

/* Deck */
.deck {
  position: relative;
  width: var(--polaroid-w);
  height: clamp(28rem, 78vw, 34rem);
  margin: 0 auto 1.25rem;
  touch-action: none;
  perspective: 1200px;
}

.polaroid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.85rem 0.55rem;
  background: var(--polaroid);
  border: 1px solid rgba(28, 23, 18, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 40px var(--shadow);
  transform: translate3d(0, 0, 0) rotate(var(--tilt, 0deg));
  transform-origin: 50% 80%;
  cursor: grab;
  user-select: none;
  will-change: transform;
  transition: box-shadow 0.25s ease;
}

.polaroid::before {
  content: "";
  position: absolute;
  top: -0.45rem;
  left: 50%;
  width: 4.5rem;
  height: 1.15rem;
  background: var(--tape);
  border: 1px solid rgba(0, 140, 120, 0.2);
  transform: translateX(-50%) rotate(-2deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.polaroid.is-top {
  z-index: 10;
  cursor: grab;
}

.polaroid.is-top:active,
.polaroid.is-dragging {
  cursor: grabbing;
  box-shadow: 0 28px 55px rgba(28, 23, 18, 0.35);
}

.polaroid.is-leaving {
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.polaroid-photo {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 3 / 2.35;
  overflow: hidden;
  background: #ece7df;
  border: 1px solid rgba(28, 23, 18, 0.1);
}

.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.polaroid-photo--cover img {
  object-position: center 40%;
  filter: saturate(1.05);
}

.cover-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.25rem;
  background: linear-gradient(180deg, transparent 35%, rgba(10, 10, 10, 0.72) 100%);
  color: #fff;
  pointer-events: none;
}

.cover-stamp img {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.cover-stamp strong {
  font-family: var(--font-hand);
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 700;
}

.cover-stamp span {
  font-family: var(--font-note);
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 1.1rem;
}

.polaroid-caption {
  font-family: var(--font-hand);
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  font-weight: 600;
  text-align: center;
  padding: 0.7rem 0.35rem 0.35rem;
  color: var(--ink);
  min-height: 2.6rem;
}

/* Text polaroids / notes */
.polaroid-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.1rem 1rem;
  background:
    linear-gradient(180deg, rgba(0, 194, 168, 0.08), transparent 40%),
    repeating-linear-gradient(
      transparent 0 1.55rem,
      rgba(0, 194, 168, 0.12) 1.55rem 1.6rem
    ),
    #fffef6;
  text-align: center;
  aspect-ratio: auto;
  min-height: 16rem;
}

.note-label {
  font-family: var(--font-hand);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1;
}

.ca-text {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  font-weight: 600;
  word-break: break-all;
  line-height: 1.35;
  max-width: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--muted);
  padding: 0.65rem 0.75rem;
}

.note-doodle {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--muted);
}

.note-steps {
  list-style: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-note);
  font-size: 1.12rem;
  display: grid;
  gap: 0.55rem;
}

.note-steps strong {
  font-family: var(--font-hand);
  color: var(--accent-deep);
  margin-right: 0.25rem;
}

.note-roadmap {
  list-style: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-note);
  font-size: 1.1rem;
  display: grid;
  gap: 0.7rem;
}

.note-roadmap span {
  display: inline-block;
  font-family: var(--font-hand);
  font-weight: 700;
  color: var(--accent-deep);
  margin-right: 0.35rem;
  font-size: 1.25rem;
}

.polaroid-note--end {
  gap: 0.75rem;
}

.end-logo {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
}

.end-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.end-links a {
  font-family: var(--font-note);
  font-size: 1.15rem;
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
}

.end-links a:hover {
  background: var(--accent);
}

/* Controls */
.deck-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
  max-width: var(--polaroid-w);
  margin-left: auto;
  margin-right: auto;
}

.deck-status {
  font-family: var(--font-hand);
  font-size: clamp(1.15rem, 4vw, 1.35rem);
  color: var(--ink);
  text-align: center;
}

/* Filmstrip nav = gallery as navigation */
.filmstrip {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.85rem 0.35rem 1.1rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.film-thumb {
  flex: 0 0 auto;
  width: 4.4rem;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  background: var(--polaroid);
  border: 1px solid rgba(28, 23, 18, 0.12);
  box-shadow: 0 6px 14px rgba(28, 23, 18, 0.16);
  transform: rotate(-1deg);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.film-thumb:nth-child(even) {
  transform: rotate(1.5deg);
}

.film-thumb:hover {
  transform: translateY(-4px) rotate(0deg) scale(1.04);
  box-shadow: 0 10px 18px rgba(28, 23, 18, 0.22);
}

.film-thumb.is-active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.25), 0 10px 18px rgba(28, 23, 18, 0.2);
}

.film-thumb img {
  width: 100%;
  height: 2.6rem;
  object-fit: cover;
  border: 1px solid rgba(28, 23, 18, 0.1);
  background: #ddd;
}

.film-thumb span {
  font-family: var(--font-hand);
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.film-thumb--text {
  justify-content: center;
  min-height: 4.55rem;
}

.film-thumb--text span {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0.85rem 0;
}

.album-footer {
  text-align: center;
  padding: 0.5rem var(--space) 1.75rem;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: rgba(28, 23, 18, 0.65);
}

@keyframes soft-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 720px) {
  .album-hint {
    display: block;
  }

  .deck {
    height: 36rem;
  }

  .polaroid {
    padding: 1rem 1rem 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
