/* Bawlby promo page, in the Toy Box look from DESIGN.md: the pitch and download on the left, game screens sliding on the right. */
:root {
  color-scheme: light;
  --bg: #F4F2EA;
  --card: #FFFFFF;
  --lip: #E3E2BE;
  --ink: #3A332B;
  --muted: #6F675E;
  --yellow: #F7D84A;
  --yellow-hover: #FFE266;
  --yellow-lip: #D9B52B;
  --on-yellow: #4A3F1E;
  --icon-lip: #3E2619;  /* the app icon's cocoa ground, darker */
  --icon-orange: #FF8A3D;
  --icon-pink: #F9739F;
  --tint-pink: #FFE9F1;
  --modal-shade: rgba(90, 70, 20, .35);
  --frame-shadow: rgba(90, 70, 20, .22);
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --ui: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --slide: 620ms cubic-bezier(.65, 0, .35, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 700 17px/1.5 var(--ui);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Japanese wraps at phrase boundaries where the browser can find them. */
:lang(ja) { word-break: auto-phrase; }

/* The closed language control is deliberately only a globe. It opens a searchable picker for the large locale set. */
.top { width: 100%; max-width: 1360px; margin: 0 auto; padding-top: 16px; display: flex; justify-content: flex-end; }
.no-js .top { display: none; }
.language-button, .language-close {
  width: 44px; height: 44px; padding: 0; border: 0; border-bottom: 4px solid var(--lip); border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--ink); cursor: pointer;
  transition: transform .2s var(--spring), background-color .15s;
}
.language-button:hover, .language-close:hover { transform: translateY(-2px); background: #fffdf7; }
.language-button:active, .language-close:active { transform: translateY(1px); border-bottom-width: 2px; }

.language-dialog {
  width: min(760px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 32px)); max-width: none; max-height: none;
  margin: auto; padding: 0; border: 0; border-radius: 30px; background: transparent; color: var(--ink); overflow: visible;
}
.language-dialog::backdrop { background: var(--modal-shade); backdrop-filter: blur(8px); }
.language-card {
  height: 100%; display: flex; flex-direction: column; overflow: hidden; padding: 24px;
  border-bottom: 6px solid var(--lip); border-radius: 30px; background: var(--card);
  box-shadow: 0 32px 72px -16px var(--frame-shadow);
}
.language-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.language-head h2 { margin: 0; font: 600 clamp(24px, 4vw, 32px)/1.15 var(--display); }
.language-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.language-close { flex: none; background: var(--bg); }
.language-search {
  min-height: 50px; margin-top: 20px; padding-inline: 16px; display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--lip); border-radius: 25px; background: var(--bg); color: var(--muted);
}
.language-search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 2px var(--card), 0 0 0 5px var(--ink); }
.language-search input {
  width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 800 16px/1.2 var(--ui);
}
.language-search input::placeholder { color: var(--muted); opacity: .85; }
.language-groups { flex: 1; min-height: 0; margin-top: 16px; overflow-y: auto; scrollbar-gutter: stable; }
.language-groups section + section { margin-top: 24px; }
.language-groups h3 {
  position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 4px;
  background: var(--card); color: var(--muted); font: 800 13px/1.2 var(--ui); text-transform: uppercase; letter-spacing: .04em;
}
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.language-option {
  min-width: 0; min-height: 60px; padding: 8px 10px 8px 14px; border: 0; border-radius: 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: var(--bg); color: var(--ink); text-align: start; cursor: pointer;
}
.language-option[hidden], .language-groups section[hidden] { display: none; }
.language-option:hover { background: var(--tint-pink); }
.language-option[aria-selected="true"] { background: #fff7cf; box-shadow: inset 0 0 0 2px var(--yellow-lip); }
.language-names { min-width: 0; display: flex; flex-direction: column; }
.language-native { overflow: hidden; text-overflow: ellipsis; font: 800 16px/1.2 var(--ui); }
.language-english { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font: 700 12px/1.3 var(--ui); }
.language-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--muted); font-size: 11px; }
.language-check { width: 20px; height: 20px; color: #537a55; }
.language-option:not([aria-selected="true"]) .language-check { visibility: hidden; }
.language-fallback { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.language-empty { margin: 28px 0 auto; text-align: center; color: var(--muted); }
.language-review { margin: 14px 4px 0; color: var(--muted); font-size: 12px; }
/* i18n.js removes this once the visitor's language is in place, so English does not flash first. */
.lang-pending .hero, .lang-pending .foot { visibility: hidden; }

.hero {
  flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding-block: clamp(16px, 5vh, 64px) 32px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px);
  align-items: center; align-content: center;
}

/* Pitch */
.pitch { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; min-width: 0; }
.title { display: flex; align-items: center; gap: clamp(16px, 2vw, 28px); min-width: 0; }
.title img {
  /* The app icon with a store-style corner and a lip in its own darker cocoa. */
  flex: none; width: clamp(80px, 9vw, 136px); height: auto; aspect-ratio: 1; border-radius: 22.4%;
  box-shadow: 0 6px 0 var(--icon-lip), 0 16px 32px var(--frame-shadow);
}
h1 {
  margin: 0; min-width: 0; font: 600 clamp(44px, 5.6vw, 80px)/1.02 var(--display); letter-spacing: -.01em; text-wrap: balance;
}
.lede { margin: 0; max-width: 36ch; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; color: var(--muted); }

.get { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.play {
  /* A pill: radius is half the 64px height. A long translation may wrap; the button then grows and stays rounded. */
  display: inline-flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 32px;
  background: var(--yellow); color: var(--on-yellow); text-decoration: none; text-align: center;
  font: 600 22px/1.2 var(--display); border-radius: 32px; border-bottom: 5px solid var(--yellow-lip);
  box-shadow: 0 10px 24px rgba(150, 110, 20, .18);
  border-top: 0; border-inline: 0; cursor: pointer; transition: transform .2s var(--spring), background-color .15s;
}
.play:hover { background: var(--yellow-hover); transform: translateY(-3px); }
.play:active { transform: translateY(1px); border-bottom-width: 3px; }
.download {
  display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 6px 18px 6px 14px;
  background: var(--card); color: var(--ink); border-bottom: 4px solid var(--lip); border-radius: 24px;
  font: 600 17px/1.2 var(--display); text-decoration: none; transition: transform .2s var(--spring);
}
.download:hover { transform: translateY(-2px); }
.other { margin: 4px 0 0; margin-inline-start: 6px; font-size: 14px; color: var(--ink); text-underline-offset: 3px; }

/* Support: two secondary pills under the download, white with a lip so the yellow download stays the primary action. */
.support { display: flex; flex-wrap: wrap; gap: 10px; }
.support-button {
  /* A pill: radius is half the 48px height. */
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 18px 6px 14px; border-radius: 24px;
  background: var(--card); color: var(--ink); border: 0; border-bottom: 4px solid var(--lip);
  font: 600 17px/1.2 var(--display); text-decoration: none; cursor: pointer;
  transition: transform .2s var(--spring);
}
.support-button:hover { transform: translateY(-2px); }
.support-button.coffee svg { color: var(--icon-orange); }
.support-button.tips svg { color: var(--icon-pink); }

/* The tip jar card: a Toy Box dialog over a warm shade. Escape, a press outside or Close dismisses it. */
.tip-card {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100svh - 32px); margin: auto; padding: 24px 26px 22px;
  border: 0; border-bottom: 5px solid var(--lip); border-radius: 28px; background: var(--card); color: var(--ink);
  box-shadow: 0 30px 60px -18px var(--frame-shadow); font: 700 16px/1.5 var(--ui);
}
.tip-card:popover-open { display: flex; flex-direction: column; gap: 12px; }
.tip-card::backdrop { background: var(--modal-shade); }
.tip-card p { margin: 0; }
.tip-card .terms { color: var(--muted); font-size: 14px; }
.tip-head { display: flex; align-items: center; gap: 12px; }
.tip-tile { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--tint-pink); color: var(--icon-pink); flex: none; }
.tip-card h2 { margin: 0; font: 600 22px/1.2 var(--display); text-wrap: balance; }
.tip-close {
  align-self: flex-end; margin-top: 4px; min-height: 44px; padding: 0 22px; border: 0; border-radius: 22px;
  background: var(--yellow); color: var(--on-yellow); border-bottom: 4px solid var(--yellow-lip); font: 600 17px/1 var(--display); cursor: pointer;
}
/* Browsers without popovers would show the card inline; hide it and its button there. */
@supports not selector(:popover-open) { .tip-card, .support-button.tips { display: none; } }

