/* lil babel landing site. Colours are the App's green-grey tokens with the vermilion mark (D026, D040, docs/03-DESIGN.md). */
:root {
  --paper: #f7f7f4;
  --surface: #edefeb;
  --card: #ffffff;
  --ink: #24392f;
  --muted: #5f6b63;
  --accent: #3e7350;
  --on-accent: #f7f7f4;
  --mark: #cc3c27;
  --rule: rgba(36, 57, 47, 0.12);
  --forest-a: #2e5841;
  --forest-b: #1c3428;
  --forest-ink: #f1f3ee;
  --shadow: 0 18px 40px rgba(28, 52, 40, 0.12);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Noto Sans SC", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191d1b;
    --surface: #252b28;
    --card: #2e3531;
    --ink: #f1f3ee;
    --muted: #b7bfb9;
    --accent: #b4d2a0;
    --on-accent: #191d1b;
    --mark: #f47a5e;
    --rule: rgba(241, 243, 238, 0.12);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  }
}
:lang(zh-Hant) {
  --serif: ui-serif, "Iowan Old Style", Georgia, "Songti TC", "Noto Serif TC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}
:lang(ja) {
  --serif: ui-serif, "Iowan Old Style", Georgia, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; line-break: strict; }
p { text-wrap: pretty; }

/* ---------- Header & footer ---------- */
.site-header, main, .site-footer { width: min(1120px, 100%); margin: 0 auto; padding-inline: 24px; }
.site-header {
  display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
  padding-top: 28px; padding-bottom: 8px;
}
.brand { text-decoration: none; color: var(--ink); margin-right: auto; }
.wordmark { font: 600 26px/1 var(--serif); letter-spacing: -0.01em; color: var(--ink); }
.wordmark .dot { color: var(--mark); }
.site-header nav { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-header nav a:hover { color: var(--ink); }

/* Language menu: one button (globe, current language) opening a short list. */
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule); background: var(--card);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { box-shadow: 0 0 0 1px var(--accent); }
.lang-menu .chevron { width: 14px; height: 14px; color: var(--muted); transition: transform 0.2s; }
.lang-menu[open] .chevron { transform: rotate(180deg); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 168px;
  list-style: none; margin: 0; padding: 6px; border-radius: 16px; background: var(--card);
  box-shadow: 0 0 0 1px var(--rule), var(--shadow);
}
.lang-menu li a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px;
}
.lang-menu li a:hover { background: var(--surface); }
.lang-menu li a[aria-current="page"]::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Language suggestion: opens above the header, pushing the page down, in the visitor's own language (site.js). */
.lang-suggest {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease;
  background: linear-gradient(135deg, var(--forest-a), var(--forest-b)); color: var(--forest-ink);
}
.lang-suggest.shown { grid-template-rows: 1fr; }
.lang-suggest .clip { overflow: hidden; min-height: 0; }
.lang-suggest .clip > div {
  width: min(1120px, 100%); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap;
}
.lang-suggest p { margin: 0; font-size: 15px; }
.lang-suggest .actions { display: flex; gap: 10px; }
.lang-suggest .switch, .lang-suggest button {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: 999px;
  font: 600 14px/1 var(--sans); cursor: pointer;
}
.lang-suggest .switch { background: var(--forest-ink); color: var(--forest-b); text-decoration: none; }
.lang-suggest button { background: transparent; color: inherit; border: 1px solid rgba(241, 243, 238, 0.4); }
.lang-suggest button:hover { background: rgba(241, 243, 238, 0.1); }

.site-footer {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 32px; align-items: end;
  margin-top: 96px; padding-top: 32px; padding-bottom: 48px;
  border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px;
}
.footer-brand p { margin: 8px 0 0; font-family: var(--serif); font-style: italic; }
.footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: flex-end; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.rights { grid-column: 1 / -1; margin: 12px 0 0; font-size: 13px; }

