/* Chess BFF website. "Toy box" colours from the app (lib/ui/theme.dart),
   with a light (cream) and a dark (carbon) theme. Every colour comes from the
   custom properties in :root, so both themes share one set of rules. */
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  /* Accents: the same in both themes. Text on them is always dark ink. */
  --wood: #c98a4b;
  --mint: #2fbf9b;
  --coral: #ff7867;
  --sun: #ffc23d;
  --sky: #4da8ee;
  --plum: #9466d8;
  --red: #e5484d;
  --on-accent: #3d2a1c;
  --sun-edge: #d99c1f;
  --coral-edge: #d65a4b;
  --mint-edge: #24967a;
  --radius: 26px;
  --max: 1100px;

  /* Light theme (the app's cream "toy box" look). */
  color-scheme: light;
  --bg-top: #fff6e6;
  --bg-bottom: #fce3c2;
  --card: #ffffff;
  --ink: #3d2a1c;
  --ink-soft: #765a44;   /* app inkSoft, a little darker for small text */
  --line: #f0dcc2;
  --tint: #fbeedc;
  --link: #8e5a2b;       /* dark wood */
  --square: #fce3c2;     /* light squares in the header and footer strips */
  --btn-bg: #3d2a1c;
  --btn-ink: #fff6e6;
  --btn-edge: #1f150d;
  --btn-hover: #ffffff;
  --mark: rgba(255, 194, 61, 0.6);
  --shadow: 0 6px 16px rgba(142, 90, 43, 0.12);
  --art-shadow: rgba(142, 90, 43, 0.22);
  --icon-moon: block;
  --icon-sun: none;
}

/* Dark theme: carbon background and dark grey cards, as in Ludo BFF
   (ludo/lib/ui/theme.dart, AppColors). Written twice: once for "follow the
   browser" (no choice saved) and once for a saved choice from the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg-top: #1f2125;
    --bg-bottom: #0e0f11;
    --card: #25282d;
    --ink: #f1f2f4;
    --ink-soft: #a4aab3;
    --line: #383c43;
    --tint: #2f3338;
    --link: #e0a46a;
    --square: #383c43;
    --btn-bg: #f1f2f4;
    --btn-ink: #1a1c20;
    --btn-edge: #7d838c;
    --btn-hover: #000000;
    --mark: rgba(255, 194, 61, 0.38);
    --shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    --art-shadow: rgba(0, 0, 0, 0.5);
    --icon-moon: none;
    --icon-sun: block;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg-top: #1f2125;
  --bg-bottom: #0e0f11;
  --card: #25282d;
  --ink: #f1f2f4;
  --ink-soft: #a4aab3;
  --line: #383c43;
  --tint: #2f3338;
  --link: #e0a46a;
  --square: #383c43;
  --btn-bg: #f1f2f4;
  --btn-ink: #1a1c20;
  --btn-edge: #7d838c;
  --btn-hover: #000000;
  --mark: rgba(255, 194, 61, 0.38);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  --art-shadow: rgba(0, 0, 0, 0.5);
  --icon-moon: none;
  --icon-sun: block;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Fredoka', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
  background-color: var(--bg-top);
  background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Faint toy blocks scattered behind the page, as in the app. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(47, 191, 155, 0.10), rgba(47, 191, 155, 0.10)) 92% 7% / 74px 74px no-repeat,
    linear-gradient(rgba(255, 194, 61, 0.12), rgba(255, 194, 61, 0.12)) 4% 32% / 56px 56px no-repeat,
    linear-gradient(rgba(255, 120, 103, 0.10), rgba(255, 120, 103, 0.10)) 96% 58% / 46px 46px no-repeat,
    linear-gradient(rgba(77, 168, 238, 0.10), rgba(77, 168, 238, 0.10)) 7% 86% / 82px 82px no-repeat;
}

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 8px; }

img, svg { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--btn-bg); color: var(--btn-ink); padding: 10px 16px; border-radius: 12px; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--btn-ink); }

/* Header: a strip of board squares along the top edge. */
.site-header { position: relative; padding: 22px 0 14px; }
.site-header::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--wood) 0 24px, var(--square) 24px 48px);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { margin-right: auto; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 22px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: var(--shadow); }
.nav { display: flex; gap: 4px 6px; flex-wrap: wrap; }
.nav a {
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px;
  padding: 6px 12px; border-radius: 999px;
}
.nav a:hover, .nav a[aria-current='page'] { background: var(--tint); }

