/* BabyKeys site.
 *
 * Palette is lifted from the game's own theme (tools/make_theme.gd) so the page
 * and the app look like the same product: sky #a6d4f0, accent #4a8fd9,
 * paper #faf7f2, ink #292a2e.
 *
 * No web fonts on purpose. A page that promises "nothing leaves your device"
 * should not open a connection to a font CDN to say so.
 */

:root {
  --sky:     #a6d4f0;
  --sky-dim: #cfe7f7;
  --accent:  #2f74bd;
  --accent-2:#4a8fd9;
  --paper:   #faf7f2;
  --page:    #ffffff;
  --ink:     #292a2e;
  --hint:    #63636c;
  --line:    #e2ddd4;
  --shadow:  0 1px 2px rgba(20, 24, 34, .06), 0 8px 24px rgba(20, 24, 34, .07);
  --radius:  18px;
  --maxw:    1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky:     #17324a;
    --sky-dim: #14283a;
    --accent:  #8dc2f0;
    --accent-2:#6fb0e8;
    --paper:   #1b1e24;
    --page:    #14171c;
    --ink:     #e9e7e3;
    --hint:    #a2a5ad;
    --line:    #2b3038;
    --shadow:  0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); }
a:hover { color: var(--accent-2); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.12rem; }
p  { margin: 0 0 1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 680px; }
.center { text-align: center; }

.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--page); padding: 12px 18px; border-radius: 0 0 12px 0;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */

.site-head {
  background: var(--page);
  border-bottom: 1px solid var(--line);
}
.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 66px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none;
}
.brand img { border-radius: 10px; }
.head-nav { display: flex; align-items: center; gap: 18px; }
.head-nav a { text-decoration: none; font-weight: 600; }
.head-nav a:hover { text-decoration: underline; }

.lang select {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; cursor: pointer;
}

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-dim) 62%, var(--page) 100%);
  padding: clamp(38px, 6vw, 76px) 0 clamp(30px, 5vw, 60px);
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: clamp(26px, 4vw, 54px); align-items: center;
}
.hero h1 { max-width: 15ch; }
.lead { font-size: 1.13rem; color: var(--ink); max-width: 56ch; }
.hero-note { color: var(--hint); font-size: .95rem; margin: 14px 0 0; }

.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.store {
  display: inline-flex; align-items: center; gap: 11px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  padding: 12px 20px; border-radius: 14px; font-weight: 600; font-size: .98rem;
  box-shadow: var(--shadow); transition: transform .15s ease, opacity .15s ease;
}
.store:hover { color: var(--paper); transform: translateY(-2px); }
.store:active { transform: translateY(0); }
.store svg { flex: none; }

/* ---------- the "slate": a screen-shaped frame filled with game art ---------- */

.slate {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 24px; background: var(--sky-dim);
  border: 7px solid rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
}
.slate--sm { aspect-ratio: 16 / 11; }
.slate__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.pop {
  position: absolute; height: auto; filter: drop-shadow(0 6px 10px rgba(20, 24, 34, .22));
  animation: pop-in .5s cubic-bezier(.2, 1.5, .4, 1) backwards;
}
/* Sized by WIDTH, never by height.
 *
 * Width is what decides whether two sprites collide, and a sprite's width
 * depends on an aspect ratio that CSS cannot see. With the height fixed,
 * the dolphin (ratio 1.35) ran 26% into the crab and the car (2.03) ran
 * 47% into the bus and spanned almost the whole frame.
 *
 * Bounding the width makes an overlap impossible whatever the art is;
 * max-height caps tall narrow sprites, and the browser keeps the ratio. */
.pop--1 { left: 5%;  width: 32%; max-height: 54%; bottom: 7%;  animation-delay: .15s; }
.pop--2 { left: 51%; width: 14%; max-height: 38%; bottom: 12%; animation-delay: .5s; }
.pop--3 { right: 6%; width: 15%; max-height: 46%; bottom: 9%;  animation-delay: .85s; }
.pop--a { left: 5%;  width: 46%; max-height: 60%; bottom: 8%;  animation-delay: .2s; }
.pop--b { right: 5%; width: 34%; max-height: 42%; bottom: 10%; animation-delay: .55s; }

@keyframes pop-in { from { opacity: 0; transform: scale(.35) translateY(14px); } }

.tapdot {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .95); opacity: 0;
  animation: ripple 3.2s ease-out infinite;
}
.tapdot--1 { left: 22%; top: 26%; animation-delay: .8s; }
.tapdot--2 { right: 26%; top: 38%; animation-delay: 2.1s; }
@keyframes ripple {
  0%   { opacity: 0; transform: scale(.4); }
  12%  { opacity: 1; }
  45%  { opacity: 0; transform: scale(3.4); }
  100% { opacity: 0; transform: scale(3.4); }
}

.wave {
  position: absolute; right: 14%; top: 22%;
  width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .9); border-left-color: transparent;
  border-bottom-color: transparent; transform: rotate(-45deg);
  animation: sound 2.4s ease-out infinite;
}
.wave--2 { width: 26px; height: 26px; right: 12%; top: 19%; animation-delay: .25s; }
.wave--3 { width: 38px; height: 38px; right: 10%; top: 16%; animation-delay: .5s; }
@keyframes sound { 0%, 100% { opacity: .15; } 45% { opacity: 1; } }

/* ---------- trust strip ---------- */

