/* ============================================================
   DopaSpeak homepage (all 13 languages) - "Paper + Ink"
   Depends on /design/tokens.css. No gradients, one accent.
   Handwriting is used in exactly two roles: the eyebrow sticker
   and the decode line under a word (as in the app).
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.03em; line-height: 1.04; font-weight: 800; text-wrap: balance; }
.container { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--sp-5); }
.accent { color: var(--pink); }
.start { text-align: start; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--pink-d); outline-offset: 3px; border-radius: 6px; }
section[id], #webgame { scroll-margin-top: calc(var(--nav-h) + var(--sp-4)); }
.skip { position: absolute; inset-inline-start: 8px; top: -80px; z-index: 100; padding: var(--sp-2) var(--sp-4); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--r-pill); } /* parked above the page, not 999px to the left: in a right-to-left document that left edge is scrollable and every Arabic page could be dragged 999px sideways */
.skip:focus { top: 8px; }

/* ---------- Ink primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 14px var(--sp-5); border-radius: var(--r-pill);
  border: var(--stroke) solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 16px; line-height: 1; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translate(2px, 3px); box-shadow: var(--shadow-press); }
.btn-primary { background: var(--pink-d); color: #fff; }
.btn-lg { padding: 17px 28px; font-size: 17px; }
.btn-sm { padding: 10px var(--sp-4); font-size: 14px; }
.btn svg { width: 18px; height: 18px; }

.eyebrow {
  display: inline-block; font-family: var(--font-hand); font-size: 20px; line-height: 1;
  padding: 7px 14px 8px; border-radius: 14px 12px 15px 11px;
  border: 2px solid var(--line); background: var(--card); box-shadow: var(--shadow-1);
  transform: rotate(-1.2deg);
}
.eyebrow.pink { background: var(--pink-soft); }
.num { font-family: var(--font-display); font-weight: 800; color: var(--pink-d); letter-spacing: -0.02em; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; min-height: var(--nav-h);
  background: var(--nav-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--stroke) solid var(--line);
}
.nav-inner { max-width: var(--wrap); margin: 0 auto; padding: 14px var(--sp-5); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-weight: 600; font-size: 15px; padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav-links a:hover { border-bottom-color: var(--pink); }
.nav-right { display: flex; align-items: center; gap: 10px; }

.lang { position: relative; }
.lang > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: var(--r-pill); border: 2px solid var(--line); background: var(--card); font-size: 14px; font-weight: 700; box-shadow: var(--shadow-1); }
.lang > summary::-webkit-details-marker { display: none; }
.lang > summary svg { width: 16px; height: 16px; }
.lang-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60; background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--r-md); padding: 6px; min-width: 170px; box-shadow: var(--shadow-2); display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.lang-menu a { display: block; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.lang-menu a:hover { background: var(--pink-soft); }

.menu-toggle { display: none; padding: 9px 12px; }
.menu-toggle .ico-x { display: none; }
.menu-toggle[aria-expanded="true"] .ico-burger { display: none; }
.menu-toggle[aria-expanded="true"] .ico-x { display: block; }
.mobile-menu { display: none; }

/* ---------- Hero: copy left, live demo right ---------- */
.hero { padding: var(--sp-8) 0 var(--sp-6); }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--sp-4) var(--sp-7); align-items: center;
  grid-template-areas: "title demo" "copy demo";
}
.hero-title { grid-area: title; align-self: end; }
.hero-copy { grid-area: copy; align-self: start; }
.demo { grid-area: demo; }
.hero h1 { font-size: clamp(42px, 5vw, 64px); margin: 22px 0 0; }
.hero h1 .h1-a, .hero h1 .accent { display: block; text-wrap: balance; }
.hero-sub { font-size: 19px; line-height: 1.55; color: var(--ink-soft); max-width: 560px; margin: var(--sp-4) 0 var(--sp-5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: 14px; }
.hero-note { font-size: 14px; color: var(--ink-mute); max-width: 560px; }
.hero-note strong { color: var(--ink-soft); font-weight: 600; }

/* ---------- Decode demo (the product, live) ---------- */
.demo { position: relative; max-width: 540px; width: 100%; margin: 0 auto; }
.demo-card {
  border: var(--stroke) solid var(--line); background: var(--card);
  border-radius: var(--r-wonk2); box-shadow: var(--shadow-3); padding: var(--sp-5) var(--sp-5) 18px;
}
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.demo-pair { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 6px 12px; border-radius: var(--r-pill); border: 2px solid var(--line); background: var(--paper); font-size: 13px; font-weight: 700; }
.demo-count { font-size: 14px; font-weight: 600; color: var(--ink-mute); }
.demo-hint { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.turn { display: flex; align-items: flex-end; gap: var(--sp-3); }
.turn img { width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto; filter: var(--drop); }
.turn.r { flex-direction: row-reverse; }
.bubble {
  position: relative; flex: 1; padding: 14px 16px 12px; border: var(--stroke) solid var(--line);
  border-radius: 18px 20px 20px 4px; background: var(--card); box-shadow: var(--shadow-1); min-height: 92px;
}
.turn.r .bubble { border-radius: 20px 18px 4px 20px; }
.tokens { display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: flex-start; }
.tok {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 9px 5px; border-radius: 12px 10px 12px 11px; border: 2px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-1); cursor: pointer; user-select: none;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.tok:hover { transform: translateY(-2px); }
.tok.on { background: var(--pink-soft); }
.tok .w { font-weight: 700; font-size: 17px; line-height: 1.1; }
.tok .d {
  font-family: var(--font-hand); font-size: 17px; line-height: 1; color: var(--pink-d);
  filter: blur(2px); opacity: .9; transition: filter var(--t-med) var(--ease-out), opacity var(--t-med) ease;
}
.tok.on .d { filter: blur(0); opacity: 1; }
@media (hover: hover) { .tok:hover .d { filter: blur(0); opacity: 1; } }
.demo-meaning {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--paper-2);
  font-size: 15px; color: var(--ink-soft); opacity: 0; transform: translateY(4px);
  transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-out);
}
.demo-meaning.show { opacity: 1; transform: none; }
.demo-meaning:empty { display: none; }
.demo-meaning b { color: var(--ink); }
.demo-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.demo-done { font-size: 14px; color: var(--ink-mute); }
.demo-actions { display: flex; gap: var(--sp-2); margin-inline-start: auto; }
.demo-cap { text-align: center; margin-top: var(--sp-3); font-size: 14px; color: var(--ink-mute); }
.demo-arrow { position: absolute; inset-inline-start: -54px; top: 34px; width: 52px; color: var(--pink); transform: rotate(8deg); }
[dir="rtl"] .demo-arrow { transform: rotate(-8deg) scaleX(-1); }

