/* Eva's & Max's Games – the homepage. Uses the family look described in
   ../BRAND.md: Fredoka, the "Eva's & Max's" bouncy wordmark, chunky
   buttons with a solid bottom edge, and Eva and Max waving. */

@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/fredoka-latin-700-normal.woff2) format('woff2'); }

:root {
  --ink: #3d2c55;
  --ink-soft: #7d6c93;
  --paper: #fffaf2;
  --line: #efe3d2;
  --line-d: #e3d3bc;
  --green: #4cc76a;
  --green-d: #2f9a4c;
  --yellow: #ffd43b;
  --red: #ff6b6b;
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 12px 34px rgba(61, 44, 85, 0.18);
}

* { box-sizing: border-box; }

html { background: #ffe9d6; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.7) 0 3px, transparent 4px) 0 0 / 46px 46px,
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.5) 0 2px, transparent 3px) 0 0 / 38px 38px,
    linear-gradient(180deg, #ffe2c4 0%, #ffd0e0 45%, #d6ecff 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible { outline: 5px solid rgba(77, 171, 247, 0.75); outline-offset: 4px; }

.page { max-width: 1120px; margin: 0 auto; padding: 18px 16px 40px; }

/* ---------- the header: Eva and Max either side of the wordmark ---------- */

.hero { --kid-h: 150px; position: relative; display: flex; justify-content: center; padding: 18px calc(var(--kid-h) * 0.7) 4px; }
.logo { margin: 0; text-align: center; line-height: 1; }
.logo-top { display: block; font-size: 52px; font-weight: 700; letter-spacing: 0.5px; }
.logo-top .ltr {
  display: inline-block;
  color: var(--c);
  transform: rotate(var(--tilt));
  text-shadow: 3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff, 2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff, 0 7px 0 rgba(61, 44, 85, 0.22);
  animation: letterIn 0.6s cubic-bezier(0.2, 1.8, 0.4, 1) calc(var(--i) * 45ms + 150ms) both;
}
.logo-top .sp { display: inline-block; width: 0.3em; }
.logo-word {
  display: inline-block;
  margin-top: 2px;
  font-size: 88px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--yellow);
  transform: rotate(-2deg);
  text-shadow: 4px 0 var(--ink), -4px 0 var(--ink), 0 4px var(--ink), 0 -4px var(--ink), 3px 3px var(--ink), -3px -3px var(--ink), 3px -3px var(--ink), -3px 3px var(--ink), 0 10px 0 var(--ink), 3px 10px 0 var(--ink), -3px 10px 0 var(--ink);
  animation: wordIn 0.7s cubic-bezier(0.2, 1.8, 0.4, 1) 0.7s both;
}
.tagline { margin: 10px 0 0; text-align: center; font-size: 22px; color: var(--ink-soft); }

.kid { position: absolute; bottom: -8px; width: calc(var(--kid-h) * 0.8); height: var(--kid-h); overflow: visible; animation: kidIn 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 1s both; }
.kid-eva { left: 0; }
.kid-max { right: 0; animation-delay: 1.15s; }
.kid-shadow { fill: rgba(61, 44, 85, 0.16); animation: kidShadow 0.9s ease-in-out infinite alternate; }
.kid-body { animation: kidBob 0.9s ease-in-out infinite alternate; }
.kid-head { animation: kidTilt 1.8s ease-in-out infinite alternate; }
.kid-eyes { animation: kidBlink 4.2s infinite; }
.kid-pony { animation: kidPony 0.9s ease-in-out infinite alternate; }
.kid-eva .kid-wave { animation: kidWaveL 0.42s ease-in-out infinite alternate; }
.kid-max .kid-wave { animation: kidWaveR 0.42s ease-in-out -0.2s infinite alternate; }
.kid-max .kid-body, .kid-max .kid-shadow { animation-delay: -0.45s; }
.kid-max .kid-head { animation-delay: -0.9s; animation-direction: alternate-reverse; }
.kid-max .kid-eyes { animation-delay: 1.6s; }

/* A family page (/f/<slug>/): up to two of their own kids each side, the inner
   one a little further in and behind. .two means a side has two kids. */