/* ---------- Shared pieces ---------- */
.eyebrow { margin: 0 0 18px; font-size: 14px; letter-spacing: 0.04em; color: var(--muted); }
.cta {
  /* An outline until the App is on the store (it shows the "coming soon" toast); filled once live. */
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 26px;
  border-radius: 999px; border: 1.5px solid var(--accent); color: var(--accent); background: transparent;
  font: 600 16px/1 var(--sans); cursor: pointer; text-decoration: none;
}
.cta:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cta.live { background: var(--accent); color: var(--on-accent); }
.download {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border: none; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: 600 14px/1 var(--sans); cursor: pointer; text-decoration: none;
}
.download:hover { filter: brightness(1.08); }
.toast {
  /* Placed next to the clicked button by site.js. */
  position: fixed; top: 0; left: 0; z-index: 60;
  width: max-content; max-width: min(380px, calc(100% - 32px)); padding: 12px 20px; border-radius: 16px;
  background: var(--ink); color: var(--paper); font-size: 15px; line-height: 1.5; text-align: center; white-space: pre-line;
  box-shadow: var(--shadow); pointer-events: none;
  opacity: 0; transform: translateY(-4px); transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast:empty { display: none; }
.toast.show { opacity: 1; transform: none; }
.download:active, .cta:active { transform: scale(0.97); }
.section-note { color: var(--muted); font-size: 15px; margin-top: -4px; }
.phone {
  margin: 0; width: min(300px, 64vw); aspect-ratio: 390 / 848;
  border-radius: 13% / 6%; overflow: hidden; flex: none;
  box-shadow: 0 0 0 1px var(--rule), 0 0 0 9px var(--card), 0 0 0 10px var(--rule), var(--shadow);
  background: var(--card);
}
.phone img { width: 100%; height: 100%; object-fit: cover; }
.art {
  display: block; background: var(--ink);
  -webkit-mask: var(--art) center / contain no-repeat; mask: var(--art) center / contain no-repeat;
}
.tower path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.js .reveal .tower path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.reveal.in .tower path { animation: draw 2.4s cubic-bezier(0.45, 0, 0.2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* Only hidden when the script that reveals them is running. */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 48px; align-items: center;
  padding: 72px 0 96px;
}
.hero h1 { font-size: clamp(30px, 4.4vw, 56px); line-height: 1.16; margin: 0; }
/* CJK lines have no spaces to wrap at: sized so each half of the slogan fits its line. */
:lang(zh) .hero h1 { font-size: clamp(28px, 3.9vw, 48px); }
:lang(ja) .hero h1 { font-size: clamp(24px, 3.3vw, 40px); }
.hero h1 span { display: block; }
.story { font-family: var(--serif); font-style: italic; font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); margin: 24px 0 36px; max-width: 34em; }
.cta-row { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.more { color: var(--ink); text-decoration: none; font-size: 15px; }
.more:hover { color: var(--accent); }
.cta-note { margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 560px; }
.hero-visual::before {
  content: ""; position: absolute; width: min(480px, 100%); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%);
}
.hero-phone { width: min(320px, 64vw); position: relative; z-index: 1; }
.ticker {
  overflow: hidden; margin: 0 0 96px; padding: 8px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.ticker-track { display: flex; gap: 44px; width: max-content; animation: ticker 70s linear infinite; }
.ticker span { font-family: var(--serif); font-size: 24px; color: var(--muted); white-space: nowrap; }
@keyframes ticker { to { transform: translateX(calc(-50% - 22px)); } }

/* ---------- Mission ---------- */
.mission {
  display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 48px; align-items: center;
  padding: 64px; border-radius: 32px; color: var(--forest-ink);
  background: linear-gradient(135deg, var(--forest-a), var(--forest-b));
}
.mission-tower { width: 140px; height: auto; justify-self: center; color: rgba(241, 243, 238, 0.85); }
.mission h2 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.25; margin: 0 0 20px; }
.mission p { color: rgba(241, 243, 238, 0.82); margin: 0 0 12px; max-width: 38em; }
.mission .quote { margin-top: 28px; color: var(--forest-ink); font-family: var(--serif); font-style: italic; font-size: 20px; }
.mission .quote::before { content: ""; display: block; width: 40px; height: 1px; background: rgba(241, 243, 238, 0.4); margin-bottom: 16px; }

/* ---------- Gallery ---------- */
.gallery { padding-top: 120px; }
.gallery h2, .pricing h2 { font-size: clamp(26px, 3vw, 38px); margin: 0 0 12px; }
.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 36px; }
.word-card { background: var(--card); border-radius: 22px; padding: 22px 22px 18px; box-shadow: 0 0 0 1px var(--rule); }
.word-card .art { aspect-ratio: 4 / 3; margin: 0 0 14px; }
.word-card h3 { font-size: 26px; margin: 0; line-height: 1.2; }
.word-meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.word-meta .sound { color: var(--mark); }
.word-card p:last-child { margin: 0; font-size: 15px; line-height: 1.6; }

/* ---------- Features ---------- */
.feature {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 64px; align-items: center;
  padding: 120px 48px 0;
}
.feature.flip { grid-template-columns: auto minmax(0, 1fr); }
.feature.flip .feature-text { order: 2; }
.feature h2 { font-size: clamp(26px, 3vw, 40px); line-height: 1.2; margin: 0 0 16px; }
.feature p { color: var(--muted); font-size: 18px; max-width: 26em; margin: 0; }

