/* Gingerbread Gambit — site stylesheet.
   Accessibility: Israeli Standard 5568 (WCAG 2.0 AA). Text colours are chosen by
   measured contrast (4.5:1 body, 3:1 large) against every background they sit on;
   re-measure before changing one. See website/src/accessibility.html.
   Palette and type are lifted from the app itself (ui/theme/Color.kt, Lilita One + Nunito)
   so the website and the game read as one product. Fonts are self-hosted on purpose:
   the privacy policy promises this site makes no third-party requests. */

@font-face { font-family: "Lilita One"; src: url("fonts/lilita_one.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito_regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito_bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito_extrabold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  --icing: #FFF9F2;
  --cream: #F6EBDF;
  --rule: #F0E2D4;
  --cocoa: #7A4A22;
  --cocoa-mid: #8A6A55;
  --cookie: #C98A4B;
  --cookie-deep: #8A5A28;
  --pink: #FF7EB6;
  --pink-top: #FFA6CE;
  --pink-deep: #D14A8C;
  --pink-ink: #5C1A3C;
  --mint: #7FE0C0;
  --mint-top: #BDF2E1;
  --mint-deep: #2FA98A;
  --mint-ink: #0F5143;
  --blue: #7EC8FF;
  --blue-top: #CBEBFF;
  --blue-deep: #4FA3DE;
  --blue-ink: #0C466B;
  --gold: #FFD84D;
  --gold-top: #FFF3C4;
  --gold-deep: #E0A32B;
  --lilac: #C9A8FF;
  --lilac-top: #E6D8FF;
  --lilac-deep: #9A6FE0;

  --bg: #FFF9F2;
  --surface: #FFFFFF;
  --text: #5A3518;
  --text-soft: #654532;
  --link: #A8336E;
  --accent-ink: #9E2F68;
  --sky-a: #BFE6FF;
  --sky-b: #E9DCFF;
  --sky-c: #FFD6EA;
  --shadow: rgba(122, 74, 34, .18);

  --display: "Lilita One", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 26px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16122B;
    --surface: #221B3D;
    --text: #F3EEFF;
    --text-soft: #BDB2DD;
    --link: #FF9CC8;
    --rule: #342A58;
    --sky-a: #1D2A5C;
    --sky-b: #2E2260;
    --sky-c: #4A2153;
    --shadow: rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem; /* 17px; rem so the accessibility menu's text size can scale it */
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue-deep); outline-offset: 3px; border-radius: 8px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 12px; z-index: 100; }
.skip:focus { left: 16px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 2px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--display); font-size: 1.25rem; letter-spacing: .01em; }
.brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 2px 0 var(--cookie); }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--text-soft); font-weight: 800; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--cream); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav a:hover, :root:not([data-theme="light"]) .nav a[aria-current="page"] { background: var(--rule); } }
.nav .nav-cta {
  background: linear-gradient(180deg, var(--pink-top), var(--pink)); color: var(--pink-ink);
  border: 2px solid var(--pink-deep); box-shadow: 0 3px 0 var(--pink-deep);
  white-space: nowrap; padding: 7px 16px;
}
.nav .nav-cta:hover { color: var(--pink-ink); background: linear-gradient(180deg, var(--pink-top), var(--pink-top)); }
.nav .nav-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--pink-deep); }
@media (max-width: 640px) {
  .nav a:not(.nav-cta) { display: none; }
  .brand span { font-size: 1.05rem; }
}

/* ---------- Store badges ----------
   Apple's and Google's official artwork, unmodified (both brands require that).
   Google's PNG carries its own transparent clear-space (41px of 250 at source);
   the negative margin lets its visible badge line up with Apple's at the same height.
   Logotypes are exempt from the contrast rule (WCAG 1.4.3). */
.store-badge { display: inline-flex; align-items: center; line-height: 0; border-radius: 10px; transition: transform .12s ease; }
.store-badge:hover { transform: translateY(-2px); }
.store-badge img { display: block; height: 48px; width: auto; }
.store-badge.google img { height: 71.4px; margin: -11.7px; }
@media (min-width: 900px) { .store-badge img { height: 54px; } .store-badge.google img { height: 80.4px; margin: -13.2px; } }

.store-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 18px; }

