/* ============================================================
   Word Waypoint — site stylesheet
   "Paper Pastel" tokens ported from design/design-system.html
   No JS, no third-party requests: fonts are self-hosted (OFL).
   ============================================================ */

@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito_700Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito_900Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* paper */
  --paper: #FBF7EF;
  --paper-deep: #F3EBDD;
  --card: #FFFEFA;
  --line: #E5DCCC;

  /* ink */
  --ink: #40382F;
  --ink-soft: #6E6355;
  --ink-faint: #A79B8C;

  /* rule families */
  --meaning: #AECBEB;  --meaning-deep: #5B87B5;  --meaning-tint: #EAF2FA;
  --sound: #F6BFCB;    --sound-deep: #C96F86;    --sound-tint: #FDF0F3;
  --spelling: #BFE3C8; --spelling-deep: #5FA274; --spelling-tint: #EFF8F1;
  --compound: #D8C7F0; --compound-deep: #8F72BE; --compound-tint: #F5F0FC;

  /* semantic */
  --success: #86C79B; --success-deep: #3E8E5C; --success-tint: #E9F6EE;
  --error: #EF9A94;   --error-deep: #C4554D;   --error-tint: #FDEEEC;
  --gold: #F5C95C;    --gold-deep: #C89A2B;    --gold-tint: #FCF3DC;

  /* shape */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  /* elevation */
  --shadow-card: 0 1px 2px rgba(64,56,47,.08), 0 3px 8px rgba(64,56,47,.10);
  --shadow-lift: 0 6px 14px rgba(64,56,47,.16), 0 2px 4px rgba(64,56,47,.10);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.06'/></feComponentTransfer></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}

/* ============================================================ base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  position: relative;
  line-height: 1.6;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  background-size: 140px;
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}
header, main, footer { position: relative; z-index: 1; }

a { color: var(--meaning-deep); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--meaning-deep); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); font-weight: 900;
  padding: 10px 18px; border-radius: var(--r-md); text-decoration: none;
  transition: top 150ms ease;
}
.skip-link:focus { top: 16px; color: var(--paper); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.hand { font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif; font-weight: 700; }

/* ============================================================ header */
.site-header { padding: 20px 0; }
.site-header .wrap {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink); margin-right: auto;
}
/* Brand lockup — markup, not an image, so it localizes. Each language uses
   different words joined by a different rule; see site/lockup.ts. */
.lockup { display: inline-flex; align-items: center; gap: 6px; }
.lockup-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-card);
  padding: 7px 10px; font-size: 13px; font-weight: 900; letter-spacing: .06em;
  line-height: 1; white-space: nowrap;
}
.lockup-chip {
  font-size: 8.5px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 7px; border-radius: var(--r-pill); border: 1.5px solid;
  line-height: 1; white-space: nowrap;
}
.brand b { font-size: 19px; font-weight: 900; letter-spacing: -.01em; }
.site-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a {
  font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none;
  padding: 8px 14px; border-radius: var(--r-pill); border: 1.5px solid transparent;
}
.site-nav a:hover { background: var(--card); border-color: var(--line); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--card); border-color: var(--line); color: var(--ink); }

/* ============================================================ hero */
.hero { padding: 56px 0 24px; text-align: center; }
.hero .kicker { font-size: 19px; color: var(--ink-soft); }
.hero h1 { font-size: clamp(38px, 7vw, 58px); font-weight: 900; letter-spacing: -.015em; margin: 4px 0 12px; }
.hero .descriptor {
  font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 14px;
}
.hero .lede {
  font-size: 17px; color: var(--ink-soft); max-width: 560px;
  margin: 0 auto 8px; line-height: 1.55;
}
.family-strip {
  display: flex; margin: 22px auto 0; border-radius: var(--r-pill);
  overflow: hidden; width: fit-content; box-shadow: var(--shadow-card);
}
.family-strip i { display: block; width: 52px; height: 12px; }

