:root {
  color-scheme: light;
  --paper: #FFF8EF;
  --paper-raised: #FFFCF7;
  --ink: #402F2C;
  --rose: #D98E93;
  --apricot: #F2C3A7;
  --butter: #F7DF9F;
  --sage: #A9B6A0;
  --muted: rgba(64, 47, 44, 0.72);
  --line: rgba(64, 47, 44, 0.16);
  --shadow: 0 24px 70px rgba(64, 47, 44, 0.12);
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 4%, rgba(242, 195, 167, 0.38), transparent 24rem),
    radial-gradient(circle at 92% 18%, rgba(169, 182, 160, 0.24), transparent 26rem),
    var(--paper);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.08;
  text-wrap: balance;
}

h1 {
  max-width: 12ch;
  margin-bottom: 1.25rem;
  font-size: clamp(3.2rem, 9vw, 7rem);
  letter-spacing: -0.055em;
}

h2 {
  max-width: 18ch;
  font-size: clamp(2.2rem, 5.5vw, 4.8rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
}

p {
  max-width: 65ch;
}

.section {
  position: relative;
  width: min(70rem, calc(100% - 2rem));
  margin-inline: auto;
  padding-block: clamp(2.75rem, 5vw, 4.5rem);
}

.cover {
  display: grid;
  min-height: min(100svh, 55rem);
  align-content: center;
}

.cover-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(20rem, 1.15fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
}

.cover-copy {
  min-width: 0;
}

.cover-photo {
  width: 100%;
  margin: 0;
  transform: rotate(1deg);
}

.eyebrow {
  margin-bottom: 0.85rem;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lede,
.section-intro {
  max-width: 42rem;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
}

.button,
.music-button,
.viewer-close {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--paper-raised);
  background: var(--ink);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button {
  margin-top: 1rem;
  padding: 0.8rem 1.25rem;
}

.interactive:focus-visible {
  outline: 4px solid var(--butter);
  outline-offset: 4px;
}

.music-card {
  width: min(32rem, 100%);
  margin-top: 1.5rem;
}

.music-button {
  width: 100%;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: var(--paper-raised);
}

.music-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

#playlist-frame iframe {
  width: 100%;
  min-height: 152px;
  margin-top: 0.8rem;
  border: 0;
  border-radius: 16px;
}

.scrapbook::before {
  position: absolute;
  inset: 3rem -12vw;
  z-index: -1;
  border-radius: 3rem;
  background: rgba(255, 252, 247, 0.72);
  content: "";
  transform: rotate(-0.7deg);
}

.story-spread {
  position: relative;
  margin-top: clamp(3rem, 6vw, 5.5rem);
}

.album-chapter {
  isolation: isolate;
  --chapter-glow-primary: rgba(242, 195, 167, 0.18);
  --chapter-glow-secondary: rgba(255, 248, 239, 0.14);
}

#cover {
  --chapter-glow-primary: rgba(242, 195, 167, 0.24);
  --chapter-glow-secondary: rgba(247, 223, 159, 0.18);
}

#gangtok {
  --chapter-glow-primary: rgba(217, 142, 147, 0.24);
  --chapter-glow-secondary: rgba(247, 223, 159, 0.18);
}

#life-glimpses {
  --chapter-glow-primary: rgba(169, 182, 160, 0.22);
  --chapter-glow-secondary: rgba(255, 248, 239, 0.22);
}

#distance {
  --chapter-glow-primary: rgba(217, 142, 147, 0.22);
  --chapter-glow-secondary: rgba(247, 223, 159, 0.18);
}

#letter {
  --chapter-glow-primary: rgba(255, 252, 247, 0.28);
  --chapter-glow-secondary: rgba(242, 195, 167, 0.16);
}

#closing {
  --chapter-glow-primary: rgba(242, 195, 167, 0.22);
  --chapter-glow-secondary: rgba(217, 142, 147, 0.18);
}

.album-chapter::after {
  position: absolute;
  inset: 8% -8%;
  z-index: -2;
  border-radius: 50%;
  content: "";
  background:
    radial-gradient(
      circle at 22% 28%,
      var(--chapter-glow-primary),
      rgba(255, 248, 239, 0) 58%
    ),
    radial-gradient(
      circle at 78% 66%,
      var(--chapter-glow-secondary),
      rgba(255, 248, 239, 0) 62%
    );
  pointer-events: none;
}

.spread-copy {
  width: min(42rem, 100%);
  margin-bottom: 2rem;
}

.story-spread:nth-of-type(even) .spread-copy {
  margin-left: auto;
}

.spread-photos,
.life-grid,
.call-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: clamp(0.65rem, 1.5vw, 1rem);
  align-items: start;
}

