:root {
  --bg: #fffaf0;
  --bg-alt: #fdf0d2;
  --ink: #3b2f1e;
  --muted: #7a6a52;
  --gold: #f5b83d;
  --link: #8a5700;      /* darker than the gold so links read as text (contrast >= 4.5:1) */
  --card: #ffffff;
  --line: rgba(122, 106, 82, .25);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1810;
    --bg-alt: #2a2114;
    --ink: #f6ead2;
    --muted: #bfae8e;
    --link: #f5b83d;
    --card: #2f261a;
    --line: rgba(246, 234, 210, .18);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* for visitors whose language is saved as Vietnamese: wait for the translation instead of flashing English */
html.i18n-pending body { visibility: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: clip;
}
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* ---- header ---- */
.nav {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; max-width: 1100px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); order: 0; padding: 6px 0; }
.brand img { display: block; width: 32px; height: 32px; }
.nav nav { display: flex; gap: 4px; margin-left: auto; order: 1; }
.nav nav a { text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 10px; }
.nav nav a:hover { background: var(--bg-alt); }
.nav .lang { order: 2; }

/* the Windows download is replaced by "send the link to your PC" on other devices (see app.js) */
body:not(.not-windows) .only-other { display: none; }
body.not-windows .only-other { display: inline-flex; }
body.not-windows .other-os { display: block; }
body.not-windows #download-btn { display: none; }
body.not-windows .win-note { display: none; }

main, .footer { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ---- hero ---- */
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px;
  align-items: center; padding: 48px 0 64px;
}
.lead { font-size: 1.15rem; color: var(--muted); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 24px; border-radius: 999px; text-decoration: none;
  font: inherit; font-weight: 700; cursor: pointer; border: 2px solid var(--gold);
}
.btn small { font-weight: 400; font-size: .8rem; opacity: .85; }
.btn.primary { background: var(--gold); color: #2a1d05; }
.btn.primary:hover { background: #ffc94f; }
.btn.ghost { color: var(--ink); background: transparent; }
.btn.ghost:hover { background: var(--bg-alt); }
.note { font-size: .88rem; color: var(--muted); }

.hero-art { text-align: center; }
#peak {
  display: block; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe9b8, var(--gold));
}
.demo-hint { font-size: .85rem; color: var(--muted); margin: 12px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip, .lang {
  font: inherit; font-size: .9rem; cursor: pointer; min-height: 40px;
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--gold); background: transparent; color: var(--ink);
}
.lang { font-weight: 700; }
.chip:hover, .lang:hover { background: var(--bg-alt); }
.chip[aria-pressed="true"] { background: var(--gold); color: #2a1d05; }

/* ---- sections ---- */
.section { padding: 56px 0; }
/* a full-width tinted band even though main is narrower than the screen */
.section.alt {
  background: var(--bg-alt);
  box-shadow: 0 0 0 100vmax var(--bg-alt);
  clip-path: inset(0 -100vmax);
}
.sub { color: var(--muted); margin-bottom: 28px; }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.card h3 { font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }

.gestures { border-collapse: collapse; width: 100%; max-width: 760px; }
.gestures th, .gestures td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gestures th { width: 40%; font-weight: 600; }
.gestures td { color: var(--muted); }

.steps { padding-left: 1.3em; max-width: 760px; }
.steps li { margin: .7em 0; }
code { background: var(--bg-alt); padding: 1px 6px; border-radius: 6px; font-size: .9em; overflow-wrap: anywhere; }
.section.alt code { background: var(--card); }

.checks { padding-left: 1.2em; max-width: 760px; }
.checks li { margin: .5em 0; }

details { background: var(--card); border-radius: var(--radius); padding: 4px 20px; margin: 10px 0; max-width: 760px; }
summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
details p { margin: 0 0 12px; color: var(--muted); }

.releases { list-style: none; padding: 0; display: grid; gap: 14px; max-width: 760px; }
.releases li { background: var(--card); border-radius: var(--radius); padding: 16px 20px; }
.releases h3 { margin-bottom: .2em; font-size: 1.1rem; }
.releases .meta { color: var(--muted); font-size: .85rem; }
/* long notes are cut to a few lines; the title and "Full notes" open the whole release */
.releases pre {
  white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: .5em 0 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden;
}
.releases .more { display: inline-block; margin-top: .4em; font-size: .9rem; }

.footer {
  padding-top: 32px; padding-bottom: 48px;
  color: var(--muted); font-size: .9rem; text-align: center;
}

/* ---- phones and narrow windows ---- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav { flex-wrap: wrap; padding: 8px 16px; }
  .nav .lang { margin-left: auto; }
  /* the link row scrolls sideways instead of wrapping; the fade hints that there is more */
  .nav nav {
    order: 3; flex-basis: 100%; margin-left: -10px; overflow-x: auto; white-space: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav .nav-extra { display: none; }   /* GitHub is in the footer */
  main, .footer { padding-left: 16px; padding-right: 16px; }
  .section, .section.alt { padding-top: 40px; padding-bottom: 40px; }

  /* words and the download first, Peak right under them */
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 24px 0 40px; }
  #peak { width: min(100%, 280px); }
  .cta .btn { flex: 1 1 100%; }
  .btn.ghost { border-color: var(--line); }

  /* the gesture table becomes a list: action on top, result under it */
  .gestures, .gestures tbody, .gestures tr, .gestures th, .gestures td { display: block; width: 100%; }
  .gestures tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .gestures th, .gestures td { padding: 0; border: 0; }

  details { padding: 2px 16px; }
}
