@font-face {
  font-family: "Gatchina";
  src: url("/assets/fonts/gatchina-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Google Sans";
  src: url("/assets/fonts/google-sans-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --red: #a20f32;
  --blush: #fbf0f2;
  --blush-soft: rgb(251 240 242 / 82%);
  --ease-arrive: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-journey: cubic-bezier(0.77, 0, 0.175, 1);
}

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

html {
  min-width: 320px;
  background: var(--red);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--red);
  color: var(--blush);
  font-family: "Gatchina", Georgia, serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--blush);
  color: var(--red);
}

.love-note {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(32px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  place-items: center;
  isolation: isolate;
}

.heart-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(116px, 11vw, 168px);
  aspect-ratio: 1;
  transform: translate(-50%, calc(-50% - clamp(178px, 23vh, 236px))) scale(0.72);
  transform-origin: center;
  animation: heart-journey 3.25s var(--ease-journey) both;
}

.heart-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.heart-mark path {
  fill: none;
  stroke: var(--blush);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
  vector-effect: non-scaling-stroke;
  animation: draw-heart 1.85s 0.18s var(--ease-arrive) both;
}

.message {
  width: min(100%, 920px);
  padding-top: clamp(84px, 12vh, 132px);
  text-align: center;
}

.message-copy {
  animation: reveal-copy 1.05s 3.28s var(--ease-arrive) both;
}

h1,
p {
  margin: 0;
  font-weight: 400;
}

h1 {
  font-size: clamp(3.15rem, 8.2vw, 6rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

p {
  max-width: 36ch;
  margin: clamp(24px, 3.5vh, 36px) auto 0;
  color: var(--blush-soft);
  font-family: "Google Sans", Arial, sans-serif;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.type-word {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.type-output {
  display: none;
}

.has-typewriter .message-copy {
  animation: none;
}

.has-typewriter .type-ghost {
  opacity: 0;
}

.has-typewriter .type-output {
  position: absolute;
  inset: 0;
  display: block;
  text-align: left;
  user-select: none;
  white-space: nowrap;
}

.has-typewriter .type-output.is-typing::after {
  display: inline-block;
  width: 1px;
  height: 0.78em;
  margin-left: 0.06em;
  background: currentColor;
  content: "";
  vertical-align: -0.06em;
  animation: type-caret 900ms steps(1, end) infinite;
}

.social-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 2vw, 28px);
  width: min(100%, 520px);
  margin: clamp(42px, 6vh, 68px) auto 0;
}

.social-link {
  display: flex;
  visibility: hidden;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--blush);
  font-family: "Google Sans", Arial, sans-serif;
  font-size: 0.94rem;
  line-height: 1;
  text-decoration: none;
  transition:
    opacity 220ms ease,
    background-color 220ms ease,
    color 220ms ease,
    transform 140ms var(--ease-arrive);
  animation: reveal-link 720ms var(--ease-arrive) both;
}

.social-link--instagram {
  animation-delay: 4.38s;
}

.social-link--telegram {
  animation-delay: 4.45s;
}

.social-link--behance {
  animation-delay: 4.52s;
}

.has-typewriter:not(.links-ready) .social-links {
  visibility: hidden;
  pointer-events: none;
}

.has-typewriter .social-link {
  opacity: 0;
  animation: none;
}

.has-typewriter.links-ready .social-link {
  animation: reveal-link 720ms var(--ease-arrive) both;
}

.has-typewriter.links-ready .social-link--instagram {
  animation-delay: 0ms;
}

.has-typewriter.links-ready .social-link--telegram {
  animation-delay: 70ms;
}

.has-typewriter.links-ready .social-link--behance {
  animation-delay: 140ms;
}

.social-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
  stroke: none;
}

.social-link:focus-visible {
  background-color: var(--blush);
  color: var(--red);
  visibility: visible !important;
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  outline: none;
}

.social-link:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .social-link:hover {
    opacity: 0.82;
  }

  .social-link:hover:focus-visible {
    opacity: 1;
  }
}

@keyframes draw-heart {
  from {
    stroke-dashoffset: 1;
  }
}

@keyframes type-caret {
  50% {
    opacity: 0;
  }
}

@keyframes heart-journey {
  0%,
  63% {
    transform: translate(-50%, -50%) scale(1.18);
  }

  100% {
    transform: translate(-50%, calc(-50% - clamp(178px, 23vh, 236px))) scale(0.72);
  }
}

@keyframes reveal-copy {
  from {
    opacity: 0;
    filter: blur(8px);
    clip-path: inset(0 0 100% 0);
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    clip-path: inset(0);
    transform: translateY(0);
  }
}

@keyframes reveal-link {
  from {
    visibility: hidden;
    opacity: 0;
    filter: blur(5px);
    transform: translateY(12px);
  }

  to {
    visibility: visible;
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .love-note {
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
  }

  .heart-mark {
    width: 124px;
    transform: translate(-50%, calc(-50% - clamp(154px, 21vh, 190px))) scale(0.7);
  }

  .message {
    padding-top: 72px;
  }

  h1 {
    font-size: clamp(3.1rem, 15vw, 4.4rem);
  }

  p {
    font-size: clamp(1rem, 4.8vw, 1.18rem);
  }

  .social-links {
    gap: 3px;
    margin-top: 34px;
  }

  .social-link {
    min-height: 50px;
    gap: 5px;
    padding-inline: 2px;
    font-size: clamp(0.82rem, 3.5vw, 0.9rem);
  }

  .social-link svg {
    width: 16px;
    height: 16px;
  }

  @keyframes heart-journey {
    0%,
    63% {
      transform: translate(-50%, -50%) scale(1.16);
    }

    100% {
      transform: translate(-50%, calc(-50% - clamp(154px, 21vh, 190px))) scale(0.7);
    }
  }
}

@media (max-height: 620px) {
  .heart-mark {
    transform: translate(-50%, calc(-50% - clamp(82px, 30vh, 118px))) scale(0.62);
  }

  .message {
    padding-top: 60px;
  }

  h1 {
    font-size: clamp(2.75rem, 9vw, 4rem);
  }

  .message-copy p {
    margin-top: 12px;
    font-size: clamp(1rem, 3.3vw, 1.2rem);
  }

  .social-links {
    margin-top: 24px;
  }

  @keyframes heart-journey {
    0%,
    63% {
      transform: translate(-50%, -50%) scale(1.06);
    }

    100% {
      transform: translate(-50%, calc(-50% - clamp(82px, 30vh, 118px))) scale(0.62);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .heart-mark {
    animation: none;
  }

  .heart-mark path {
    stroke-dashoffset: 0;
    animation: reduced-reveal 180ms ease-out both;
  }

  .message-copy,
  .social-link {
    visibility: visible;
    filter: none;
    transform: none;
    animation: reduced-reveal 180ms ease-out both;
  }

  .has-typewriter .type-output.is-typing::after {
    animation: none;
  }
}

.typing-cancelled .message-copy,
.typing-cancelled .social-link {
  visibility: visible;
  opacity: 1;
  filter: none;
  transform: none;
  animation: none;
}

@keyframes reduced-reveal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
