/* The World of Hannah — bright pink, baby blue, bright orange, bubbly letters, happy-face background */
:root {
  --pink: #ff2e93;
  --pink-deep: #d4106f;
  --pink-soft: #ffd3e8;
  --blue: #9ed8ff;
  --blue-deep: #2f8fe0;
  --orange: #ff7a1a;
  --orange-deep: #d95a00;
  --yellow: #ffd60a;
  --ink: #3a1e4a;
  --paper: #fff4fa;
  --card: #ffffff;
  --bubble: 'Rubik Bubbles', 'Fredoka', system-ui, sans-serif;
  --round: 'Fredoka', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--round);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url('assets/happy-faces.svg');
  background-size: 240px 240px;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 16px clamp(16px, 4vw, 40px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-right: auto;
}
.logo-frame {
  width: 104px;
  aspect-ratio: 2.19;
  border-radius: 14px;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: 0 4px 0 var(--pink-soft), 0 6px 16px rgba(58, 30, 74, .15);
  transform: rotate(-3deg);
  background: #fff;
  flex: none;
}
.logo-frame img { width: 100%; height: 100%; object-fit: cover; }
.brand-name {
  font-family: var(--bubble);
  font-size: 24px;
  line-height: 1;
  color: var(--pink);
}

.menu { display: flex; flex-wrap: wrap; gap: 10px; }

.pill {
  --c: var(--pink);
  --c-deep: var(--pink-deep);
  display: inline-block;
  padding: 10px 18px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-family: var(--round);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--c-deep);
  transition: transform .15s cubic-bezier(.3, 1.8, .5, 1), box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.pill.blue { --c: var(--blue-deep); --c-deep: #1d6db3; }
.pill.orange { --c: var(--orange); --c-deep: var(--orange-deep); }
.pill:hover { transform: translateY(-2px) rotate(-2deg) scale(1.05); }
.pill:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--c-deep); }
.pill[aria-current='page'] { outline: 4px solid var(--yellow); outline-offset: 2px; }
.pill:focus-visible, .candy-button:focus-visible, .puppy:focus-visible, .swatch:focus-visible { outline: 4px solid var(--blue-deep); outline-offset: 3px; }

/* the wrapped-candy button */
.candy-button {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
}
.candy-button:hover { transform: rotate(-6deg) scale(1.06); }
.candy-label {
  padding: 10px 18px 8px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  background: repeating-linear-gradient(-45deg, var(--orange) 0 10px, #ff9c4d 10px 20px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12), 0 4px 10px rgba(255, 122, 26, .35);
  text-shadow: 0 2px 0 var(--orange-deep);
}
.wrapper-l, .wrapper-r {
  width: 20px;
  height: 34px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 35%, 100% 65%, 0 100%, 25% 50%);
}
.wrapper-l { margin-right: -4px; }
.wrapper-r { margin-left: -4px; transform: scaleX(-1); }
.candy-button[aria-pressed='true'] .candy-label {
  background: repeating-linear-gradient(-45deg, var(--pink) 0 10px, #ff7cbb 10px 20px);
  text-shadow: 0 2px 0 var(--pink-deep);
  animation: wiggle 1.4s ease-in-out infinite;
}
.candy-button[aria-pressed='true'] .wrapper-l,
.candy-button[aria-pressed='true'] .wrapper-r { background: var(--pink); }

/* ---------- pages ---------- */
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 4px clamp(16px, 4vw, 40px) 40px; }
.page { animation: pop-in .45s cubic-bezier(.3, 1.5, .5, 1); }

.big-title {
  font-family: var(--bubble);
  font-weight: 400;
  font-size: clamp(46px, 10vw, 104px);
  line-height: .95;
  margin: 10px 0 22px;
  text-align: center;
  color: var(--pink);
}
.big-title span { display: inline-block; }
.big-title span:nth-child(2) { color: var(--orange); transform: rotate(2deg); }

.section-title {
  font-weight: 700;
  font-size: clamp(26px, 5vw, 36px);
  margin: 38px 0 16px;
  color: var(--blue-deep);
}
.hint {
  text-align: center;
  font-weight: 700;
  font-size: 22px;
  color: var(--orange-deep);
  margin: 26px 0 10px;
}

/* home */
.hero {
  margin: 0 auto;
  max-width: 820px;
  border: 10px solid #fff;
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  transform: rotate(-1.5deg);
  box-shadow: 0 10px 0 var(--pink-soft), 0 18px 40px rgba(58, 30, 74, .18);
}
.hero img { width: 100%; }