/* ---------- Footer ---------- */
.site-footer { --footer: #4B2C82; margin-top: 96px; background: linear-gradient(180deg, var(--footer), #2F1B57); color: #F3EEFF; position: relative; }
.site-footer::before {
  /* icing drip along the top edge */
  content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 24px;
  -webkit-mask: radial-gradient(14px 16px at 50% 100%, #000 98%, transparent) 0 0 / 44px 24px repeat-x;
          mask: radial-gradient(14px 16px at 50% 100%, #000 98%, transparent) 0 0 / 44px 24px repeat-x;
  background: var(--footer);
}
.site-footer .wrap { padding: 48px 0 40px; display: grid; gap: 28px; grid-template-columns: 1.4fr 1fr 1fr; }
.site-footer h2 { font-family: var(--display); font-weight: 400; font-size: 1.1rem; margin: 0 0 10px; color: var(--gold); letter-spacing: .02em; }
.site-footer a { color: #FFE3F0; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer p { margin: 0 0 8px; color: #D9CFF3; font-size: .95rem; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.14); padding-top: 18px; font-size: .85rem; color: #B9ABDF; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .site-footer .wrap > :first-child { grid-column: 1 / -1; } }
/* The support@ address cannot wrap on its own and pushed the footer past a 320px
   screen (WCAG 1.4.10 reflow). One column on small phones, and let long links break. */
@media (max-width: 480px) { .site-footer .wrap { grid-template-columns: minmax(0, 1fr); } }
.site-footer a { overflow-wrap: anywhere; }

/* ---------- Legal / document pages ---------- */
.doc-hero {
  background: linear-gradient(160deg, var(--sky-a), var(--sky-b) 55%, var(--sky-c));
  padding: 56px 0 72px;
  position: relative;
  overflow: hidden;
}
.doc-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 28px;
  background: var(--bg);
  -webkit-mask: radial-gradient(16px 18px at 50% 0, transparent 98%, #000) 0 0 / 48px 28px repeat-x;
          mask: radial-gradient(16px 18px at 50% 0, transparent 98%, #000) 0 0 / 48px 28px repeat-x;
}
.doc-hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; margin: 0 0 10px; color: var(--cocoa); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .doc-hero h1 { color: var(--gold-top); } }
.doc-hero p { margin: 0; color: var(--text-soft); font-weight: 700; }
.doc-hero .soldier { position: absolute; right: max(16px, calc(50% - 560px)); bottom: 8px; width: clamp(90px, 16vw, 170px); transform: rotate(8deg); filter: drop-shadow(0 8px 10px var(--shadow)); }
@media (max-width: 640px) { .doc-hero .soldier { opacity: .35; } }

.doc { width: min(760px, 100% - 32px); margin: 8px auto 0; }
.doc h2 { font-family: var(--display); font-weight: 400; font-size: 1.55rem; color: var(--cocoa); margin: 2.2em 0 .5em; line-height: 1.15; }
.doc h3 { font-size: 1.1rem; font-weight: 800; margin: 1.6em 0 .4em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .doc h2 { color: var(--gold-top); } }
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-left: 0; padding-inline-start: 1.3em; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--accent-ink); }
.doc code { background: var(--cream); color: var(--cocoa); padding: 1px 6px; border-radius: 6px; font-size: .88em; word-break: break-word; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .doc code { background: var(--rule); color: var(--text); } }
.doc hr { border: 0; border-top: 2px dashed var(--rule); margin: 2.4em 0; }

.toc { background: var(--surface); border: 2px solid var(--rule); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 8px; box-shadow: 0 4px 0 var(--rule); }
.toc strong { font-family: var(--display); font-weight: 400; font-size: 1.1rem; color: var(--cocoa); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toc strong { color: var(--gold-top); } }
.toc ol { margin: 8px 0 0; columns: 2 220px; column-gap: 28px; }
.toc a { text-decoration: none; font-weight: 700; }
.toc a:hover { text-decoration: underline; }

.callout { border-radius: 20px; padding: 16px 20px; margin: 1.4em 0; border: 2px solid var(--mint-deep); background: color-mix(in srgb, var(--mint) 22%, var(--surface)); }
.callout.warn { border-color: var(--pink-deep); background: color-mix(in srgb, var(--pink) 16%, var(--surface)); }
.callout p:first-child { margin-top: 0; } .callout p:last-child { margin-bottom: 0; }

.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start; margin: 0; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--gold); border: 3px solid var(--cookie); color: var(--cocoa); font-family: var(--display); font-size: 1.2rem; box-shadow: 0 3px 0 var(--gold-deep); }

