:root {
  color-scheme: light;
  --berry: #a3325a;
  --rose: #b93d6a;
  --ink: #5a3145;
  --paper: #fffaf6;
  --display: 'Fraunces', Georgia, serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --body: 'Nunito', system-ui, sans-serif;
  font-family: var(--body);
  background: #ffebf1;
  color: var(--ink);
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 0;
  background:
    url('assets/kalp-deseni.png') 20px 13px / clamp(172px, 23vw, 273px) auto repeat,
    radial-gradient(ellipse at 50% 15%, #fff9edba, transparent 56%),
    radial-gradient(ellipse at 86% 87%, #ede3ff91, transparent 64%),
    repeating-linear-gradient(90deg, #fff6f662 0 22px, transparent 22px 44px),
    linear-gradient(156deg, #ffe5ed 0%, #fff1f6 54%, #ffe4ee 100%);
}

button { color: inherit; font: inherit; }
img { display: block; max-width: 100%; }
::selection { background: #f5b8d1; color: #5d1e3d; }
:focus-visible { outline: 3px solid #8b2852; outline-offset: 6px; }

.scrapbook {
  isolation: isolate;
  overflow: clip;
  position: relative;
  min-height: 100svh;
  padding: clamp(1.8rem, 5vw, 3.9rem) 0 2.2rem;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.55rem, 2.6vw, 2rem);
  margin-bottom: clamp(1.9rem, 4.3vw, 3.3rem);
  text-align: center;
}

.masthead h1 {
  margin: 0;
  color: var(--berry);
  font-family: var(--display);
  font-size: clamp(3.45rem, 10vw, 7.5rem);
  font-weight: 700;
  font-style: italic;
  line-height: 1.04;
  letter-spacing: -.06em;
  text-shadow: 0 3px 0 #fffaf9, 0 8px 24px #a54c7222;
}

.title-hearts {
  position: relative;
  width: 1.5em;
  color: #e77ca3;
  font-family: 'Segoe UI Symbol', sans-serif;
  font-size: clamp(1.55rem, 4.2vw, 3.2rem);
  line-height: 1;
}

.title-hearts i { display: block; font-style: normal; }
.title-hearts i + i {
  position: absolute;
  top: -.54em;
  left: 66%;
  color: #bc7fb7;
  font-size: .47em;
}
.title-hearts-left { rotate: -18deg; }
.title-hearts-right { rotate: 18deg; }
.title-hearts-right i + i { left: 6%; color: #da7eaa; }

.hero {
  width: min(1120px, calc(100% - 6rem));
  margin: 0 auto;
  display: grid;
  grid-template: 'left letter right' / minmax(0, 1fr) minmax(360px, 2fr) minmax(0, 1fr);
  place-items: center;
  column-gap: clamp(1rem, 3vw, 2.5rem);
}

.letter {
  position: relative;
  z-index: 1;
  grid-area: letter;
  width: 100%;
  padding: clamp(1.55rem, 3.6vw, 2.4rem) clamp(1.35rem, 3vw, 2.35rem) 2.45rem;
  border: 1px solid #f3c4d2;
  border-radius: 1.35rem 1.15rem 1.6rem 1.2rem;
  background:
    radial-gradient(ellipse at 25% 0, #fff8e9a6, transparent 64%),
    repeating-linear-gradient(0deg, #ffddea19 0 1px, transparent 1px 7px),
    var(--paper);
  box-shadow: 0 18px 45px #9f4e7320, 0 3px 0 #fff8f7;
  text-align: center;
}

.letter::before {
  content: '';
  position: absolute;
  inset: .58rem;
  border: 1px dashed #dc94af;
  border-radius: 1rem .83rem 1.23rem .91rem;
  pointer-events: none;
}

.letter-content { position: relative; }

.letter h2 {
  margin: .15rem auto .55rem;
  color: #a92e59;
  font-family: var(--hand);
  font-size: clamp(2.4rem, 4.6vw, 3.45rem);
  font-weight: 700;
  letter-spacing: -.033em;
  line-height: .99;
  text-wrap: balance;
}

.letter-opening, .letter-wish {
  margin: .7rem auto 0;
  max-width: 32ch;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  font-weight: 650;
  line-height: 1.5;
  text-wrap: pretty;
}
.letter-opening {
  max-width: 37ch;
  white-space: pre-line;
  text-align: center;
  text-wrap: balance;
}
.letter-wish { margin-top: .62rem; font-weight: 800; color: #80294f; }
.letter-ending {
  margin: .28rem 0 .85rem;
  color: #a52f59;
  font: 700 clamp(1.65rem, 2.9vw, 2.2rem)/1.2 var(--hand);
}

.memory-link {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  margin-top: .05rem;
  padding: .48rem 1.2rem;
  border-radius: 99rem;
  color: #fffdfd;
  background: #a93260;
  box-shadow: 0 3px 0 #7f1e45;
  font-size: .94rem;
  font-weight: 800;
  text-decoration: none;
  transition: background .18s ease, translate .18s ease, box-shadow .18s ease;
}
.memory-link:hover { translate: 0 -2px; background: #94264f; box-shadow: 0 5px 0 #7f1e45; }
.memory-link span { color: #ffdde9; }

.seal {
  position: absolute;
  right: 1.13rem;
  bottom: .98rem;
  display: grid;
  place-items: center;
  width: 2.55rem;
  aspect-ratio: 1;
  border: 2px solid #e796b3;
  border-radius: 47% 53% 50% 46%;
  background: radial-gradient(circle at 35% 22%, #fabfd5, #e489ab 72%);
  color: #942c55;
  box-shadow: inset 0 0 0 2px #f5adc7, 0 2px 4px #aa427842;
  font: 1.22rem 'Segoe UI Symbol', sans-serif;
  rotate: -13deg;
  pointer-events: none;
}

.hero-photo { position: relative; width: 100%; max-width: 248px; }
.hero-photo-left {
  grid-area: left;
  --tilt: -8deg;
  translate: 0 .12rem;
}
.hero-photo-right { grid-area: right; --tilt: 8deg; translate: 0 1.38rem; }

.polaroid {
  display: block;
  position: relative;
  width: 100%;
  padding: .58rem .58rem 0;
  border: 1px solid #ead4d7;
  border-radius: .34rem;
  background: #fffdfb;
  box-shadow: 0 .85rem 1.5rem #73395028, 0 .14rem .27rem #78465e23;
  color: #d86894;
  rotate: var(--tilt);
  transition: rotate .22s ease, translate .22s ease, box-shadow .22s ease;
}
.polaroid.is-ready { cursor: zoom-in; }
.polaroid:disabled { opacity: 1; }

.photo-area {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: var(--photo-ratio);
  border-radius: .1rem;
  background: #f2e0e7;
}
.photo-area img { width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.is-ready .photo-area img { opacity: 1; }
.print-heart { display: flex; align-items: center; justify-content: center; gap: .28em; min-height: 2rem; font-size: .98rem; }
.print-heart::before, .print-heart::after { content: '♥'; font-size: .63em; color: #ea9cb8; }
.print-heart::after { color: #b693cf; }

.tape {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: -.7rem;
  width: 39%;
  height: 1.5rem;
  background: repeating-linear-gradient(45deg, #ffffff55 0 4px, transparent 4px 8px), var(--tape-color);
  clip-path: polygon(0 0, 100% 0, 97% 15%, 100% 29%, 97% 42%, 100% 60%, 97% 78%, 100% 100%, 0 100%, 3% 81%, 0 66%, 3% 51%, 0 32%, 3% 15%);
  transform: translateX(-50%) rotate(var(--tape-tilt, -5deg));
  pointer-events: none;
}
.pink-tape { --tape-color: #ef95b5d4; }
.blue-tape { --tape-color: #b5ceefd9; --tape-tilt: 5deg; }
.peach-tape { --tape-color: #fac4aedb; --tape-tilt: -4deg; }

[data-stickers="sanrio"] {
  --top-sticker: url('assets/hello-kitty.png');
  --bottom-sticker: url('assets/cinnamoroll.png');
}
[data-stickers="bears"] {
  --top-sticker: url('assets/bubu-dudu-yanak-1.png');
  --bottom-sticker: url('assets/bubu-dudu-yanak-7.png');
}
.album-continued [data-stickers="sanrio"] {
  --top-sticker: url('assets/cinnamoroll.png');
  --bottom-sticker: url('assets/hello-kitty.png');
}
.album-continued [data-stickers="bears"] {
  --top-sticker: url('assets/bubu-dudu-yanak-7.png');
  --bottom-sticker: url('assets/bubu-dudu-yanak-1.png');
}

.photo-decoration {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}
.photo-corner {
  position: absolute;
  width: clamp(1.85rem, 26%, 4.25rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--corner-sticker, none) center / contain no-repeat;
  color: #df78a3;
  font: clamp(1.22rem, 3.2vw, 2.1rem)/1 'Segoe UI Symbol', sans-serif;
  filter: drop-shadow(0 2px 1px #713b562f);
}
.photo-corner::before { content: var(--corner-symbol, ''); text-shadow: 0 1px 0 #fff9fb; }
.photo-corner::after {
  content: var(--corner-accent, '');
  position: absolute;
  inset: 13% 8% auto auto;
  color: #9c78bd;
  font-size: .43em;
  rotate: 9deg;
}
.corner-top-left, .corner-top-right { bottom: calc(100% - .18rem); }
.corner-bottom-left, .corner-bottom-right { top: calc(100% - .38rem); }
.corner-top-left, .corner-bottom-left { left: -.28rem; }
.corner-top-right, .corner-bottom-right { right: -.28rem; }
.corner-top-left { --corner-symbol: '♥'; --corner-accent: '✦'; }
.corner-top-right { --corner-sticker: var(--top-sticker, none); }
.corner-bottom-left { --corner-sticker: var(--bottom-sticker, none); }
.corner-bottom-right { --corner-symbol: '♡'; --corner-accent: '♥'; color: #a384ca; }
.blue-tape .corner-top-left { color: #7e9ed7; }
.blue-tape .corner-bottom-right { --corner-symbol: '♥'; --corner-accent: '✧'; color: #d57ba9; }
.peach-tape .corner-top-left { --corner-symbol: '🎀'; --corner-accent: ''; font-family: 'Segoe UI Emoji', sans-serif; }

.hero-photo-left .corner-top-right, .hero-photo-left .corner-bottom-left {
  width: clamp(2.9rem, 34%, 5.2rem);
}
.hero-photo-left .corner-bottom-right { right: .5rem; }
.hero-photo-right .corner-bottom-left { left: .5rem; }

.memories {
  width: min(970px, calc(100% - 5rem));
  margin: clamp(4.3rem, 7.3vw, 6.45rem) auto 0;
  scroll-margin-top: 1rem;
  text-align: center;
}
.divider { display: flex; align-items: center; justify-content: center; gap: .8rem; color: #b84672; }
.divider::before, .divider::after { content: ''; width: min(23vw, 6rem); border-top: 1px dashed #d791ad; }
.divider span { font: 1.64rem/1 'Segoe UI Symbol', sans-serif; }
.memories h2 {
  margin: .5rem 0 clamp(3.8rem, 6.15vw, 4.85rem);
  color: var(--berry);
  font: italic 700 clamp(1.95rem, 4.5vw, 3.25rem)/1.15 var(--display);
  letter-spacing: -.04em;
}

.album {
  display: grid;
  grid-template: 'left center right' / minmax(0, .87fr) minmax(0, 1.36fr) minmax(0, .77fr);
  align-items: center;
  gap: clamp(2.55rem, 5.4vw, 3.9rem);
  padding: .65rem 1.15rem 1.4rem;
}
.album-left { grid-area: left; --tilt: -5deg; }
.album-center { grid-area: center; --tilt: 3deg; align-self: start; }
.album-right { grid-area: right; --tilt: 6deg; translate: 0 .6rem; }
.photo-error { font-size: .94rem; }

.album-continued {
  --album-gap: clamp(2.65rem, 4.5vw, 3.75rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(6.65rem, 9vw, 7rem) var(--album-gap);
  margin-top: clamp(4.7rem, 7.3vw, 5.6rem);
  padding: .6rem 1.15rem 2.8rem;
}
.album-continued .polaroid {
  flex: 0 0 calc((100% - 3 * var(--album-gap)) / 4);
  min-width: 0;
  --tilt: -3deg;
}
.album-continued .polaroid:nth-child(even) { --tilt: 3deg; translate: 0 .28rem; }
.album-continued .polaroid:last-child { --tilt: 3deg; }

.final-hearts {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .64rem;
  margin-top: 2.9rem;
  color: #d07d9c;
  font: 1rem 'Segoe UI Symbol', sans-serif;
}
.final-hearts span:nth-child(2) { color: #b43d6a; font-size: 1.43rem; }
.final-hearts span:last-child { color: #987db7; }

.confetti { position: absolute; z-index: -1; inset: 0; pointer-events: none; overflow: clip; user-select: none; }
.doodle {
  position: absolute;
  top: var(--top);
  left: var(--left);
  color: var(--color, #df86aba8);
  font: var(--size, 2rem)/1 'Segoe UI Symbol', sans-serif;
  rotate: var(--spin, -14deg);
}
.d1 { --top: 6%; --left: 9%; --size: clamp(1.6rem, 4vw, 3.8rem); }
.d2 { --top: 5%; --left: 24%; --color: #db89b7; --size: 1.2rem; }
.d3 { --top: 13%; --left: 83%; --color: #dc83a7; --size: 2.4rem; --spin: 19deg; }
.d4 { --top: 4%; --left: 91%; --color: #e78eae; --size: clamp(1.8rem, 4vw, 3.65rem); --spin: 19deg; }
.d5 { --top: 32%; --left: 3%; --size: 2rem; --color: #bc87c5; }
.d6 { --top: 19%; --left: 12%; --size: 1.7rem; --color: #dc89a3; }
.d7 { --top: 45%; --left: 15%; --size: 1.9rem; --color: #e69ab5; }
.d8 { --top: 37%; --left: 92%; --size: 1.6rem; --color: #9686b7a8; --spin: 22deg; }
.d9 { --top: 26%; --left: 95%; --size: 1.45rem; --color: #e89cbb; }
.d10 { --top: 68%; --left: 5%; --size: 2.75rem; --color: #e29cba; }
.d11 { --top: 68%; --left: 86%; --size: clamp(1.7rem, 4vw, 3.6rem); --color: #e78bae; --spin: 16deg; }
.d12 { --top: 58%; --left: 76%; --size: 1.8rem; --color: #a59bc6; }
.d13 { --top: 90%; --left: 88%; --size: 2.4rem; --color: #c490c3; --spin: 13deg; }
.d14 { --top: 90%; --left: 13%; --size: 1.8rem; --color: #d58aad; }
.d15 { --top: 83%; --left: 3%; --size: 1.5rem; --color: #da8ba9; }
.d16 { --top: 93%; --left: 67%; --size: 1.15rem; --color: #e082ac; --spin: 15deg; }

.waiting { display: grid; min-height: 100svh; place-items: center; padding: 1.3rem; }
.waiting-card {
  max-width: 28rem;
  padding: 1.7rem 2rem;
  border: 1px solid #ebadbf;
  border-radius: 1rem;
  background: var(--paper);
  box-shadow: 0 1rem 2.6rem #a04d7422;
  font-size: 1.07rem;
  font-weight: 700;
  text-align: center;
}
.waiting-card p { margin: .65rem 0 .1rem; }
.waiting-heart { color: #b03966; font: 2.3rem 'Segoe UI Symbol', sans-serif; }

.lightbox {
  width: fit-content;
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 3rem);
  overflow: visible;
  padding: .47rem;
  border: none;
  border-radius: .6rem;
  background: #fffafc;
  box-shadow: 0 1rem 5rem #36102477;
}
.lightbox::backdrop { background: #452338dd; backdrop-filter: blur(5px); }
.lightbox img { width: auto; height: auto; max-width: min(83vw, 850px); max-height: min(81dvh, 1100px); border-radius: .35rem; }
.close-photo {
  position: absolute;
  top: -.85rem;
  right: -.8rem;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #a93260;
  color: #fff;
  font: 1.9rem/1 var(--body);
  cursor: pointer;
}

@media (hover: hover) {
  .polaroid.is-ready:hover { z-index: 1; rotate: 0deg; translate: 0 -.24rem; box-shadow: 0 1rem 2rem #73395042; }
}

@media (max-width: 800px) {
  .hero {
    width: min(535px, calc(100% - 2rem));
    grid-template-areas: 'letter letter' 'left right';
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(1.35rem, 6.2vw, 3rem);
    row-gap: clamp(4.35rem, 16vw, 5.85rem);
  }
  .hero-photo { width: 90%; max-width: 214px; }
  .hero-photo-left { --tilt: -5deg; }
  .hero-photo-right { --tilt: 5deg; translate: 0 .65rem; }
  .memories { margin-top: 4.6rem; width: min(580px, calc(100% - 2rem)); }
  .album-continued .polaroid { flex-basis: calc((100% - 2 * var(--album-gap)) / 3); }
  .d2 { --left: 16%; }
  .d5, .d7, .d8, .d11 { opacity: .55; }
}

@media (max-width: 680px) {
  .album {
    grid-template-areas: 'center center' 'left right';
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: clamp(6.4rem, calc(20vw + 1.25rem), 9.65rem) clamp(2.9rem, 8.6vw, 4rem);
    padding: .55rem .8rem 1rem;
  }
  .album-center { justify-self: center; width: min(92%, 330px); }
  .album-left { width: 90%; justify-self: center; }
  .album-right { width: 81%; justify-self: center; }
  .album-continued { margin-top: clamp(5.2rem, 17vw, 7.5rem); }
}

@media (max-width: 500px) {
  .scrapbook { padding-top: 2.25rem; }
  .masthead { margin-bottom: 1.42rem; }
  .masthead h1 { font-size: clamp(3.22rem, 15vw, 4.25rem); }
  .title-hearts { font-size: 1.65rem; }
  .letter { padding: 1.35rem 1.05rem 1.56rem; }
  .letter h2 { font-size: clamp(2.22rem, 9.35vw, 3rem); }
  .letter-opening { padding: 0 .35rem; }
  .seal { right: .83rem; bottom: .65rem; width: 1.86rem; font-size: .94rem; }
  .polaroid { padding: .39rem .39rem 0; }
  .print-heart { min-height: 1.52rem; }
  .tape { height: 1.07rem; top: -.46rem; }
  .photo-corner { width: clamp(1.7rem, 26%, 3rem); }
  .hero-photo-left .corner-top-right, .hero-photo-left .corner-bottom-left { width: clamp(2.55rem, 33%, 3.5rem); }
  .album-continued {
    --album-gap: 2.35rem;
    row-gap: clamp(5.45rem, 20vw, 6.35rem);
    padding-inline: .8rem;
  }
  .album-continued .polaroid { flex-basis: calc((100% - var(--album-gap)) / 2); }
  .d1 { --left: 9%; --top: 1%; }
  .d3 { --left: 87%; --top: 5%; --size: 1.35rem; }
  .d4 { --left: 86%; --top: 1%; }
  .d6, .d7, .d9 { display: none; }
  .d10 { --left: 2%; --top: 51%; }
  .d11 { --left: 88%; --top: 52%; }
  .d12 { --left: 81%; --top: 58%; }
}

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