/* Palette mirrors constants/colors.ts in the app. */
:root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --amber-300: #fcd34d;

  --bg: var(--slate-900);
  --surface: var(--slate-800);
  --border: var(--slate-700);
  --text: var(--slate-200);
  --muted: var(--slate-400);
  --accent: var(--emerald-400);
  --heading: #fff;
  --lede: var(--slate-300);
  --link: var(--sky-400);
  --link-hover: var(--slate-200);
  --footer-link: var(--slate-400);
  --button-bg: var(--emerald-400);
  --button-text: var(--slate-900);
  --icon-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --font-head: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; overscroll-behavior: none; }

html.light {
  color-scheme: light;
  --bg: #fff;
  --surface: #f8fafc;
  --border: var(--slate-200);
  --text: var(--slate-700);
  --muted: var(--slate-500);
  --accent: #047857;
  --heading: var(--slate-900);
  --lede: var(--slate-600);
  --link: #0369a1;
  --link-hover: var(--slate-900);
  --footer-link: var(--slate-500);
  --button-bg: #047857;
  --button-text: #fff;
  --icon-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) 16px 48px;
}

/* Language picker: both flags always visible, the active one greyed out. */
.lang-picker {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: calc(-1 * clamp(24px, 5vw, 64px)) 0 clamp(16px, 4vw, 40px);
}

.lang-btn {
  display: inline-flex;
  padding: 4px;
  margin: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  line-height: 0;
  transition: transform 120ms ease, opacity 120ms ease, filter 120ms ease;
}
.lang-btn img {
  display: block;
  width: 45px;
  height: 30px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.lang-btn:hover,
.lang-btn:focus-visible { transform: translateY(-1px); border-color: var(--border); }
.lang-btn:focus-visible { outline: 2px solid var(--sky-400); outline-offset: 2px; }
.lang-btn[aria-pressed="true"] {
  cursor: default;
  opacity: 0.5;
  filter: grayscale(1);
  transform: none;
  border-color: transparent;
}

/* Hero */
.hero { text-align: center; }

.app-icon {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  border: 1px solid var(--border);
  box-shadow: var(--icon-shadow);
}

.tagline {
  font-family: var(--font-head);
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 700;
  color: var(--heading);
  margin: 28px 0 12px;
  line-height: 1.25;
}

.accent { color: var(--accent); }

.lede {
  max-width: 600px;
  margin: 0 auto;
  color: var(--lede);
  font-size: clamp(16px, 2.2vw, 19px);
}

/* Store badges: official artwork. Google's PNGs are cropped to the badge itself
   (the English and Thai downloads ship with different transparent padding), and
   both badges are sized by height so they sit equal, per Google's guideline. */
.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 36px;
}

.store-badge {
  display: inline-flex;
  line-height: 0;
  border-radius: 8px;
  transition: transform 120ms ease, opacity 120ms ease;
}
.store-badge:hover,
.store-badge:focus-visible { transform: translateY(-1px); opacity: 0.9; }
/* 64px tall on wide screens; below ~470px the pair would wrap, so the height
   tracks the viewport (two badges plus gap and gutters) down to a 40px floor. */
.store-badge img { display: block; height: clamp(40px, calc((100vw - 48px) / 6.6), 64px); width: auto; }

/* Sections */
section { margin-top: clamp(56px, 10vw, 96px); }

h2 {
  font-family: var(--font-head);
  font-size: clamp(20px, 3vw, 26px);
  color: var(--heading);
  margin: 0 0 24px;
  text-align: center;
}

h3 { font-size: 18px; margin: 0 0 6px; color: var(--heading); }
p { margin: 0; }

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.feature {
  position: relative;
  padding: 22px 20px 22px 64px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.feature p { color: var(--muted); font-size: 15.5px; }

.step {
  position: absolute;
  left: 20px;
  top: 22px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  color: var(--slate-900);
  background: var(--accent);
}

/* Language pair cards */
.pair-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.pair-card {
  padding: 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 16px;
}
.pair-card p { color: var(--muted); }
.pair-card--sky { border-left-color: var(--sky-500); }
.pair-card--emerald { border-left-color: var(--emerald-500); }

.pair-flag {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin-bottom: 8px;
}
.pair-card--sky .pair-flag { color: var(--sky-400); }
.pair-card--emerald .pair-flag { color: var(--emerald-400); }

/* Footer */
.footer {
  margin-top: clamp(56px, 10vw, 96px);
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--slate-500);
  font-size: 14px;
}
.footer p + p { margin-top: 6px; }
.footer a { color: var(--footer-link); }
.footer a:hover { color: var(--link-hover); }
.dot { margin: 0 8px; }

h1 {
  font-family: var(--font-head);
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 12px;
}

.hero h1 { margin-top: 28px; }

.actions { margin-top: 32px; }

.button {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 600;
  text-decoration: none;
  transition: transform 120ms ease, opacity 120ms ease;
}
.button:hover,
.button:focus-visible { transform: translateY(-1px); opacity: 0.9; color: var(--button-text); }
.button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.page--doc {
  max-width: 720px;
  padding-top: clamp(28px, 5vw, 56px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(28px, 5vw, 44px);
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
}
.brand:hover { color: var(--heading); }
.brand img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  border: 1px solid var(--border);
}

.doc section { margin-top: 0; }
.doc section + section {
  margin-top: clamp(40px, 7vw, 64px);
  padding-top: clamp(40px, 7vw, 64px);
  border-top: 1px solid var(--border);
}
.doc h3 { font-size: 19px; margin: 32px 0 8px; }
.doc p,
.doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 22px; }
.doc li + li { margin-top: 8px; }
.doc strong { color: var(--heading); }
.doc .doc-meta { margin-bottom: 24px; color: var(--muted); font-size: 15px; }
.doc .actions { margin: 24px 0 0; }
.doc section:lang(th) { line-height: 1.75; }
.doc h1:lang(th) { font-family: var(--font-body); line-height: 1.4; }

/* Thai: the monospace heading stack has no Thai glyphs, so headings fall back
   to the body font, and stacked tone marks need more vertical room. */
body:lang(th),
.lede:lang(th),
.feature p:lang(th),
.pair-card p:lang(th) { line-height: 1.75; }
.tagline:lang(th),
h2:lang(th) { font-family: var(--font-body); font-weight: 700; }
.tagline:lang(th) { line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .store-badge,
  .lang-btn,
  .button { transition: none; }
}