/* ---------- Widgets & languages ---------- */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding-top: 140px; }
.duo-card { background: var(--surface); border-radius: 28px; padding: 40px; display: flex; flex-direction: column; overflow: hidden; }
.duo-card h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.25; margin: 0 0 12px; }
.duo-card > p { color: var(--muted); margin: 0 0 28px; }
.wallpaper {
  flex: 1; display: grid; place-items: center; padding: 28px 22px 18px; border-radius: 22px;
  background: linear-gradient(160deg, #cfe0c6, #8fb59a 55%, #4f7d5f);
}
.widgets { width: 100%; display: grid; grid-template-columns: 2.14fr 1fr; gap: 14px; }
.widget {
  border-radius: 22px; padding: 14px; background: #f7f7f4; color: #24392f;
  box-shadow: 0 10px 24px rgba(28, 52, 40, 0.12); display: flex; gap: 12px; min-width: 0; aspect-ratio: 338 / 158;
}
.widget.small { aspect-ratio: 1; flex-direction: column; justify-content: center; gap: 6px; background: #191d1b; color: #f1f3ee; }
.widget .art { width: 42%; flex: none; background: #24392f; }
.widget div { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.widget strong { font-family: var(--serif); font-weight: 500; font-size: clamp(18px, 2vw, 24px); line-height: 1.1; }
.widget span { font-size: 12px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.widget-labels { grid-column: 1 / -1; display: grid; grid-template-columns: 2.14fr 1fr; gap: 14px; margin: 0; font-size: 12px; color: #f7f7f4; text-align: center; }
.lang-chips { list-style: none; padding: 0; margin: 0 0 32px; display: flex; flex-wrap: wrap; gap: 8px; }
.lang-chips li { padding: 6px 14px; border-radius: 999px; background: var(--card); font-size: 15px; box-shadow: 0 0 0 1px var(--rule); }
.small-phone { width: min(220px, 52vw); margin: auto auto -120px; }

/* ---------- Pricing ---------- */
.pricing { padding-top: 140px; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 36px 0 20px; }
.plan { background: var(--card); border-radius: 24px; padding: 32px; box-shadow: 0 0 0 1px var(--rule); }
.plan.unlock { box-shadow: 0 0 0 2px var(--accent); }
.plan h3 { font-size: 24px; margin: 0 0 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.price { font-family: var(--sans); font-size: 16px; font-weight: 600; color: var(--accent); }
.plan ul { list-style: none; padding: 0; margin: 0; }
.plan li { padding: 10px 0 10px 28px; border-top: 1px solid var(--rule); position: relative; }
.plan li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 10px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

/* ---------- Closing ---------- */
.closing { text-align: center; padding-top: 140px; display: flex; flex-direction: column; align-items: center; }
.closing-tower { width: 64px; height: auto; color: var(--ink); }
.closing h2 { font-size: clamp(28px, 3.4vw, 44px); margin: 24px 0 8px; }
.closing p { color: var(--muted); margin: 0 0 28px; }

/* ---------- Legal & 404 ---------- */
.legal, .not-found { max-width: 760px; }
.legal h1, .not-found h1 { font-size: clamp(32px, 5vw, 48px); margin: 56px 0 8px; }
.legal .meta { color: var(--muted); font-size: 14px; }
.legal .legal-body { border-top: 1px solid var(--rule); margin-top: 32px; padding-top: 8px; }
.legal h2 { font-size: 24px; margin: 32px 0 8px; }
.legal h3 { font-size: 18px; margin: 24px 0 4px; }
.legal ul { padding-left: 22px; }
.not-found { text-align: center; padding-top: 48px; }
.not-found p { color: var(--muted); margin: 6px 0; }

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0 72px; gap: 40px; }
  .hero-visual { min-height: 0; }
  .mission { grid-template-columns: 1fr; padding: 40px 28px; gap: 28px; }
  .mission-tower { width: 96px; }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 36px; padding: 96px 0 0; justify-items: center; }
  .feature.flip .feature-text { order: 0; }
  .feature-text { width: 100%; }
  .duo, .plans { grid-template-columns: 1fr; }
  .duo { padding-top: 104px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header, main, .site-footer { padding-inline: 16px; }
  .site-header { padding-top: 20px; }
  .site-header { flex-wrap: nowrap; gap: 10px; }
  /* Privacy and Support stay in the footer; the header keeps the name, Download and the language menu. */
  .site-header .links { display: none; }
  .lang-menu summary { padding: 0 10px; }
  .lang-menu summary span { display: none; }
  .lang-suggest .clip > div { padding: 12px 16px; }
  .word-grid { grid-template-columns: 1fr; gap: 12px; }
  .widget { padding: 10px; border-radius: 16px; gap: 8px; }
  .widget strong { font-size: 16px; }
  .widget span { font-size: 10px; -webkit-line-clamp: 3; }
  /* One column: drawing beside the words, so six cards stay a short scroll. */
  .word-card { display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 16px; align-items: center; padding: 14px 16px; }
  .word-card .art { grid-row: 1 / span 3; margin: 0; aspect-ratio: 1; }
  .word-card h3 { font-size: 22px; }
  .word-meta { margin: 2px 0 6px; }
  .duo-card { padding: 28px 20px; }
  .plan { padding: 24px 20px; }
  .site-footer { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .gallery, .pricing, .closing { padding-top: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal, .js .reveal.in { opacity: 1; transform: none; transition: none; }
  .js .reveal .tower path, .js .reveal.in .tower path { animation: none; stroke-dashoffset: 0; }
  .ticker-track { animation: none; }
  .lang-suggest, .toast { transition: none; }
}