/* store buttons */
.store-row {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 30px 0 6px;
}
.store-btn {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
  min-width: 190px; padding: 11px 22px 12px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-lg); border: 1.5px solid var(--ink);
  text-decoration: none; text-align: left; box-shadow: var(--shadow-card);
}
.store-btn small { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.store-btn span { font-size: 17px; font-weight: 900; }
.store-btn.soon {
  background: var(--card); color: var(--ink-faint); border-color: var(--line);
  box-shadow: none; cursor: default;
}
.store-btn.soon .badge-soon {
  font-weight: 700; font-size: 12px;
  color: var(--gold-deep);
}
.store-note { font-weight: 700; font-size: 14px; color: var(--ink-faint); }

/* ============================================================ chain demo */
.chain-demo {
  margin: 44px auto 8px; padding: 30px 22px 26px;
  background: var(--paper-deep); border: 1.5px solid var(--line);
  border-radius: var(--r-xl); max-width: 720px;
}
.chain {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap;
}
.word-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
  padding: 13px 20px; font-size: 17px; font-weight: 900; letter-spacing: .06em;
}
.word-card.goal { border-color: var(--gold-deep); background: var(--gold-tint); }
.link { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 84px; }
.link .arrow { color: var(--ink-faint); font-size: 15px; line-height: 1; }
.chip {
  font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 11px; border-radius: var(--r-pill); border: 1.5px solid;
}
.chip.meaning, .lockup-chip.meaning { background: var(--meaning-tint); border-color: var(--meaning); color: var(--meaning-deep); }
.chip.sound, .lockup-chip.sound { background: var(--sound-tint); border-color: var(--sound); color: var(--sound-deep); }
.chip.spelling, .lockup-chip.spelling { background: var(--spelling-tint); border-color: var(--spelling); color: var(--spelling-deep); }
.chip.compound, .lockup-chip.compound { background: var(--compound-tint); border-color: var(--compound); color: var(--compound-deep); }
.chain-cap { text-align: center; margin-top: 16px; font-weight: 700; font-size: 15px; color: var(--ink-soft); }

/* ============================================================ sections */
section.block { padding: 44px 0 8px; }
section.block > .wrap > h2 { font-size: 29px; font-weight: 900; margin-bottom: 6px; }
.snum { font-weight: 700; font-size: 17px; color: var(--gold-deep); display: block; }
section.block .lede { font-size: 15px; color: var(--ink-soft); max-width: 640px; margin-bottom: 26px; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card-box {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 20px 22px;
}
.card-box h3 { font-size: 16px; font-weight: 900; margin-bottom: 6px; }
.card-box p { font-size: 14px; color: var(--ink-soft); }
.card-box .tag {
  display: inline-block; margin-bottom: 10px;
  font-size: 10.5px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 11px; border-radius: var(--r-pill); border: 1.5px solid var(--line);
  background: var(--paper-deep); color: var(--ink-soft);
}
.card-box.tint-meaning { background: var(--meaning-tint); }
.card-box.tint-sound { background: var(--sound-tint); }
.card-box.tint-spelling { background: var(--spelling-tint); }
.card-box.tint-compound { background: var(--compound-tint); }
.card-box.tint-gold { background: var(--gold-tint); border-color: var(--gold); }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin: 6px 0 10px; }
.stat {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 16px 26px; text-align: center; min-width: 148px;
}
.stat b { display: block; font-size: 30px; font-weight: 900; }
.stat span { font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.stat .hand { display: block; font-size: 12px; color: var(--ink-faint); }

ul.ticks { list-style: none; }
ul.ticks li { padding: 5px 0 5px 30px; position: relative; font-size: 14.5px; color: var(--ink-soft); }
ul.ticks li::before {
  content: "✓"; position: absolute; left: 4px; top: 4px;
  color: var(--success-deep); font-weight: 900;
}

/* ============================================================ footer */
.site-footer {
  margin-top: 72px; border-top: 1.5px solid var(--line);
  background: var(--paper-deep); padding: 40px 0 48px;
}
.site-footer .cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
}
.site-footer h4 {
  font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 10px;
}
.site-footer p, .site-footer li { font-size: 13px; color: var(--ink-soft); }
.site-footer ul { list-style: none; }
.site-footer li { padding: 3px 0; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--ink); }
.site-footer .fineprint {
  margin-top: 30px; padding-top: 18px; border-top: 1.5px dashed var(--line);
  font-size: 12px; color: var(--ink-faint); text-align: center;
}

/* ============================================================ legal / article pages */
.page-head { padding: 44px 0 10px; }
.page-head .kicker { font-weight: 700; font-size: 18px; color: var(--ink-soft); }
.page-head h1 { font-size: clamp(30px, 5vw, 40px); font-weight: 900; letter-spacing: -.01em; margin: 2px 0 8px; }
.page-head .meta { font-size: 13px; color: var(--ink-faint); font-weight: 700; }