/* Light/dark toggle. Shown only when the inline script in <head> has run
   (it adds the "js" class); without JavaScript the page follows the browser. */
.theme-toggle {
  display: none; flex: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 14px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 2px solid var(--line); box-shadow: var(--shadow);
  font: inherit;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { background: var(--tint); }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-moon { display: var(--icon-moon); }
.theme-toggle .i-sun { display: var(--icon-sun); }

/* Hero */
.hero { padding: 28px 0 48px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 36px; align-items: center; }
.tag {
  display: inline-block; background: var(--sun); color: var(--on-accent);
  border-radius: 12px; padding: 3px 14px; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 0 var(--sun-edge);
}
h1, h2, h3 { line-height: 1.15; margin: 0; }
.hero h1 { font-size: clamp(46px, 8vw, 84px); margin: 16px 0 12px; font-weight: 700; letter-spacing: -0.5px; }
.hero h1 .bff {
  display: inline-block; background: var(--coral); color: var(--on-accent);
  border-radius: 22px; padding: 0 16px 4px; transform: rotate(-3deg);
  box-shadow: 0 6px 0 var(--coral-edge);
}
.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--ink); max-width: 34em; margin: 0 0 18px; }
.chips { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 4px 14px; font-weight: 600; font-size: 15px; }

.hero-art { position: relative; }
.hero-art svg { width: 100%; height: auto; filter: drop-shadow(0 14px 22px var(--art-shadow)); }

/* Store buttons: chunky toy buttons with a pressed-in bottom edge. */
.stores { display: flex; flex-wrap: wrap; gap: 14px; }
.store-btn {
  display: inline-flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 10px 20px 10px 16px; border-radius: 18px;
  background: var(--btn-bg); color: var(--btn-ink); text-decoration: none;
  box-shadow: 0 6px 0 var(--btn-edge); transition: transform 0.08s, box-shadow 0.08s;
}
.store-btn:hover { color: var(--btn-hover); transform: translateY(-1px); }
.store-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--btn-edge); }
.store-btn svg { width: 28px; height: 28px; fill: currentColor; flex: none; }
.store-btn span { display: flex; flex-direction: column; line-height: 1.15; }
.store-btn small { font-size: 13px; opacity: 0.9; }
.store-btn strong { font-size: 20px; font-weight: 700; }
.store-btn.soon {
  background: var(--tint); color: var(--ink-soft); box-shadow: 0 6px 0 var(--line);
  border: 2px dashed var(--wood); cursor: default;
}
.store-btn.soon:hover, .store-btn.soon:active { transform: none; box-shadow: 0 6px 0 var(--line); color: var(--ink-soft); }
.store-note { color: var(--ink-soft); font-size: 15px; margin: 16px 0 0; }

/* Sections */
section { padding: 40px 0; }
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(30px, 4.6vw, 44px); font-weight: 700; }
.section-head p { color: var(--ink-soft); margin: 8px auto 0; max-width: 38em; }
.mark { background: linear-gradient(transparent 58%, var(--mark) 58%); padding: 0 4px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tile {
  position: relative; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 20px; box-shadow: var(--shadow);
}
.tile h3 { font-size: 22px; margin: 12px 0 6px; font-weight: 700; }
.tile p { margin: 0; color: var(--ink); }
.tile .small { color: var(--ink-soft); font-size: 15px; margin-top: 8px; }
.badge {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12);
}
.badge svg { width: 34px; height: 34px; }
.b-mint { background: var(--mint); }
.b-sky { background: var(--sky); }
.b-coral { background: var(--coral); }
.b-sun { background: var(--sun); }
.b-plum { background: var(--plum); }
.b-wood { background: var(--wood); }
.soon-flag {
  position: absolute; top: 18px; right: 18px; background: var(--tint); color: var(--link);
  border: 2px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 700;
}