.trust { background: var(--page); padding: 6px 0 0; }
.trust-row {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px;
}
.trust-row li {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px;
  font-size: .93rem; font-weight: 600; color: var(--hint);
}

/* ---------- bands ---------- */

.band { padding: clamp(42px, 6vw, 82px) 0; }
.band--tint { background: var(--paper); }
.band h2 { max-width: 22ch; }
.band--tint .wrap > h2, .band > .wrap > h2 { margin-bottom: .35em; }
.section-lead { color: var(--hint); max-width: 62ch; margin-bottom: 2em; }

.cards { display: grid; gap: 18px; }
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.cards--4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--page); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px 6px;
}
.band--tint .card { background: var(--page); }
.card p { color: var(--hint); font-size: .97rem; }

/* ---------- tile grids ---------- */

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.grid--modes { grid-template-columns: repeat(5, 1fr); }
.grid--cats  { grid-template-columns: repeat(6, 1fr); }

.tile {
  position: relative; background: var(--page); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.tile img { height: 74px; width: auto; object-fit: contain; }
.tile__name { font-weight: 600; font-size: .92rem; line-height: 1.25; }

.tile__art { height: 74px; display: flex; align-items: flex-end; justify-content: center; }
.tile__art img { height: 74px; }

.tile.is-pro::after {
  content: "PRO";
  position: absolute; top: 8px; right: 8px;
  font-size: .62rem; font-weight: 800; letter-spacing: .06em;
  background: var(--accent); color: #fff;
  border-radius: 999px; padding: 2px 7px;
}

/* Two tiles show their own mechanic instead of describing it. */
.tile[data-mode="shadows"] img { filter: brightness(0) opacity(.8); }
.tile[data-mode="coloring"] img { filter: grayscale(1); transition: filter .5s ease; }
.tile[data-mode="coloring"]:hover img { filter: grayscale(0); }

.tile__art--drawn { gap: 6px; align-items: center; }
.glyph { display: block; width: 26px; height: 26px; background: var(--accent-2); }
.glyph--circle { border-radius: 50%; }
.glyph--square { border-radius: 5px; }
.glyph--tri {
  background: none; width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-bottom: 24px solid var(--accent-2);
}
.glyph--dot { border-radius: 50%; }
.glyph--dot.c1 { background: #e05a4b; }
.glyph--dot.c2 { background: #f0b429; }
.glyph--dot.c3 { background: #3f9e5c; }

/* ---------- split sections ---------- */

.split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 52px); align-items: center;
}
.split--flip .split__art { order: 2; }
.split__copy p { color: var(--hint); max-width: 52ch; }

/* ---------- notice + contact ---------- */

.notice {
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dim) 100%);
  border-radius: 26px; padding: clamp(28px, 4vw, 46px);
  text-align: center; color: #16222e;
}
@media (prefers-color-scheme: dark) { .notice { color: var(--ink); } }
.notice h2 { margin: 0 auto .3em; max-width: 20ch; }
.notice .lead { margin: 0 auto 1.4em; max-width: 46ch; }

.btn {
  display: inline-block; background: var(--ink); color: var(--paper);
  text-decoration: none; font-weight: 600; font-size: .97rem;
  padding: 12px 22px; border-radius: 14px; border: none; cursor: pointer;
  font-family: inherit; transition: transform .15s ease;
}
.btn:hover { color: var(--paper); transform: translateY(-2px); }
.btn--ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); padding: 11px 18px;
}
.btn--ghost:hover { color: var(--ink); background: var(--page); }
.btn--ghost.is-done { border-color: var(--accent); color: var(--accent); }

.mailrow {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: center;
}
.mail { font-size: 1.15rem; font-weight: 700; text-decoration: none; }
.mail:hover { text-decoration: underline; }

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 26px 0; color: var(--hint); font-size: .92rem;
}
.foot-row {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
}
.foot-row p { margin: 0; }

/* ---------- policy page ---------- */

.doc { padding: clamp(32px, 5vw, 64px) 0 clamp(48px, 7vw, 90px); }
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: .3em; }
.doc h2 {
  font-size: 1.22rem; margin: 2.1em 0 .55em;
  padding-top: 1.1em; border-top: 1px solid var(--line);
}
.doc h2:first-of-type { border-top: none; padding-top: 0; }
.doc p, .doc li { color: var(--ink); }
.doc ul { padding-left: 1.15em; margin: 0 0 1em; }
.doc li { margin-bottom: .4em; }
.doc code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .88em; background: var(--paper);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
.doc-meta { color: var(--hint); font-size: .93rem; margin-bottom: 1.6em; }
.callout {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 18px 20px; margin: 0 0 2em;
}
.callout p { margin: 0; }
.doc-note {
  margin-top: 2.5em; padding-top: 1.2em; border-top: 1px solid var(--line);
  color: var(--hint); font-size: .9rem;
}

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .cards--3, .cards--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--modes { grid-template-columns: repeat(4, 1fr); }
  .grid--cats  { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 780px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  .hero-art { order: -1; }
  .split, .split--flip { grid-template-columns: 1fr; }
  .split--flip .split__art { order: 0; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .cards--3, .cards--4 { grid-template-columns: 1fr; }
  .grid--modes, .grid--cats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tile img, .tile__art, .tile__art img { height: 56px; }
  .stores { flex-direction: column; align-items: stretch; }
  .store { justify-content: center; }
  .head-nav { gap: 12px; }
  .foot-row { flex-direction: column; }
}

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