:root {
  color-scheme: light;
  font-family: "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  background: #180d12;
  color: #fff8f8;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #180d12;
}

.page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  isolation: isolate;
  padding: 34px 24px 42px;
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: -36px;
  z-index: -3;
  background:
    linear-gradient(180deg, rgba(24, 13, 18, 0.24), rgba(24, 13, 18, 0.78)),
    linear-gradient(120deg, rgba(83, 24, 45, 0.74), rgba(17, 15, 22, 0.74)),
    url("./assets/photo.jpg") center / cover;
  filter: blur(24px) saturate(1.18);
  transform: scale(1.08);
}

.page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(255, 214, 222, 0.14) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 214, 222, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 78%, transparent);
  opacity: 0.3;
}

.page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(24, 13, 18, 0.78), rgba(24, 13, 18, 0.12), rgba(24, 13, 18, 0.78)),
    linear-gradient(180deg, rgba(255, 234, 238, 0.2), transparent 28%, rgba(24, 13, 18, 0.74));
}

.memory {
  position: relative;
  width: min(100%, 620px);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 0;
}

.portrait {
  position: relative;
  width: min(72vw, 390px);
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 236, 240, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 222, 230, 0.2)),
    rgba(255, 244, 247, 0.2);
  box-shadow:
    0 28px 80px rgba(7, 4, 6, 0.62),
    0 0 0 10px rgba(255, 235, 240, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.portrait::before,
.portrait::after {
  content: "♥";
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #7a1831;
  background: #fff7f9;
  box-shadow: 0 14px 32px rgba(42, 9, 18, 0.28);
}

.portrait::before {
  top: -17px;
  right: -18px;
  font-size: 1.45rem;
}

.portrait::after {
  bottom: -16px;
  left: -16px;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  color: #b98720;
}

.photo {
  display: block;
  width: 100%;
  height: min(68vh, 690px);
  min-height: 420px;
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(38, 8, 18, 0.34);
  background: #fff;
}

.note {
  position: relative;
  width: min(100%, 850px);
  padding: 20px 28px 23px;
  border: 1px solid rgba(255, 235, 239, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 246, 248, 0.95), rgba(255, 224, 231, 0.88)),
    rgba(255, 246, 248, 0.92);
  box-shadow:
    0 20px 56px rgba(8, 4, 7, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.note::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(117, 36, 56, 0.16);
  border-radius: 6px;
  pointer-events: none;
}

.message {
  position: relative;
  margin: 0;
  font-size: clamp(1.45rem, 2.15vw, 2.35rem);
  line-height: 1.85;
  font-weight: 800;
  letter-spacing: 0;
  text-wrap: balance;
  color: #5b182b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.message span {
  display: block;
}

.hearts {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.hearts span {
  position: absolute;
  color: rgba(255, 226, 232, 0.5);
  font-size: clamp(1rem, 1.8vw, 2rem);
  text-shadow: 0 12px 28px rgba(68, 7, 23, 0.4);
}

.hearts span:nth-child(1) {
  top: 13%;
  left: 18%;
  transform: rotate(-18deg);
}

.hearts span:nth-child(2) {
  top: 27%;
  right: 15%;
  color: rgba(248, 197, 208, 0.36);
  transform: rotate(16deg);
}

.hearts span:nth-child(3) {
  bottom: 28%;
  left: 13%;
  color: rgba(255, 247, 249, 0.38);
  transform: rotate(12deg);
}

.hearts span:nth-child(4) {
  bottom: 15%;
  right: 21%;
  color: rgba(213, 164, 57, 0.42);
  transform: rotate(-11deg);
}

.hearts span:nth-child(5) {
  top: 52%;
  left: 7%;
  font-size: clamp(0.9rem, 1.2vw, 1.4rem);
  color: rgba(255, 226, 232, 0.3);
  transform: rotate(24deg);
}

@media (max-width: 640px) {
  html,
  body {
    min-height: 100svh;
  }

  .page {
    min-height: 100svh;
    place-items: start center;
    padding:
      calc(14px + env(safe-area-inset-top))
      12px
      calc(18px + env(safe-area-inset-bottom));
    overflow-x: clip;
    overflow-y: auto;
  }

  .backdrop {
    inset: -22px;
    background:
      linear-gradient(180deg, rgba(24, 13, 18, 0.1), rgba(24, 13, 18, 0.84)),
      linear-gradient(120deg, rgba(85, 23, 43, 0.68), rgba(18, 10, 16, 0.78)),
      url("./assets/photo.jpg") center top / cover;
    filter: blur(16px) saturate(1.12);
    transform: scale(1.05);
  }

  .page::before {
    background-size: 34px 34px;
    opacity: 0.2;
  }

  .page::after {
    background:
      linear-gradient(180deg, rgba(255, 230, 235, 0.18), transparent 34%, rgba(24, 13, 18, 0.88)),
      linear-gradient(90deg, rgba(24, 13, 18, 0.42), transparent, rgba(24, 13, 18, 0.42));
  }

  .memory {
    width: min(100%, 420px);
    min-height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    align-content: center;
    gap: 12px;
  }

  .portrait {
    width: min(82vw, 320px);
    padding: 6px;
    box-shadow:
      0 22px 54px rgba(7, 4, 6, 0.6),
      0 0 0 7px rgba(255, 235, 240, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.86);
  }

  .portrait::before {
    top: -12px;
    right: -10px;
    width: 38px;
    height: 38px;
    font-size: 1.08rem;
  }

  .portrait::after {
    bottom: -10px;
    left: -9px;
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }

  .photo {
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    object-position: center;
  }

  .note {
    width: min(100%, 360px);
    padding: 15px 16px 17px;
    border-color: rgba(255, 235, 239, 0.5);
    box-shadow:
      0 16px 38px rgba(8, 4, 7, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }

  .note::before {
    inset: 8px;
  }

  .message {
    font-size: clamp(1rem, 5.15vw, 1.28rem);
    line-height: 1.72;
    font-weight: 800;
  }

  .hearts span {
    font-size: 1rem;
    color: rgba(255, 226, 232, 0.34);
  }

  .hearts span:nth-child(1) {
    top: 9%;
    left: 8%;
  }

  .hearts span:nth-child(2) {
    top: 18%;
    right: 8%;
  }

  .hearts span:nth-child(3) {
    bottom: 28%;
    left: 7%;
  }

  .hearts span:nth-child(4) {
    bottom: 10%;
    right: 10%;
  }

  .hearts span:nth-child(5) {
    display: none;
  }
}

@media (max-width: 380px), (max-height: 700px) {
  .memory {
    min-height: auto;
    align-content: start;
    gap: 10px;
  }

  .portrait {
    width: min(74vw, 280px);
  }

  .photo {
    height: auto;
    max-height: none;
  }

  .note {
    padding: 13px 14px 15px;
  }

  .message {
    font-size: clamp(0.95rem, 4.9vw, 1.08rem);
    line-height: 1.66;
  }
}
