@font-face {
  font-family: 'Lilita One Local';
  src: url('assets/fonts/lilita-one-latin.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces Local';
  src: url('assets/fonts/fraunces-italic-latin.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}

:root {
  --sky: #418EE9;
  --cream: #FFF3DC;
  --yellow: #FBC024;
  --paw-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='%23FBC024' stroke='%23065279' stroke-width='1.2'%3E%3Cellipse cx='16' cy='21' rx='9' ry='7'/%3E%3Ccircle cx='6' cy='13' r='4'/%3E%3Ccircle cx='13' cy='7' r='4'/%3E%3Ccircle cx='21' cy='7' r='4'/%3E%3Ccircle cx='27' cy='14' r='4'/%3E%3C/g%3E%3C/svg%3E") 6 4, pointer;
}

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

body {
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--sky);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

::selection { background: var(--yellow); color: var(--sky); }

.hero {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.poster {
  position: relative;
  width: 100%;
  max-width: calc(100svh * 2);
  aspect-ratio: 2 / 1;
  overflow: hidden;
}

.scene-wrap {
  position: absolute;
  inset: 0;
  transition: transform 360ms ease, opacity 300ms ease;
}

.scene-wrap::before {
  content: '';
  position: absolute;
  z-index: 6;
  left: 24%;
  top: 44%;
  width: 42%;
  height: 32%;
  background: repeating-linear-gradient(to bottom, transparent 0 24px, rgba(255, 243, 220, .8) 25px 27px, transparent 28px 46px);
  opacity: 0;
  pointer-events: none;
  transform: scaleX(.25);
  transform-origin: right center;
}

body.is-entering .scene-wrap { animation: scene-run-out 820ms cubic-bezier(.3,.05,.7,.3) both; pointer-events: none; }
body.is-entering .scene-wrap::before { animation: speed-lines 620ms 60ms ease-in both; }
body.is-entering .intro { animation: none; transform: translateY(-8px); opacity: 0; }

@keyframes scene-run-out {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  14% { transform: translate(-10px, -6px) rotate(-.4deg); }
  28% { transform: translate(12px, 5px) rotate(.35deg); }
  42% { transform: translate(4vw, -5px) rotate(-.25deg); }
  100% { transform: translate(115vw, -12px) rotate(.5deg); opacity: 1; }
}

@keyframes speed-lines {
  0% { opacity: 0; transform: scaleX(.25); }
  35% { opacity: .8; }
  100% { opacity: 0; transform: scaleX(1.35); }
}

.scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 2%, #000 98%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 2%, #000 98%, transparent 100%);
  animation: scene-in 700ms ease-out both;
}

.dog {
  position: absolute;
  z-index: 3;
  border: 0;
  border-radius: 46%;
  background: transparent;
  color: var(--yellow);
  cursor: var(--paw-cursor);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dog:focus-visible, .treat-tool:focus-visible, .play-tool:focus-visible {
  outline: 3px dashed var(--cream);
  outline-offset: -6px;
}

.dog--cream { left: 34%; top: 36%; width: 25%; height: 37%; }
.dog--brown { left: 76%; top: 23%; width: 21%; height: 43%; }
.dog--white { left: 22%; top: 65%; width: 34%; height: 31%; }
.dog--orange { left: 62%; top: 59%; width: 34%; height: 37%; }

.dog-message {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 5px);
  width: max-content;
  max-width: min(230px, 60vw);
  padding: 10px 14px;
  border: 2px solid var(--cream);
  border-radius: 14px 14px 14px 4px;
  background: var(--cream);
  color: #065279;
  font-size: clamp(11px, 1.15vw, 14px);
  font-weight: 600;
  line-height: 1.65;
  text-align: left;
  box-shadow: 4px 5px 0 rgba(6, 82, 121, .16);
  opacity: 0;
  visibility: hidden;
  translate: -50% 0;
  pointer-events: none;
}
.dog--brown .dog-message, .dog--orange .dog-message {
  left: auto;
  right: 0;
  border-radius: 14px 14px 4px;
  translate: none;
}
.dog-message.is-visible { visibility: visible; animation: dog-message 2800ms ease both; }
@keyframes dog-message {
  0% { opacity: 0; transform: translateY(7px) scale(.96); }
  10%, 82% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-5px) scale(.98); }
}

.effect {
  position: absolute;
  left: 50%;
  top: 9%;
  width: clamp(28px, 3.2vw, 52px);
  aspect-ratio: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.effect svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.dog[data-reaction="pet"].is-reacting [data-effect="pet"] {
  visibility: visible;
  animation: heart-pop 850ms ease-out both;
}
.dog[data-reaction="treat"].is-reacting [data-effect="treat"] {
  visibility: visible;
  animation: treat-pop 850ms ease-out both;
}
.dog .effect--burst { left: 35%; top: -8%; width: clamp(74px, 7.5vw, 112px); }
.dog.is-loved [data-effect="pet-burst"] {
  visibility: visible;
  animation: heart-burst 950ms ease-out both;
}

@keyframes heart-burst {
  0% { opacity: 0; translate: 0 18px; scale: .55; }
  25% { opacity: 1; scale: 1.08; }
  70% { opacity: 1; }
  100% { opacity: 0; translate: 0 -48px; scale: 1.15; }
}

.treat-tool {
  position: absolute;
  z-index: 4;
  left: 5%;
  bottom: 8%;
  width: clamp(46px, 5.2vw, 78px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cream);
  cursor: var(--paw-cursor);
  touch-action: manipulation;
  transition: transform 160ms ease;
}
.treat-tool svg { display: block; width: 100%; height: auto; }
.treat-tool:hover { transform: translateY(-3px) rotate(-4deg); }
.treat-tool[aria-pressed="true"] { transform: translateY(-5px) rotate(4deg); }
.treat-tool[aria-pressed="true"] .bowl-back { fill: var(--yellow); }

.play-tool {
  position: absolute;
  z-index: 4;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: var(--paw-cursor);
  touch-action: manipulation;
}
.ball-tool { --fetch-x: 58px; --fetch-return-x: 20px; left: 46%; top: 78%; width: 10%; height: 19%; }
.ball-tool.is-reversed { --fetch-x: -58px; --fetch-return-x: -20px; }
.ball-tool .effect { left: 18%; top: 22%; width: 58%; color: #C8E63C; }
.ball-tool.is-playing .effect {
  visibility: visible;
  animation: fetch-ball 900ms cubic-bezier(.25,.7,.3,1) both;
}
.paw-tool { left: 74.5%; top: 21%; width: 7%; height: 22%; z-index: 5; }
.paw-tool .effect { left: 35%; top: -12%; width: 62%; color: var(--yellow); }
.paw-tool.is-playing .effect {
  visibility: visible;
  animation: high-five 800ms ease-out both;
}
.greeting-tool { left: 54%; top: 8%; width: 19%; height: 44%; }
.greeting-tool .effect { left: 62%; top: -3%; width: clamp(54px, 6vw, 86px); }
.greeting-bubble {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.2;
  border-radius: 48% 52% 45% 55%;
  background: var(--cream);
  color: var(--sky);
  font-family: 'Lilita One Local', sans-serif;
  font-size: clamp(1.3rem, 2.4vw, 2.2rem);
  rotate: 8deg;
}
.greeting-tool.is-playing .effect {
  visibility: visible;
  animation: greeting-pop 1050ms ease-out both;
}

.party {
  z-index: 9;
  left: 20%;
  top: 16%;
  width: 60%;
  aspect-ratio: 2;
}
.party.is-playing {
  visibility: visible;
  animation: party-pop 1300ms ease-out both;
}

@keyframes party-pop {
  0% { opacity: 0; scale: .6; rotate: -3deg; }
  20% { opacity: 1; scale: 1.05; }
  70% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 1.1; rotate: 3deg; }
}

@keyframes treat-pop {
  0% { opacity: 0; translate: 0 -28px; scale: .7; rotate: -12deg; }
  25% { opacity: 1; }
  70% { opacity: 1; translate: 0 8px; scale: 1; rotate: 6deg; }
  100% { opacity: 0; translate: 0 18px; scale: .6; rotate: 12deg; }
}

@keyframes fetch-ball {
  0% { opacity: 1; translate: 0 0; rotate: 0deg; }
  45% { opacity: 1; translate: var(--fetch-x) -62px; rotate: 160deg; }
  72% { opacity: 1; translate: var(--fetch-return-x) -10px; rotate: 250deg; }
  100% { opacity: 0; translate: 0 0; rotate: 330deg; }
}

@keyframes high-five {
  0% { opacity: 0; scale: .45; rotate: -18deg; }
  28% { opacity: 1; scale: 1.18; rotate: 8deg; }
  68% { opacity: 1; scale: 1; rotate: -3deg; }
  100% { opacity: 0; scale: .9; translate: 0 -22px; }
}

@keyframes greeting-pop {
  0% { opacity: 0; translate: 0 12px; scale: .6; }
  22% { opacity: 1; translate: 0 0; scale: 1.05; }
  72% { opacity: 1; scale: 1; }
  100% { opacity: 0; translate: 0 -18px; scale: .9; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes heart-pop {
  0% { opacity: 0; translate: 0 12px; scale: .65; rotate: -8deg; }
  24% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; translate: 0 -40px; scale: 1.12; rotate: 8deg; }
}

.intro {
  position: absolute;
  z-index: 2;
  left: 5.5%;
  top: 18%;
  transition: transform 300ms ease, opacity 260ms ease;
  animation: type-in 650ms 100ms ease-out both;
}

.hello {
  font-family: 'Fraunces Local', 'Songti SC', serif;
  font-size: clamp(1.5rem, 2.6vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

h1 {
  margin-top: 0.2em;
  font-family: 'Lilita One Local', 'Fraunces Local', serif;
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.name-link {
  position: relative;
  display: inline-block;
  color: var(--cream);
  font-size: clamp(4.5rem, 8.7vw, 9.5rem);
  text-decoration: none;
  transition: color 180ms ease, transform 180ms ease;
}

.name-link::after {
  content: '';
  position: absolute;
  left: 3%;
  right: 1%;
  bottom: -0.03em;
  height: 0.09em;
  border-radius: 50%;
  background: var(--yellow);
  transform: rotate(-2deg);
  transform-origin: left center;
  transition: transform 180ms ease;
}

.name-link:hover { transform: translateY(-3px); }
.name-link:hover::after { transform: rotate(1deg) scaleX(0.88); }

.name-link:focus-visible {
  outline: 3px dashed var(--cream);
  outline-offset: 9px;
  border-radius: 8px;
}

.world {
  display: block;
  margin-top: 0.18em;
  font-size: clamp(2rem, 3.8vw, 4.2rem);
}

@keyframes scene-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes type-in {
  from { opacity: 0; translate: 0 14px; }
  to { opacity: 1; translate: 0 0; }
}

@media (max-width: 700px) {
  .hero {
    display: flex;
    align-items: center;
    padding: 5vh 0;
  }
  .poster {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .intro {
    position: relative;
    left: auto;
    top: auto;
    order: 0;
    padding: 0 24px 30px;
  }
  .hello { font-size: clamp(1.5rem, 7vw, 2rem); }
  .name-link { font-size: clamp(4.5rem, 20vw, 6rem); }
  .world { font-size: clamp(2.2rem, 10vw, 3rem); }
  .scene-wrap {
    position: relative;
    order: 1;
    width: 122.5%;
    margin-left: -20%;
  }
  .scene {
    position: relative;
    width: 100%;
    height: auto;
  }
  .treat-tool { left: 22%; top: 4%; bottom: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .scene-wrap, .scene-wrap::before, .intro, .effect, .dog-message { animation: none !important; }
  .dog-message.is-visible { opacity: 1; visibility: visible; }
  .scene-wrap, .intro, .name-link, .name-link::after, .treat-tool { transition: none; }
  .dog[data-reaction="pet"].is-reacting [data-effect="pet"],
  .dog.is-loved [data-effect="pet-burst"],
  .dog[data-reaction="treat"].is-reacting [data-effect="treat"],
  .play-tool.is-playing .effect,
  .party.is-playing {
    opacity: 1;
    visibility: visible;
    translate: none;
    scale: none;
    rotate: none;
  }
  body.is-entering .scene-wrap, body.is-entering .intro { transform: none; }
}