details.faq { background: var(--surface); border: 2px solid var(--rule); border-radius: 20px; padding: 4px 18px; margin: 10px 0; box-shadow: 0 3px 0 var(--rule); }
details.faq summary { cursor: pointer; font-weight: 800; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-family: var(--display); color: var(--accent-ink); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq > :not(summary) { margin-top: 0; }

/* ---------- Accessibility menu (assets/a11y.js) ---------- */
.a11y-widget { position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 80; font-family: var(--body); }
.a11y-launcher {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: #0C466B; color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 0 #062B43, 0 8px 18px rgba(0,0,0,.25);
}
.a11y-launcher svg { width: 30px; height: 30px; }
.a11y-launcher:hover { background: #0E5585; }
.a11y-launcher:focus-visible, .a11y-panel button:focus-visible, .a11y-panel a:focus-visible { outline: 3px solid #FFD84D; outline-offset: 3px; }
.a11y-panel {
  position: absolute; left: 0; bottom: 64px; width: min(300px, calc(100vw - 32px));
  max-height: calc(100vh - 110px); overflow: auto;
  background: #fff; color: #1a1a1a; border: 2px solid #0C466B; border-radius: 20px;
  padding: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.28);
}
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.a11y-title { margin: 0; font-size: 1.1rem; font-weight: 800; color: #0C466B; font-family: var(--body); }
.a11y-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #EEF4F8; color: #0C466B; cursor: pointer; display: grid; place-items: center; }
.a11y-close svg { width: 20px; height: 20px; }
.a11y-label { display: flex; flex-direction: column; line-height: 1.2; text-align: start; }
.a11y-he { font-size: .82em; color: #444; }
.a11y-section { margin: 10px 0 6px; font-weight: 800; font-size: .95rem; }
.a11y-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.a11y-size, .a11y-toggle, .a11y-reset {
  font: inherit; cursor: pointer; border: 2px solid #C9D6DF; background: #fff; color: #1a1a1a; border-radius: 12px;
}
.a11y-size { padding: 8px 0; font-weight: 800; font-size: .95rem; }
.a11y-size[aria-pressed="true"] { background: #0C466B; border-color: #0C466B; color: #fff; }
.a11y-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; margin: 6px 0; font-weight: 700; font-size: .95rem; }
.a11y-switch { flex: none; width: 38px; height: 22px; border-radius: 11px; background: #B8C4CC; position: relative; transition: background .15s; }
.a11y-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.a11y-toggle[aria-pressed="true"] { border-color: #0C466B; }
.a11y-toggle[aria-pressed="true"] .a11y-switch { background: #0C466B; }
.a11y-toggle[aria-pressed="true"] .a11y-switch::after { transform: translateX(16px); }
.a11y-reset { width: 100%; padding: 9px 12px; margin-top: 6px; font-weight: 700; font-size: .95rem; background: #F4F4F4; }
.a11y-statement { display: block; margin-top: 10px; color: #0C466B; font-weight: 700; font-size: .95rem; }
@media (max-width: 640px) { .a11y-launcher { width: 46px; height: 46px; } .a11y-launcher svg { width: 26px; height: 26px; } .a11y-panel { bottom: 58px; } }

/* Mode: stop animations. Everything, not just the decorative ones. */
html.a11y-still *, html.a11y-still *::before, html.a11y-still *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* Mode: readable font. Lilita One is decorative; swap every face for a plain sans. */
html.a11y-font, html.a11y-font body, html.a11y-font * { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important; letter-spacing: normal !important; }
html.a11y-font body { line-height: 1.7; word-spacing: .08em; }

/* Mode: highlight links. */
html.a11y-links a:not(.store-badge):not(.brand) { text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 3px; }
html.a11y-links a { outline: 2px dashed currentColor; outline-offset: 2px; }

/* Mode: high contrast. Black on white, solid borders, no gradients or decoration. */
html.a11y-contrast { --bg: #fff; --surface: #fff; --text: #000; --text-soft: #000; --link: #0000CC; --accent-ink: #000; --cocoa: #000; --rule: #000; --shadow: transparent; color-scheme: light; }
html.a11y-contrast body { background: #fff !important; color: #000 !important; }
html.a11y-contrast .hero, html.a11y-contrast .doc-hero, html.a11y-contrast .final-card,
html.a11y-contrast .mode, html.a11y-contrast .flip .face,
html.a11y-contrast .nav .nav-cta, html.a11y-contrast .toc, html.a11y-contrast details.faq,
html.a11y-contrast .fair-list li, html.a11y-contrast .callout, html.a11y-contrast .site-header {
  background: #fff !important; color: #000 !important; border: 2px solid #000 !important; box-shadow: none !important; text-shadow: none !important;
}
html.a11y-contrast .hero *, html.a11y-contrast .doc-hero *, html.a11y-contrast .mode *,
html.a11y-contrast .flip .face *, html.a11y-contrast .section h2, html.a11y-contrast .doc h2, html.a11y-contrast .eyebrow,
html.a11y-contrast .tagline, html.a11y-contrast .brand, html.a11y-contrast .nav a { color: #000 !important; text-shadow: none !important; }
html.a11y-contrast a { color: #0000CC !important; }
html.a11y-contrast .nav .nav-cta { color: #000 !important; }
html.a11y-contrast .sprinkles, html.a11y-contrast .hero::after, html.a11y-contrast .doc-hero::after, html.a11y-contrast .site-footer::before { display: none !important; }
html.a11y-contrast .site-footer { background: #000 !important; color: #fff !important; }
html.a11y-contrast .site-footer *, html.a11y-contrast .site-footer a { color: #fff !important; }
html.a11y-contrast .site-footer h2 { color: #FFD84D !important; }