.puppies {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 3vw, 28px);
  align-items: end;
}
.puppy {
  --bg: var(--pink-soft);
  position: relative;
  border: 0;
  padding: 18px;
  background: var(--bg);
  border-radius: 58% 42% 52% 48% / 46% 56% 44% 54%;
  cursor: pointer;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
  box-shadow: 0 6px 0 rgba(58, 30, 74, .08);
}
.puppy img { position: absolute; inset: 13%; width: 74%; height: 74%; object-fit: contain; pointer-events: none; }
.puppy.p2 { --bg: #d6eeff; border-radius: 44% 56% 46% 54% / 56% 44% 56% 44%; }
.puppy.p3 { --bg: #ffe0c7; border-radius: 52% 48% 60% 40% / 50% 52% 48% 50%; }
.puppy.p4 { --bg: #ffe4f1; border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
.puppy:hover { transform: rotate(-4deg) scale(1.04); }
.puppy.barking { animation: bounce .6s cubic-bezier(.3, 1.6, .5, 1); }
.bubble {
  position: absolute;
  top: -8px;
  right: -6px;
  padding: 6px 12px 4px;
  border-radius: 18px;
  background: #fff;
  color: var(--pink);
  font-weight: 700;
  font-size: 20px;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--pink-soft);
  opacity: 0;
  transform: scale(.3) rotate(-10deg);
  transition: opacity .15s, transform .25s cubic-bezier(.3, 1.8, .5, 1);
  pointer-events: none;
}
.barking .bubble { opacity: 1; transform: scale(1) rotate(6deg); }

/* hannah */
.loves {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.loves li { flex: 0 1 150px; }
.loves li, .favourites li {
  background: var(--card);
  border-radius: 26px;
  padding: 18px 14px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 6px 0 var(--c, var(--pink-soft));
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
}
.loves li:nth-child(3n + 1) { --c: var(--pink-soft); --tilt: -2deg; }
.loves li:nth-child(3n + 2) { --c: #bfe4ff; --tilt: 1.5deg; }
.loves li:nth-child(3n) { --c: #ffd2b0; --tilt: -1deg; }
.loves li:hover { transform: rotate(0) scale(1.06); }
.loves .icon { display: block; font-size: 44px; margin-bottom: 6px; }
.favourites { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.favourites li { text-align: left; font-weight: 600; }
.favourites b { color: var(--pink); }

.art-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.art {
  margin: 0;
  background: #fff;
  padding: 14px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(58, 30, 74, .14);
  position: relative;
  display: grid;
  place-items: center;
}
.art:nth-child(odd) { transform: rotate(-2deg); }
.art:nth-child(even) { transform: rotate(2.5deg); }
.art.wide { grid-column: 1 / -1; max-width: 760px; justify-self: center; }
.art::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 22px;
  translate: -50% 0;
  rotate: -4deg;
  background: repeating-linear-gradient(90deg, rgba(158, 216, 255, .85) 0 8px, rgba(255, 255, 255, .7) 8px 16px);
}
.art img { max-height: 200px; object-fit: contain; }
.art.wide img { max-height: none; }

/* candy builder */
.palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.swatch {
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--pink-soft);
  transition: transform .15s cubic-bezier(.3, 1.8, .5, 1);
}
.swatch canvas { width: 44px; height: 44px; }
.swatch:hover { transform: translateY(-3px); }
.swatch[aria-pressed='true'] { outline: 4px solid var(--orange); transform: translateY(-3px) scale(1.08); }
.eraser-icon { font-size: 26px; color: var(--ink); opacity: .6; }
.builder-frame {
  border: 10px solid #fff;
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 0 #bfe4ff, 0 18px 40px rgba(58, 30, 74, .15);
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}
#builder { display: block; touch-action: none; cursor: crosshair; }
.builder-actions { display: flex; justify-content: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }

/* gallery */
.photos {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}
.photo {
  border: 0;
  background: #fff;
  padding: 12px 12px 10px;
  border-radius: 8px;
  cursor: zoom-in;
  width: 100%;
  box-shadow: 0 8px 22px rgba(58, 30, 74, .14);
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
}
.photos li:nth-child(odd) .photo { transform: rotate(-2deg); }
.photos li:nth-child(even) .photo { transform: rotate(2deg); }
.photo:hover { transform: rotate(0) scale(1.04) !important; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.photo span { display: block; margin-top: 8px; font-weight: 600; }
.empty {
  text-align: center;
  font-family: var(--bubble);
  font-size: clamp(30px, 6vw, 52px);
  color: var(--blue-deep);
  margin: 40px 0 120px;
}

.lightbox {
  border: 10px solid #fff;
  border-radius: 24px;
  padding: 0 0 16px;
  max-width: min(92vw, 900px);
  background: #fff;
  text-align: center;
}
.lightbox::backdrop { background: rgba(58, 30, 74, .6); }
.lightbox img { max-height: 75vh; margin: 0 auto; border-radius: 14px; }
.lightbox p { font-weight: 700; font-size: 20px; margin: 12px 16px; }

/* ---------- the secret puppy ---------- */
.secret-puppy {
  position: fixed;
  right: clamp(12px, 6vw, 80px);
  bottom: 0;
  width: 92px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  z-index: 5;
  transform: translateY(72%) scaleX(-1);
  animation: peek 7s ease-in-out infinite;
}
.secret-puppy img { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff); }
.secret-puppy.dancing { animation: dance 1.8s ease-in-out; transform: translateY(-30vh) scaleX(-1); }
.found {
  position: fixed;
  left: 50%;
  top: 22%;
  translate: -50% 0;
  z-index: 20;
  padding: 16px 26px 12px;
  border-radius: 999px;
  background: var(--yellow);
  font-weight: 700;
  font-size: clamp(20px, 4vw, 30px);
  box-shadow: 0 6px 0 #d4ae00, 0 16px 36px rgba(58, 30, 74, .25);
  animation: pop-in .4s cubic-bezier(.3, 1.8, .5, 1);
  white-space: nowrap;
}

/* ---------- footer ---------- */
.bottom { position: relative; text-align: center; color: #fff; font-weight: 700; }
.bottom .hills { display: block; width: 100%; height: 70px; fill: var(--pink); }
.bottom p { margin: 0; padding: 4px 0 18px; background: var(--pink); }

#candy-rain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* ---------- CANDY MODE ---------- */
body.candy {
  background-color: #ffe6f3;
  background-image: url('assets/sprinkles-bg.svg'), url('assets/happy-faces.svg');
  background-size: 260px 260px, 240px 240px;
}
/* gummy letters */
.candy .big-title span, .candy .brand-name, .candy .section-title, .candy .empty {
  background: linear-gradient(180deg, #ff8cc6 0%, var(--pink) 45%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(212, 16, 111, .35)) drop-shadow(0 0 1px #fff);
  animation: jiggle 2.4s ease-in-out infinite;
}
.candy .big-title span:nth-child(2) {
  background-image: linear-gradient(180deg, #c8ecff 0%, var(--blue-deep) 50%, var(--pink) 100%);
  animation-delay: -1.2s;
}
.candy .section-title { animation-duration: 3s; }
/* candy-stripe buttons */
.candy .pill { background: repeating-linear-gradient(-45deg, var(--c) 0 12px, color-mix(in srgb, var(--c) 70%, #fff) 12px 24px); }
/* sprinkle puppies */
.candy .puppy { background: #fff; box-shadow: 0 0 0 6px var(--bg), 0 10px 0 rgba(58, 30, 74, .08); }
.candy .puppy::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url('assets/sprinkles.svg') center / 90px 90px;
  opacity: .7;
  pointer-events: none;
  -webkit-mask: radial-gradient(circle, transparent 42%, #000 62%);
  mask: radial-gradient(circle, transparent 42%, #000 62%);
}
.puppy img { z-index: 1; }
.bubble { z-index: 2; }
/* candy-cane frames */
.candy .photo, .candy .art, .candy .hero, .candy .builder-frame, .candy .logo-frame {
  border: 10px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(-45deg, #ff3b4e 0 10px, #fff 10px 20px) border-box;
}
.candy .art::before { display: none; }
.candy .loves li, .candy .favourites li {
  background: linear-gradient(180deg, #fff 0%, #fff 55%, var(--c, var(--pink-soft)) 100%);
  box-shadow: 0 6px 0 var(--c, var(--pink-soft)), inset 0 4px 0 rgba(255, 255, 255, .9);
}
.candy .bottom .hills { fill: #7b4420; }
.candy .bottom p { background: #7b4420; }

/* ---------- motion ---------- */
@keyframes pop-in { from { opacity: 0; transform: scale(.92) translateY(10px); } }
@keyframes bounce {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-26px) scale(1.08, .94) rotate(-6deg); }
  55% { transform: translateY(0) scale(1.1, .9); }
  75% { transform: translateY(-8px) rotate(4deg); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes jiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-1.5deg) scale(1.03, .97); }
  75% { transform: rotate(1.5deg) scale(.97, 1.03); }
}
@keyframes peek {
  0%, 60%, 100% { transform: translateY(72%) scaleX(-1); }
  68%, 82% { transform: translateY(38%) scaleX(-1); }
  75% { transform: translateY(38%) scaleX(-1) rotate(-8deg); }
}
@keyframes dance {
  0% { transform: translateY(72%) scaleX(-1); }
  15% { transform: translateY(-30vh) scaleX(-1) rotate(-15deg); }
  25% { transform: translateY(-30vh) scaleX(1) rotate(15deg); }
  35% { transform: translateY(-34vh) scaleX(-1) rotate(-20deg) scale(1.2); }
  45% { transform: translateY(-30vh) scaleX(1) rotate(20deg); }
  55% { transform: translateY(-36vh) scaleX(-1) rotate(360deg) scale(1.3); }
  70% { transform: translateY(-30vh) scaleX(1) rotate(-10deg); }
  85% { transform: translateY(-32vh) scaleX(-1) rotate(10deg) scale(1.15); }
  100% { transform: translateY(-30vh) scaleX(-1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- phones ---------- */
@media (max-width: 680px) {
  body { font-size: 17px; }
  .top { justify-content: center; }
  .brand { margin-right: 0; width: 100%; justify-content: center; }
  .menu { justify-content: center; }
  .pill { font-size: 15px; padding: 9px 14px 7px; }
  .puppies { grid-template-columns: repeat(2, 1fr); }
  .art-wall { grid-template-columns: repeat(2, 1fr); }
  .swatch { width: 52px; height: 52px; }
  .swatch canvas { width: 38px; height: 38px; }
  .builder-frame { border-width: 10px; }
  .secret-puppy { width: 72px; }
}