.bots { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.bots li { background: var(--tint); border-radius: 10px; padding: 1px 9px; font-size: 14px; font-weight: 600; }

/* Steps */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li { counter-increment: step; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--mint); color: var(--on-accent); font-weight: 700; font-size: 20px; margin-bottom: 10px;
}
.steps strong { display: block; font-size: 19px; }

/* FAQ */
.faq .wrap { max-width: 800px; }
.faq details {
  background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 2px 20px; margin-bottom: 12px;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-weight: 700; color: var(--link); font-size: 24px; line-height: 1; }
.faq details[open] summary::after { content: '\2212'; }
.faq details p { margin: 0 0 16px; }

/* Call to action */
.cta-card {
  background: var(--mint); border-radius: 32px; padding: 36px 24px; text-align: center;
  box-shadow: 0 8px 0 var(--mint-edge); color: var(--on-accent);
}
.cta-card h2 { font-size: clamp(28px, 4.2vw, 40px); margin-bottom: 8px; }
.cta-card p { margin: 0 auto 22px; max-width: 32em; }
.cta-card .stores { justify-content: center; }
.cta-card .store-btn.soon { background: rgba(255, 255, 255, 0.7); color: var(--on-accent); border-color: var(--on-accent); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.12); }

/* Document pages (privacy, terms, delete account) */
.doc { padding: 12px 0 48px; }
.doc .wrap { max-width: 860px; }
.paper {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 28px 22px; box-shadow: var(--shadow);
}
@media (min-width: 640px) { .paper { padding: 40px 44px; } }
.paper h1 { font-size: clamp(32px, 5vw, 44px); margin-bottom: 6px; }
.paper h2 { font-size: 24px; margin: 32px 0 10px; padding-top: 6px; scroll-margin-top: 16px; }
.paper h3 { font-size: 19px; margin: 20px 0 6px; }
.paper p, .paper li { overflow-wrap: anywhere; }
.paper ul, .paper ol { padding-left: 22px; }
.paper li { margin: 4px 0; }
.meta { color: var(--ink-soft); margin: 0 0 18px; }
.toc { background: var(--tint); border-radius: 18px; padding: 16px 20px; margin: 20px 0; }
.toc ol { margin: 8px 0 0; columns: 2; column-gap: 28px; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
.note { background: var(--tint); border-left: 6px solid var(--sun); border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.path { display: inline-block; background: var(--tint); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-weight: 600; white-space: nowrap; }

.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 16px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 2px solid var(--line); }
th { background: var(--tint); font-weight: 700; }

/* 404 */
.lost { text-align: center; padding: 30px 0 60px; }
.lost svg { width: 180px; height: auto; margin: 0 auto 10px; }
.lost h1 { font-size: clamp(34px, 6vw, 52px); margin-bottom: 8px; }
.lost p { margin: 0 0 22px; color: var(--ink-soft); }
.btn {
  display: inline-block; background: var(--btn-bg); color: var(--btn-ink); text-decoration: none; font-weight: 700;
  border-radius: 16px; padding: 12px 24px; box-shadow: 0 5px 0 var(--btn-edge);
}
.btn:hover { color: var(--btn-hover); }

/* Footer: board-square strip again at the bottom. */
.site-footer { position: relative; padding: 28px 0 32px; margin-top: 16px; color: var(--ink-soft); font-size: 15px; }
.site-footer::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--square) 0 24px, var(--wood) 24px 48px);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--ink); }

/* Tablet and phone */
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { max-width: 440px; margin: 0 auto; width: 100%; }
  .grid, .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  body::before { display: none; } /* the blocks crowd a narrow screen */
  .hero { padding-top: 12px; }
  .grid, .steps { grid-template-columns: 1fr; }
  .nav a { padding: 6px 10px; font-size: 15px; }
  .theme-toggle { order: 2; } /* brand and toggle on the first row, links below */
  .nav { order: 3; width: 100%; }
  .store-btn { width: 100%; justify-content: center; }
}