.full-card {
  grid-column: span 12;
}

.two-thirds-card {
  grid-column: span 8;
}

.half-card {
  grid-column: span 6;
}

.third-card {
  grid-column: span 4;
}

.call-wall {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
}

.call-group h3 {
  margin-bottom: 1rem;
}

.call-grid > .call-card {
  grid-column: span 6;
}

.call-grid.three-up > .call-card {
  grid-column: span 4;
}

.memory-glass {
  position: relative;
  width: clamp(11rem, 16vw, 15rem);
  max-width: 100%;
  justify-self: center;
  overflow: hidden;
  isolation: isolate;
  padding: 0.55rem;
  border: 1px solid rgba(217, 142, 147, 0.42);
  border-radius: 1.25rem;
  background:
    linear-gradient(
      145deg,
      rgba(255, 252, 247, 0.94),
      rgba(242, 195, 167, 0.34)
    );
  box-shadow:
    0 1rem 2.5rem rgba(64, 47, 44, 0.16),
    0 0 0 0.35rem rgba(255, 248, 239, 0.68);
}

.memory-glass::before {
  position: absolute;
  inset: -8%;
  z-index: 0;
  content: "";
  background-image: var(--memory-image);
  background-position: center;
  background-size: cover;
  filter: blur(12px) saturate(0.78);
  opacity: 0.16;
  transform: scale(1.08);
}

.memory-glass::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background: linear-gradient(
    180deg,
    rgba(255, 252, 247, 0.3),
    rgba(255, 248, 239, 0.72)
  );
  pointer-events: none;
}

.memory-glass .photo-button,
.memory-glass figcaption {
  position: relative;
  z-index: 1;
}

.memory-glass .photo-button {
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem;
  overflow: visible;
  border-radius: 0.9rem;
  background: rgba(255, 252, 247, 0.88);
}

.memory-glass img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 0.7rem;
}

.memory-glass.private-photo {
  width: clamp(9.5rem, 13vw, 12.5rem);
}

.memory-glass figcaption {
  margin-top: 0.25rem;
  padding: 0.55rem 0.35rem 0.25rem;
  border-radius: 0.65rem;
  background: rgba(255, 252, 247, 0.82);
}

@media (hover: hover) and (pointer: fine) {
  .memory-glass {
    transition: transform 180ms ease;
  }

  .memory-glass:hover,
  .memory-glass:focus-within {
    transform: translateY(-6px) rotate(0deg);
    box-shadow:
      0 1.35rem 3rem rgba(64, 47, 44, 0.2),
      0 0 0 0.35rem rgba(255, 248, 239, 0.78);
  }
}

.private-photo {
  max-width: none;
  width: min(90%, 22rem);
  justify-self: center;
}

.private-wink {
  display: grid;
  justify-items: center;
  text-align: center;
}

.wink-card {
  width: min(16rem, 72vw);
  transform: rotate(-2deg);
}

.photo-card:not(.memory-glass) {
  position: relative;
  margin: 0;
  padding: 0.55rem 0.55rem 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  transition:
    opacity 500ms ease,
    transform 500ms ease;
}

.memory-card,
.photo-card {
  border-color: rgba(64, 47, 44, 0.14);
  box-shadow:
    0 0.4rem 0 rgba(255, 252, 247, 0.9),
    0 1.4rem 3rem rgba(64, 47, 44, 0.14);
}

.develop-wash {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: rgba(255, 248, 239, 0.94);
  opacity: 0;
  pointer-events: none;
}

.gangtok-thread {
  position: absolute;
  inset: 12rem -4rem 5rem;
  z-index: -1;
  width: calc(100% + 8rem);
  height: calc(100% - 17rem);
  overflow: visible;
  pointer-events: none;
}

