:root {
  --paper: #f6f1ea;
  --paper-2: #efe7dc;
  --ink: #1f1b18;
  --muted: #847a70;
  --line: #d9cfc2;
  --love: #8c1d2c;
  --serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --hand: "Caveat", cursive;
  --arabic: "Amiri", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Soft film grain over the whole page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

em {
  font-style: italic;
  color: var(--love);
}

.eyebrow,
.chapter-label {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Opening */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  text-align: center;
}

h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 18vw, 132px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

h1 em {
  display: block;
  font-size: 0.7em;
  margin: 4px 0;
}

.tagline {
  margin: 22px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 5vw, 26px);
  color: var(--muted);
}

.scroll-cue {
  position: absolute;
  bottom: 34px;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.scroll-cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 42px;
  margin: 10px auto 0;
  background: var(--muted);
  transform-origin: top;
  animation: cue 2.2s ease-in-out infinite;
}

@keyframes cue {
  0% { transform: scaleY(0); opacity: 1; }
  60% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Chapters */
.chapter {
  padding: 110px 0 40px;
  text-align: center;
}

.chapter-label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.chapter-label span {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0;
  color: var(--love);
}

.chapter-label::before,
.chapter-label::after {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--line);
}

.lead {
  max-width: 520px;
  margin: 34px auto 30px;
  font-family: var(--serif);
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.18;
}

.after {
  margin: 26px auto 70px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 5vw, 24px);
  color: var(--muted);
}

.after.big {
  margin-top: 60px;
  font-size: clamp(28px, 7vw, 40px);
  color: var(--ink);
}

/* Childhood photos with the two of them circled */
.kid-photo {
  position: relative;
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 12px 12px 44px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 27, 24, 0.08), 0 24px 50px -20px rgba(31, 27, 24, 0.35);
}

.kid-photo img {
  display: block;
  width: 100%;
  filter: sepia(0.15) saturate(0.9);
}

.kid-photo svg {
  position: absolute;
  top: 12px;
  left: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 56px);
  overflow: visible;
}

.kid-photo ellipse {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.kid-photo .tag {
  position: absolute;
  font-family: var(--hand);
  font-size: clamp(26px, 7vw, 32px);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%) rotate(-6deg);
  opacity: 0;
}

.kid-photo.is-circled ellipse {
  animation: draw 1.3s cubic-bezier(0.6, 0, 0.3, 1) forwards;
}

.kid-photo.is-circled ellipse + ellipse {
  animation-delay: 0.9s;
}

.kid-photo.is-circled .tag {
  animation: tag-in 0.6s ease forwards;
  animation-delay: 1.4s;
}

.kid-photo.is-circled .tag + .tag {
  animation-delay: 2.3s;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes tag-in {
  to { opacity: 1; }
}

/* II. The years in between */
.between {
  padding-top: 130px;
  padding-bottom: 100px;
}

blockquote {
  max-width: 600px;
  margin: 40px auto 0;
  font-family: var(--serif);
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1.15;
}

.arabic {
  margin: 36px 0 0;
  font-family: var(--arabic);
  font-size: clamp(30px, 8vw, 40px);
  color: var(--love);
}

/* III. Now */
.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 40px;
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* Offset the second column for an editorial rhythm. */
.gallery img:nth-child(even) {
  margin-top: 48px;
}

/* Al-Fatiha */
.finale {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
  min-height: 90svh;
  margin: 60px -20px 0;
  padding: 80px 20px;
  background: var(--love);
  color: var(--paper);
  text-align: center;
}

.finale .eyebrow {
  color: rgba(246, 241, 234, 0.75);
}

.finale h2 {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(72px, 20vw, 140px);
  line-height: 1;
}

.finale .tagline {
  margin-top: 10px;
  color: rgba(246, 241, 234, 0.85);
}

.names {
  margin: 70px 0 0;
  font-family: var(--serif);
  font-size: 28px;
}

.names em {
  color: rgba(246, 241, 234, 0.75);
}

/* Fade up as each piece scrolls into view. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

@media (min-width: 760px) {
  .gallery {
    gap: 20px;
  }

  .gallery img:nth-child(even) {
    margin-top: 90px;
  }

  .finale {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .kid-photo ellipse {
    stroke-dashoffset: 0;
    animation: none !important;
  }

  .kid-photo .tag {
    opacity: 1;
    animation: none !important;
  }

  .scroll-cue::after {
    animation: none;
  }
}

/* Song */
.song-button {
  margin-top: 34px;
  padding: 12px 26px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 12px var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.6s ease;
}

.song-button:hover {
  background: var(--ink);
  color: var(--paper);
}

.song-button.is-gone {
  opacity: 0;
  pointer-events: none;
}

.yt-holder {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 200px;
  height: 113px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.sound-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(246, 241, 234, 0.85);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.sound-toggle[hidden] {
  display: none;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}

.bars i {
  width: 2px;
  height: 100%;
  background: var(--love);
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite alternate;
}

.bars i:nth-child(2) { animation-delay: 0.2s; }
.bars i:nth-child(3) { animation-delay: 0.4s; }
.bars i:nth-child(4) { animation-delay: 0.1s; }

.sound-toggle.is-paused .bars i {
  animation: none;
  transform: scaleY(0.25);
}

@keyframes eq {
  from { transform: scaleY(0.3); }
  to { transform: scaleY(1); }
}