.hero.family.two { padding-left: calc(var(--kid-h) * 1.2); padding-right: calc(var(--kid-h) * 1.2); }
.hero.family .kid { animation-delay: calc(1s + var(--k) * 0.15s); }
.hero.family .kid.l { left: calc(var(--j) * var(--kid-h) * 0.5); }
.hero.family .kid.r { right: calc(var(--j) * var(--kid-h) * 0.5); }
.hero.family { isolation: isolate; }
.hero.family .kid.inner { z-index: -1; }
.hero.family .kid .kid-body, .hero.family .kid .kid-shadow { animation-delay: calc(var(--k) * -0.3s); }
.hero.family .kid .kid-head { animation-delay: calc(var(--k) * -0.6s); }
.hero.family .kid .kid-eyes { animation-delay: calc(var(--k) * 0.9s); }
.hero.family .kid.l .kid-wave { animation: kidWaveL 0.42s ease-in-out calc(var(--k) * -0.1s) infinite alternate; }
.hero.family .kid.r .kid-wave { animation: kidWaveR 0.42s ease-in-out calc(var(--k) * -0.1s) infinite alternate; }
.hero.family .logo-top { font-size: calc(52px * var(--fit, 1)); }
.logo-top .wd { display: inline-block; white-space: nowrap; }

/* Who's playing? (player profiles): pick a child; the games save for them. */
.players { margin: 22px auto 0; text-align: center; }
.players h2 { margin: 0 0 10px; font-size: 22px; color: var(--ink-soft); }
.players-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.player {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 92px; padding: 8px 12px 10px;
  border: 4px solid transparent; border-radius: 22px; background: rgba(255, 255, 255, 0.75); cursor: pointer;
  font: 700 18px/1.1 var(--font); color: var(--ink); box-shadow: 0 5px 0 rgba(61, 44, 85, 0.12);
  transition: transform 0.12s, border-color 0.12s;
}
.player .kid { position: static; width: 56px; height: 70px; animation: none; }
.player[aria-pressed="true"] { border-color: var(--green); background: #f0fbf2; transform: translateY(-3px); box-shadow: 0 5px 0 var(--green-d); }
.player:not([aria-pressed="true"]) .kid-body, .player:not([aria-pressed="true"]) .kid-head { animation: none; }

/* ---------- the games ---------- */

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; margin-top: 34px; }

.game {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--line-d), var(--shadow);
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.2, 1.4, 0.4, 1), box-shadow 0.18s;
  animation: cardIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) calc(1.2s + var(--n) * 0.12s) both;
}
a.game:hover { transform: translateY(-6px) rotate(-0.6deg); box-shadow: 0 14px 0 var(--line-d), 0 22px 40px rgba(61, 44, 85, 0.22); }
a.game:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--line-d), var(--shadow); }