/* ---------- Sections ---------- */
section { padding: var(--sp-9) 0; }
.sec-tight { padding-top: 0; }
.sec-head { font-size: clamp(32px, 4.4vw, 54px); margin: var(--sp-4) 0 14px; }
.sec-head-sm { font-size: clamp(24px, 3vw, 34px); }
.sec-lead { font-size: 18px; color: var(--ink-soft); max-width: 640px; }
.center { text-align: center; }
.center .sec-lead { margin: 0 auto; }

/* Steps: text + real screenshot, alternating */
.steps { display: grid; gap: var(--sp-8); margin-top: var(--sp-7); }
.step { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-7); align-items: center; }
.step:nth-child(even) .step-shot { order: -1; }
.step-num { font-size: 28px; line-height: 1; margin-bottom: var(--sp-2); }
.step h3 { font-size: clamp(26px, 3vw, 36px); margin-bottom: var(--sp-3); }
.step p { font-size: 17px; color: var(--ink-soft); margin-bottom: 14px; max-width: 520px; }
.step-links { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.step-links a { font-weight: 700; font-size: 15px; border-bottom: 2px solid var(--pink); padding-bottom: 1px; }
.step-links a:hover { color: var(--pink-d); }
.step-shot { display: flex; justify-content: center; }
.shot {
  width: min(260px, 78%); border: var(--stroke) solid var(--line); border-radius: 28px;
  overflow: hidden; background: var(--card); box-shadow: var(--shadow-3); transform: rotate(-1.5deg);
}
.step:nth-child(even) .shot { transform: rotate(1.5deg); }
.shot img { width: 100%; height: auto; }

/* Features: a two-column list, no cards */
.features { background: var(--paper-2); border-top: var(--stroke) solid var(--line); border-bottom: var(--stroke) solid var(--line); }
.feat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-8); margin-top: var(--sp-6); }
.feat { display: grid; grid-template-columns: 44px 1fr; gap: var(--sp-3); padding: var(--sp-5) 0; border-bottom: 2px solid var(--line-soft); align-items: start; }
.feat .num { font-size: 20px; padding-top: 4px; }
.feat h3 { font-size: 21px; margin-bottom: 6px; }
.feat p { font-size: 15px; color: var(--ink-soft); margin-bottom: var(--sp-2); }
.feat .more { display: inline-block; font-weight: 700; font-size: 14px; border-bottom: 2px solid var(--pink); }
.feat .more:hover { color: var(--pink-d); }