/* The release WebGL build opens only on request, in a real modal that gives the game nearly the whole viewport. */
.player-open { overflow: hidden; }
.player-dialog {
  width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--ink); overflow: hidden;
}
.player-dialog::backdrop { background: rgba(28, 22, 16, .72); backdrop-filter: blur(8px); }
.player-card {
  width: min(1500px, calc(100vw - 32px)); height: min(960px, calc(100dvh - 32px)); margin: 16px auto;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: var(--card);
  box-shadow: 0 36px 90px rgba(0, 0, 0, .5), 0 6px 0 var(--lip);
}
.player-head { min-height: 62px; padding: 8px 10px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; }
.player-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-brand img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.player-brand h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 20px/1.2 var(--display); }
.player-actions { display: flex; gap: 8px; }
.player-actions button {
  width: 44px; height: 44px; padding: 0; border: 0; border-bottom: 3px solid var(--lip); border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); color: var(--ink); cursor: pointer;
}
.player-stage { flex: 1; min-height: 0; background: #1f1c19; }
.player-stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #1f1c19; }
.player-card:fullscreen { width: 100vw; height: 100vh; margin: 0; border-radius: 0; box-shadow: none; }

/* Slider */
.slider { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.frame {
  position: relative; overflow: hidden; border-radius: 28px; aspect-ratio: 1440 / 1000;
  background: var(--lip); box-shadow: 0 30px 60px -18px var(--frame-shadow), 0 6px 0 var(--lip);
  touch-action: pan-y; cursor: grab;
}
.frame:active { cursor: grabbing; }
.track { display: flex; height: 100%; transition: transform var(--slide); will-change: transform; }
.slide { flex: 0 0 100%; margin: 0; height: 100%; }
.slide img { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 0 6px; }
.caption { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.caption-title { font: 600 21px/1.25 var(--display); }
.caption-text { color: var(--muted); font-size: 15px; }
.nav { display: flex; align-items: center; gap: 12px; }
/* Right to left, the page mirrors but the slider keeps its direction, as the game keeps spatial controls unmirrored. */
.frame, .nav { direction: ltr; }
.arrow {
  width: 44px; height: 44px; border-radius: 50%; border: 0; border-bottom: 3px solid var(--lip);
  background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer;
  transition: transform .2s var(--spring);
}
.arrow:hover { transform: translateY(-2px); }
.dots { display: flex; gap: 8px; }
.dots button {
  width: 12px; height: 12px; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--lip); transition: width .3s var(--spring), background-color .2s;
}
.dots button[aria-current="true"] { width: 32px; background: var(--yellow); }
.no-js .bar .nav { display: none; }

:is(.language-button, .language-close, .language-option, .play, .download, .other, .arrow, .dots button, .frame, .support-button, .tip-close, .player-actions button):focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding-block: 8px 24px; display: flex; flex-direction: column; gap: 4px; }
.foot p { margin: 0; }
.copyright { color: var(--ink); }

/* Phones and narrow windows: one column, pitch first. */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 28px; }
  .lede { max-width: 46ch; }
  .frame { border-radius: 20px; }
}
@media (max-width: 480px) {
  .language-dialog { width: 100vw; height: 100dvh; }
  .language-card { padding: 18px 16px; border-radius: 0; border-bottom: 0; }
  .language-options { grid-template-columns: minmax(0, 1fr); }
  .play { width: 100%; justify-content: center; font-size: 20px; padding: 0 20px; }
  .get { align-self: stretch; }
  .player-card { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; box-shadow: none; }
  .player-head { min-height: 56px; }
  .player-actions [data-player-fullscreen] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .track, .language-button, .language-close, .play, .download, .arrow, .dots button, .support-button { transition: none; }
  .language-button:hover, .language-close:hover, .play:hover, .download:hover, .arrow:hover, .support-button:hover { transform: none; }
}