/* each game's own pattern across the top, as on its title screen */
.strip { position: relative; z-index: 1; height: 24px; flex: none; }
/* the shop's awning: stripes with a scalloped edge hanging over the picture */
.strip-shop { background: repeating-linear-gradient(90deg, #3f7f6e 0 30px, #fff 30px 60px); }
.strip-shop::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 15px;
  background:
    radial-gradient(circle at 15px 0, #3f7f6e 14.5px, transparent 15.5px) 0 0 / 60px 15px repeat-x,
    radial-gradient(circle at 45px 0, #fff 14.5px, transparent 15.5px) 0 0 / 60px 15px repeat-x;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.08));
}
.strip-fire { background: repeating-linear-gradient(-45deg, #f03e3e 0 16px, #ffd43b 16px 32px); }
.strip-sticker { background: radial-gradient(circle at 15px 13px, #fff 0 6px, transparent 7px) 0 0 / 30px 26px, repeating-linear-gradient(90deg, #f6a58c 0 30px, #9fd3a8 30px 60px, #c7b5f2 60px 90px); }
.strip-plane { background: radial-gradient(circle at 14px 16px, #fff 0 7px, transparent 8px) 0 0 / 40px 26px, radial-gradient(circle at 26px 13px, #fff 0 9px, transparent 10px) 0 0 / 40px 26px, linear-gradient(180deg, #4dabf7, #a5d8ff); }
.strip-cafe { background: radial-gradient(circle at 15px 14px, #fff 0 5px, transparent 6px) 0 0 / 30px 28px, repeating-linear-gradient(90deg, #ffb27a 0 30px, #ffd8b8 30px 60px); }
.strip-soon { background: repeating-linear-gradient(90deg, #ff6b6b 0 20px, #ffa94d 20px 40px, #ffd43b 40px 60px, #51cf66 60px 80px, #4dabf7 80px 100px, #9775fa 100px 120px); opacity: 0.55; }

.pic { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #cfe9ff; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
a.game:hover .pic img { transform: scale(1.04); }
.pic .badge { position: absolute; top: 24px; left: 14px; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; font-size: 38px; background: #fff; box-shadow: 0 5px 0 rgba(61, 44, 85, 0.15); }

.info { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px 22px 22px; }
.name { margin: 0; font-size: 31px; font-weight: 700; line-height: 1.05; }
.blurb { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink-soft); line-height: 1.35; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; padding: 0; list-style: none; }
.tags li { padding: 4px 12px; border-radius: 999px; font-size: 15px; background: #fff; box-shadow: 0 3px 0 var(--line); }
.play {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  min-height: 58px;
  padding: 0 28px;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%), var(--green);
  box-shadow: 0 6px 0 var(--green-d), 0 12px 18px rgba(61, 44, 85, 0.16);
}

.soon { display: flex; flex-direction: column; background: rgba(255, 250, 242, 0.6); box-shadow: none; border: 4px dashed rgba(61, 44, 85, 0.18); }
.soon .info { align-items: center; justify-content: center; text-align: center; padding: 34px 22px; }
.soon-icon { font-size: 64px; animation: float 2.4s ease-in-out infinite alternate; }

footer { margin-top: 40px; text-align: center; font-size: 16px; color: var(--ink-soft); }
footer p { margin: 4px 0; }

/* ---------- Our story / Our supporters buttons under the header ---------- */

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 26px 0 0; animation: cardIn 0.6s ease 1.2s both; }
.link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 20px; background: var(--paper); border: 3px solid var(--line); box-shadow: 0 5px 0 var(--line-d);
  font-size: 19px; font-weight: 700; text-decoration: none; transition: transform 0.1s, box-shadow 0.1s;
}
.link:hover { transform: translateY(-2px); }
.link:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line-d); }
.link-support { background: var(--yellow); border-color: #f5c400; box-shadow: 0 5px 0 #dba600; }
.link-support:active { box-shadow: 0 1px 0 #dba600; }
.link-family { background: #efe6ff; border-color: #c9b2ff; box-shadow: 0 5px 0 #a98be8; }
.link-family:active { box-shadow: 0 1px 0 #a98be8; }
/* Build your own family page: green like the Play buttons and the share images. */
.link-make { color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%), var(--green); border-color: var(--green-d); box-shadow: 0 5px 0 var(--green-d); }
.link-make:active { box-shadow: 0 1px 0 var(--green-d); }

/* "12 people playing right now in 3 countries" (hidden at zero). */
.live { display: flex; width: fit-content; align-items: center; gap: 10px; margin: 18px auto 0; padding: 8px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); font-size: 18px; color: var(--ink); animation: cardIn 0.5s ease both; }
.live[hidden] { display: none; }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(76, 199, 106, 0.6); animation: livePulse 1.8s ease-out infinite; }
@keyframes livePulse { to { box-shadow: 0 0 0 10px rgba(76, 199, 106, 0); } }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .hero { --kid-h: min(110px, 24vw); padding: 10px calc(var(--kid-h) * 0.62) 0; }
  .logo-top { font-size: min(40px, 7.6vw); }
  .logo-word { font-size: min(68px, 13.5vw); letter-spacing: 4px; }
  .tagline { font-size: 18px; }
  .games { grid-template-columns: 1fr; gap: 20px; margin-top: 26px; }
  .name { font-size: 27px; }
  .blurb { font-size: 17px; }
  .links { gap: 10px; margin-top: 20px; }
  .link { min-height: 46px; padding: 0 16px; font-size: 17px; border-radius: 16px; }
  .live { font-size: 15px; padding: 7px 14px; }
  .hero.family .logo-top { font-size: calc(min(40px, 7.6vw) * var(--fit, 1)); }
  .hero.family.two { --kid-h: min(96px, 19vw); }
  .players h2 { font-size: 18px; }
  .players-row { gap: 8px; }
  .player { min-width: 0; width: calc(25% - 6px); max-width: 100px; padding: 6px 4px 8px; font-size: 14px; border-radius: 18px; overflow-wrap: anywhere; }
  .player .kid { width: 44px; height: 55px; }
}

@media (max-width: 400px) {
  .kid { bottom: 0; }
  .hero { --kid-h: min(84px, 22vw); }
  .hero.family.two { --kid-h: min(70px, 17vw); }
  .page { padding: 12px 12px 30px; }
}

/* ---------- animations ---------- */

@keyframes letterIn { from { opacity: 0; transform: translateY(-30px) rotate(var(--tilt)) scale(0.4); } to { opacity: 1; transform: rotate(var(--tilt)); } }
@keyframes wordIn { from { opacity: 0; transform: scale(0.3) rotate(-10deg); } to { opacity: 1; transform: rotate(-2deg); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes kidIn { from { opacity: 0; transform: translateY(40px) scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes kidBob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes kidShadow { from { transform: scale(1); } to { transform: scale(0.86); } }
@keyframes kidTilt { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes kidWaveL { from { transform: rotate(-18deg); } to { transform: rotate(-46deg); } }
@keyframes kidWaveR { from { transform: rotate(18deg); } to { transform: rotate(46deg); } }
@keyframes kidPony { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes kidBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes float { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-10px) rotate(4deg); } }

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