article.legal { max-width: 760px; padding: 8px 0 40px; }
article.legal .summary-box {
  background: var(--spelling-tint); border: 1.5px solid var(--spelling);
  border-radius: var(--r-lg); padding: 20px 24px; margin: 22px 0 10px;
}
article.legal .summary-box h2 { margin-top: 0; }
article.legal h2 {
  font-size: 21px; font-weight: 900; margin: 40px 0 10px;
  padding-top: 10px;
}
article.legal h3 { font-size: 16px; font-weight: 900; margin: 26px 0 8px; }
article.legal p { font-size: 15px; color: var(--ink-soft); margin: 10px 0; }
article.legal li { font-size: 15px; color: var(--ink-soft); margin: 6px 0; }
article.legal ul, article.legal ol { padding-left: 26px; margin: 10px 0; }
article.legal strong { color: var(--ink); }
article.legal code {
  font-family: ui-monospace, 'Cascadia Code', Menlo, monospace;
  font-size: 13px; background: var(--paper-deep); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px;
}
article.legal table {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13.5px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-md);
  overflow: hidden;
}
article.legal th {
  text-align: left; font-size: 11px; font-weight: 900; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft);
  background: var(--paper-deep); padding: 10px 14px; border-bottom: 1.5px solid var(--line);
}
article.legal td {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink-soft); vertical-align: top;
}
article.legal tr:last-child td { border-bottom: 0; }
article.legal .toc {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 18px 24px; margin: 24px 0;
}
article.legal .toc h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
article.legal .toc ol { margin: 0; padding-left: 22px; }
article.legal .toc li { margin: 3px 0; font-size: 14px; }
article.legal .toc a { text-decoration: none; }
article.legal .toc a:hover { text-decoration: underline; }
article.legal .note {
  background: var(--gold-tint); border: 1.5px solid var(--gold);
  border-radius: var(--r-md); padding: 14px 18px; margin: 16px 0;
  font-size: 14px; color: var(--ink-soft);
}
article.legal .contact-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 18px 24px; margin: 18px 0;
  font-size: 14.5px; color: var(--ink-soft);
}
article.legal .contact-card b { color: var(--ink); }

/* FAQ (support page) */
details.faq {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  margin: 12px 0; overflow: hidden;
}
details.faq summary {
  cursor: pointer; padding: 15px 20px; font-size: 15px; font-weight: 900;
  list-style: none; display: flex; align-items: center; gap: 10px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before {
  content: "+"; font-size: 19px; font-weight: 900; color: var(--gold-deep);
  width: 20px; flex: none; text-align: center;
}
details.faq[open] summary::before { content: "–"; }
details.faq .a { padding: 0 20px 16px 50px; }
details.faq .a p, details.faq .a li { font-size: 14.5px; color: var(--ink-soft); margin: 6px 0; }
details.faq .a ul, details.faq .a ol { padding-left: 22px; }

/* 404 */
.lost { text-align: center; padding: 90px 24px 60px; }
.lost .big { font-size: 88px; font-weight: 900; letter-spacing: .02em; color: var(--ink); line-height: 1; }
.lost p { color: var(--ink-soft); margin: 14px 0 26px; }
.btn {
  display: inline-block; background: var(--ink); color: var(--paper);
  font-weight: 900; font-size: 15px; text-decoration: none;
  padding: 12px 26px; border-radius: var(--r-pill); box-shadow: var(--shadow-card);
}
.btn:hover { color: var(--paper); box-shadow: var(--shadow-lift); }

@media (max-width: 560px) {
  .hero { padding-top: 36px; }
  .chain { gap: 6px; }
  .link { min-width: 64px; }
  .word-card { padding: 10px 14px; font-size: 15px; }
  .site-header .wrap { justify-content: center; }
  .brand { margin-right: 0; }
}

/* ============================================================ language picker */
.site-footer .langs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px;
}
.site-footer .langs a[aria-current="true"] { color: var(--ink); text-decoration: underline; }

/* ============================================================ script handling
   The app removed textTransform outright (commit 40559f3) because uppercase is
   locale-sensitive: Turkish needs the dotted I, and Japanese and Korean have no
   case at all, so uppercasing is meaningless and letter-spacing hurts legibility.
   CSS text-transform is only locale-aware when the lang attribute is set, which
   <html lang="tr-TR"> provides. For CJK we turn both off. */
html[lang^="ja"], html[lang^="ko"] {
  --cjk: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP',
         'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}
html[lang^="ja"] body, html[lang^="ko"] body,
html[lang^="ja"] .hand, html[lang^="ko"] .hand {
  font-family: 'Nunito', var(--cjk), 'Segoe UI', system-ui, -apple-system, sans-serif;
}
html[lang^="ja"] .site-nav a, html[lang^="ko"] .site-nav a,
html[lang^="ja"] .hero .descriptor, html[lang^="ko"] .hero .descriptor,
html[lang^="ja"] .store-btn small, html[lang^="ko"] .store-btn small,
html[lang^="ja"] .chip, html[lang^="ko"] .chip,
html[lang^="ja"] .lockup-chip, html[lang^="ko"] .lockup-chip,
html[lang^="ja"] .lockup-card, html[lang^="ko"] .lockup-card,
html[lang^="ja"] .card-box .tag, html[lang^="ko"] .card-box .tag,
html[lang^="ja"] .stat span, html[lang^="ko"] .stat span,
html[lang^="ja"] .site-footer h4, html[lang^="ko"] .site-footer h4,
html[lang^="ja"] .word-card, html[lang^="ko"] .word-card,
html[lang^="ja"] .page-head .kicker, html[lang^="ko"] .page-head .kicker,
html[lang^="ja"] article.legal .toc h2, html[lang^="ko"] article.legal .toc h2 {
  text-transform: none;
  letter-spacing: normal;
}