.thread-path {
  fill: none;
  stroke: rgba(217, 142, 147, 0.62);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.tattoo-sketch {
  position: absolute;
  z-index: 2;
  width: 4.5rem;
  height: 4.5rem;
  overflow: visible;
  pointer-events: none;
}

.tattoo-sketch path {
  fill: none;
  stroke: rgba(64, 47, 44, 0.62);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

[data-photo-id="gangtok-drawing-detail-one"] .tattoo-sketch {
  top: 0.65rem;
  right: 0.65rem;
}

[data-photo-id="gangtok-drawing-detail-two"] .tattoo-sketch {
  top: 0.75rem;
  left: 0.65rem;
}

.light-leak,
.frost-shimmer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.light-leak::before {
  position: absolute;
  inset: -20% auto -20% -35%;
  width: 28%;
  content: "";
  background: linear-gradient(
    90deg,
    rgba(247, 223, 159, 0),
    rgba(247, 223, 159, 0.42),
    rgba(242, 195, 167, 0.18),
    rgba(247, 223, 159, 0)
  );
  transform: skewX(-12deg);
}

.frost-shimmer::before {
  position: absolute;
  inset: -10% auto -10% -35%;
  width: 32%;
  content: "";
  background: linear-gradient(
    90deg,
    rgba(255, 252, 247, 0),
    rgba(255, 252, 247, 0.72),
    rgba(255, 252, 247, 0)
  );
  transform: skewX(-12deg);
}

.paper-confetti,
.closing-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.paper-confetti span,
.closing-hearts span {
  position: absolute;
  opacity: 1;
}

.paper-confetti span {
  width: 0.55rem;
  height: 0.8rem;
  background: var(--apricot);
}

.paper-confetti span:nth-child(2n) {
  background: var(--rose);
}

.paper-confetti span:nth-child(3n) {
  background: var(--butter);
}

.closing-hearts span {
  width: 0.8rem;
  height: 0.8rem;
  background: var(--rose);
  clip-path: polygon(
    50% 88%, 8% 44%, 8% 22%, 22% 8%, 42% 8%,
    50% 20%, 58% 8%, 78% 8%, 92% 22%, 92% 44%
  );
}

.paper-confetti span:nth-child(1) { left: 12%; top: 20%; }
.paper-confetti span:nth-child(2) { left: 28%; top: 10%; }
.paper-confetti span:nth-child(3) { left: 44%; top: 22%; }
.paper-confetti span:nth-child(4) { left: 61%; top: 12%; }
.paper-confetti span:nth-child(5) { left: 76%; top: 24%; }
.paper-confetti span:nth-child(6) { left: 88%; top: 14%; }

.closing-hearts span:nth-child(1) { left: 28%; top: 34%; }
.closing-hearts span:nth-child(2) { left: 50%; top: 20%; }
.closing-hearts span:nth-child(3) { left: 70%; top: 36%; }

.photo-button {
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
}

.photo-button img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-card figcaption {
  padding: 0.75rem 0.35rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.quiet-section {
  width: min(46rem, calc(100% - 2rem));
  text-align: center;
}

.quiet-section p {
  margin-inline: auto;
}

.letter-section {
  width: min(52rem, calc(100% - 2rem));
}

.letter-paper {
  padding: clamp(2rem, 7vw, 5rem);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  transform: rotate(-0.4deg);
}

.closing {
  display: grid;
  min-height: 60svh;
  place-items: center;
  text-align: center;
}

.closing h2 {
  max-width: none;
}

.animal-doodle {
  display: block;
  width: min(24rem, 90vw);
  margin-inline: auto;
  overflow: visible;
}

.closing-doodle .dog {
  transform-origin: 130px 115px;
  --lean-x: 12px;
  animation: lean-together 1.2s 0.25s ease-out both;
}

.closing-doodle .cat {
  transform-origin: 230px 115px;
  --lean-x: -12px;
  animation: lean-together 1.2s 0.25s ease-out both;
}

.closing-doodle .dog-tail {
  transform-origin: 126px 70px;
  animation: tail-wag 0.7s 0.35s ease-in-out 2;
}

.closing-doodle .heart {
  opacity: 0;
  transform-origin: center;
  animation: kiss-heart 0.45s 1.2s ease-out both;
}

@keyframes tail-wag {
  0%,
  100% {
    transform: rotate(-8deg);
  }

  50% {
    transform: rotate(10deg);
  }
}

@keyframes lean-together {
  from {
    transform: translate(0, 0);
  }

  to {
    transform: translate(var(--lean-x), 0);
  }
}

@keyframes kiss-heart {
  from {
    opacity: 0;
    transform: translate(0, 8px) scale(0.3);
  }

  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

.visual-ready [data-effect="cluster"]:not(.is-visible) .photo-card:not(.memory-glass) {
  opacity: 0;
  transform: translateY(14px) rotate(1.5deg);
}

.visual-ready [data-effect="cluster"]:not(.is-visible) .memory-glass {
  opacity: 0;
  transform: translateY(14px);
}

.visual-ready [data-effect="cluster"].is-visible .photo-card:not(.memory-glass) {
  animation: cluster-settle 520ms ease-out both;
  animation-delay: var(--stagger, 0ms);
}

.visual-ready [data-effect="cluster"].is-visible .memory-glass {
  animation: memory-glass-settle 520ms ease-out both;
  animation-delay: var(--stagger, 0ms);
}

.visual-ready [data-effect="develop"]:not(.is-visible) .develop-wash {
  opacity: 1;
}

.visual-ready [data-effect="develop"].is-visible .develop-wash {
  animation: album-develop 720ms ease-out both;
}

.visual-ready [data-effect="develop"].is-visible img {
  animation: cover-settle 720ms ease-out both;
}

.visual-ready [data-effect="thread"]:not(.is-visible) .thread-path,
.visual-ready .tattoo-sketch:not(.is-visible) path {
  stroke-dashoffset: 1;
}

.visual-ready [data-effect="thread"].is-visible .thread-path,
.visual-ready .tattoo-sketch.is-visible path {
  animation: thread-draw 1100ms ease-out both;
}

.visual-ready [data-effect="light-leak"].is-visible {
  animation: light-sweep 900ms ease-out both;
}

.visual-ready [data-effect="shimmer"].is-visible .frost-shimmer {
  animation: frost-pass 700ms ease-out both;
}

.visual-ready [data-effect="letter"].is-visible {
  animation: paper-lift 620ms ease-out both;
}

.visual-ready .closing.is-visible .closing-hearts span {
  animation: heart-float 900ms ease-out both;
}

.visual-ready .closing.is-visible .paper-confetti span {
  animation: confetti-settle 800ms ease-out both;
}

@keyframes album-develop {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.02); }
}

@keyframes cover-settle {
  from { opacity: 0.86; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes cluster-settle {
  from { opacity: 0; transform: translateY(14px) rotate(1.5deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes memory-glass-settle {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes thread-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes light-sweep {
  0% { opacity: 0; transform: translateX(0); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateX(470%); }
}

@keyframes frost-pass {
  0% { opacity: 0; transform: translateX(0); }
  35% { opacity: 0.8; }
  100% { opacity: 0; transform: translateX(440%); }
}

@keyframes paper-lift {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heart-float {
  from { opacity: 0; transform: translateY(10px) scale(0.7); }
  to { opacity: 1; transform: translateY(-12px) scale(1); }
}

@keyframes confetti-settle {
  from { opacity: 0; transform: translateY(-18px) rotate(-10deg); }
  to { opacity: 1; transform: translateY(18px) rotate(16deg); }
}

.photo-viewer {
  width: min(58rem, calc(100% - 2rem));
  max-height: 92svh;
  padding: 1rem;
  border: 0;
  border-radius: 1rem;
  background: var(--paper-raised);
  box-shadow: 0 30px 100px rgba(64, 47, 44, 0.35);
}

.photo-viewer::backdrop {
  background: rgba(40, 29, 28, 0.72);
  backdrop-filter: blur(6px);
}

.photo-viewer img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72svh;
  margin: 1rem auto 0;
}

.viewer-close {
  padding: 0.55rem 1rem;
}

@media (max-width: 700px) {
  :root {
    font-size: 17px;
  }

  .section {
    width: min(100% - 1.25rem, 70rem);
    padding-block: clamp(2.25rem, 8vw, 3.5rem);
  }

  .cover-layout {
    grid-template-columns: 1fr;
  }

  .cover {
    min-height: auto;
    align-content: start;
    padding-block: clamp(1.25rem, 4vw, 2rem) clamp(2rem, 6vw, 3rem);
  }

  .story-spread {
    margin-top: clamp(2.5rem, 9vw, 4rem);
  }

  .spread-photos,
  .life-grid,
  .call-grid,
  .call-grid.three-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cover-photo {
    order: -1;
  }

  .full-card,
  .two-thirds-card,
  .anchor-card {
    grid-column: span 2;
  }

  .half-card,
  .third-card,
  .call-grid > .call-card,
  .call-grid.three-up > .call-card {
    grid-column: span 1;
  }

  .photo-card figcaption {
    padding-top: 0.5rem;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .private-photo {
    width: 92%;
  }

  .memory-glass,
  .memory-glass.private-photo {
    width: 100%;
  }

  .scrapbook::before {
    inset-inline: -0.5rem;
  }

  .letter-paper {
    transform: none;
  }
}

@media (max-width: 329px) {
  .call-grid,
  .call-grid.three-up {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-delay: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reduced-motion .develop-wash,
  .reduced-motion .light-leak,
  .reduced-motion .frost-shimmer {
    opacity: 0 !important;
  }

  .reduced-motion .thread-path,
  .reduced-motion .tattoo-sketch path {
    stroke-dashoffset: 0 !important;
  }

  .reduced-motion [data-effect],
  .reduced-motion [data-effect] .photo-card,
  .reduced-motion .paper-confetti span,
  .reduced-motion .closing-hearts span {
    opacity: 1 !important;
    transform: none !important;
  }
}