/* Founder */
.founder { max-width: 640px; margin: var(--sp-6) auto 0; padding: 30px 34px; border: var(--stroke) solid var(--line); border-radius: var(--r-wonk2); background: var(--card); box-shadow: var(--shadow-2); }
.founder p { font-size: 17px; line-height: 1.6; margin-bottom: var(--sp-3); }
.founder .sig { font-size: 15px; font-weight: 600; color: var(--ink-mute); margin: 0; }

/* Comparison */
.cmp { max-width: 900px; margin: var(--sp-6) auto 0; border: var(--stroke) solid var(--line); border-radius: 18px; overflow: hidden; background: var(--card); box-shadow: var(--shadow-2); }
.cmp-row { display: grid; grid-template-columns: .7fr 1.15fr 1.3fr; border-bottom: 2px solid var(--line-soft); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row > div { padding: 15px 20px; font-size: 15px; }
.cmp-row .lbl { font-weight: 700; }
.cmp-row .them { color: var(--ink-soft); }
.cmp-row .us { font-weight: 600; background: var(--pink-soft); border-inline-start: 2px solid var(--line); }
.cmp-head { border-bottom: var(--stroke) solid var(--line); }
.cmp-head > div { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.cmp-head .them { color: var(--ink); }
.cmp-head .us { background: var(--pink-d); color: #fff; }
.cmp-row > div::before { display: none; content: attr(data-col); font-weight: 700; color: var(--ink-mute); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

/* FAQ */
.faq { max-width: 800px; margin: var(--sp-6) auto 0; }
.faq details { border: var(--stroke) solid var(--line); border-radius: var(--r-md); background: var(--card); margin-bottom: var(--sp-3); box-shadow: var(--shadow-1); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; font-weight: 700; font-size: 17px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { flex: 0 0 auto; width: 26px; height: 26px; color: var(--pink-d); transition: transform var(--t-fast) ease; }
.faq details[open] summary .plus { transform: rotate(45deg); }
.faq .answer { padding: 0 20px 20px; font-size: 16px; color: var(--ink-soft); }

/* CTA: one puppet standing on the hill */
.cta { max-width: 860px; margin: 0 auto; padding: 56px 40px 150px; border: var(--stroke) solid var(--line); border-radius: var(--r-wonk); background: var(--sky); box-shadow: var(--shadow-3); text-align: center; position: relative; overflow: hidden; }
.cta-hill { position: absolute; left: -10%; right: -10%; bottom: -70px; height: 170px; background: var(--grass); border-radius: 50% 50% 0 0 / 100% 100% 0 0; border-top: var(--stroke) solid var(--line); }
.cta-puppet { position: absolute; left: 50%; bottom: 58px; width: 88px; height: 88px; transform: translateX(-50%); object-fit: contain; filter: var(--drop); }
.cta > *:not(.cta-hill):not(.cta-puppet) { position: relative; z-index: 1; }
.cta h2 { font-size: clamp(30px, 4.2vw, 50px); margin-bottom: 14px; }
.cta p { font-size: 18px; color: var(--ink-soft); max-width: 560px; margin: 0 auto 26px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
.cta-note { margin-top: 18px; font-size: 15px; font-weight: 600; color: var(--ink-soft); }

/* Read more */
.more-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px auto 0; max-width: 760px; }
.more-list a { padding: 10px 16px; border: 2px solid var(--line); border-radius: var(--r-pill); background: var(--card); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-1); }
.more-list a:hover { background: var(--pink-soft); }

/* Footer */
body > footer { padding: 56px 0 36px; border-top: var(--stroke) solid var(--line); background: var(--card); }
.foot-inner { display: grid; grid-template-columns: 240px 1fr; gap: var(--sp-7); margin-bottom: var(--sp-6); }
.foot-brand p { font-size: 14px; color: var(--ink-mute); margin-top: var(--sp-3); max-width: 220px; }
.foot-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-5); }
.foot-links h4 { font-family: var(--font-body); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.foot-links a { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; }
.foot-links a:hover { color: var(--pink-d); }
.foot-bottom { border-top: 2px solid var(--line-soft); padding-top: 20px; font-size: 13px; color: var(--ink-mute); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); }

/* Without JavaScript the demo shows sentence 1 statically: hide the dead controls */
.no-js .demo-actions, .no-js .demo-count { display: none; }

/* Reveal on scroll */
.js .rv { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .7s var(--ease-out); }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .rv { opacity: 1; transform: none; transition: none; }
  .tok .d, .demo-meaning, .btn, .tok { transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; grid-template-areas: "title" "demo" "copy"; gap: var(--sp-5); }
  .hero h1 { font-size: clamp(36px, 8vw, 48px); }
  .demo-arrow { display: none; }
  .feat-list { grid-template-columns: 1fr; }
  .foot-inner { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  section { padding: var(--sp-8) 0; }
  .hero { padding: var(--sp-6) 0 var(--sp-5); }
  .hero h1 { margin-top: 14px; }
  .nav-links { display: none; }
  .nav-right .btn-primary { display: none; }
  .menu-toggle { display: inline-flex; }
  .mobile-menu { display: block; border-top: 2px solid var(--line-soft); }
  .mobile-menu a { display: block; padding: 12px var(--sp-5); font-weight: 600; border-bottom: 1px solid var(--line-soft); }
  .demo-card { padding: var(--sp-4) var(--sp-4) 14px; }
  .turn img { width: 48px; height: 48px; }
  .step { grid-template-columns: 1fr; gap: var(--sp-5); }
  .step .step-shot, .step:nth-child(even) .step-shot { order: -1; }
  .cmp-head { display: none; }
  .cmp-row { grid-template-columns: 1fr; border-bottom: var(--stroke) solid var(--line); }
  .cmp-row > div { padding: 12px 16px; }
  .cmp-row .lbl { border-bottom: 1px solid var(--line-soft); }
  .cmp-row .lbl { padding-bottom: 4px; font-size: 16px; }
  .cmp-row .them, .cmp-row .us { border-inline-start: 0; }
  .cmp-row .them::before, .cmp-row .us::before { display: block; }
  .cmp-row .us::before { color: var(--pink-d); }
  .cta { padding: 40px 22px 150px; }
  .founder { padding: 22px 20px; }
  .btn-lg { width: 100%; }
}
