/* css/tokens.css */
/* Design tokens — see DESIGN.md. Nothing here is app-specific. */

:root {
  /* Colors */
  --color-fresh-grass: #8ed462;
  --color-cream-paper: #f5f1e4;
  --color-ink-black: #2c2e2a;
  --color-pure-white: #ffffff;
  --color-sandstone: #e0dbce;
  --color-stone-gray: #80827f;
  --color-hairline-mist: #d5d5d4;
  --color-sky-pop: #2ba0ff;
  --color-coral-pop: #ff705d;
  --color-sunshine-pop: #f5e211;

  /* Typography */
  --font-inter: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text-micro: 14px;
  --text-body-sm: 15px;
  --text-body: 17px;
  --text-body-lg: 18px;
  --text-subheading: 20px;

  /* Radius */
  --radius-small: 10px;
  --radius-mid: 20px;
  --radius-card: 32px;
  --radius-full: 50px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur-mid: 0.28s;

  /* Layers */
  --z-sheet: 40;
  --z-toast: 60;
}

/* css/base.css */
/* Reset, page canvas and shared primitives used by more than one component. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  font-family: var(--font-inter);
  background: var(--color-cream-paper);
  color: var(--color-ink-black);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* The app shell is exactly one viewport tall; the page scrolls only to reach
   the content below it, and stops being scrollable once cards are queued. */
body.is-compact { overflow: hidden; }

button, input { font-family: inherit; }
button { cursor: pointer; }

/* Components toggle visibility with the `hidden` attribute; flex/grid display
   would otherwise win over the UA rule. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--color-ink-black);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Shared primitives ---------- */

.scroll-y {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-sandstone) transparent;
}
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb {
  background: var(--color-sandstone);
  border-radius: var(--radius-full);
}

.scroll-x {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

.ghost-btn {
  padding: 6px 16px;
  border: 1px solid var(--color-hairline-mist);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-stone-gray);
  font-size: var(--text-body-sm);
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.ghost-btn:hover { border-color: var(--color-ink-black); color: var(--color-ink-black); }

.spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* css/components/nav.css */
/* Floating pill navigation. */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-pure-white);
  border-radius: var(--radius-full);
  /* Logical, not left/right: the whole bar mirrors under dir="rtl". */
  padding: 8px;
  padding-inline-start: 20px;
}

.nav-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nav-mark {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-fresh-grass);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-mark svg {
  width: 24px; height: 24px;
  fill: none;
  stroke: var(--color-ink-black);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-name {
  font-size: var(--text-body);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav-right { display: flex; align-items: center; gap: 8px; flex: none; }

.nav-link {
  font-size: var(--text-body-sm);
  color: var(--color-ink-black);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.nav-link:hover { background: var(--color-cream-paper); }

/* The other nav action is the language switcher — see components/lang.css.
   The "1000+ supported sites" button that used to sit here moved out entirely;
   the rail's own chip already opens that sheet. */

@media (max-width: 620px) {
  .nav { padding: 6px; padding-inline-start: 16px; }
  .nav-name { font-size: var(--text-body-sm); }
  .nav-link { padding: 6px 8px; }
}

/* css/components/lang.css */
/* Language switcher in the nav. The pill borrows the shape the sites button
   used to have; the menu is the one floating surface outside the sheet. */

.lang { position: relative; flex: none; }

.lang-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 14px 10px 16px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--color-cream-paper);
  color: var(--color-ink-black);
  font-size: var(--text-body-sm); font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast);
}
.lang-btn:hover { background: var(--color-sandstone); }
.lang-btn > svg { width: 16px; height: 16px; flex: none; }

.lang-code { letter-spacing: 0.02em; }

.lang-caret { display: flex; width: 12px; height: 12px; color: var(--color-stone-gray); }
.lang-caret svg { width: 100%; height: 100%; transition: transform var(--dur-fast); }
.lang.is-open .lang-caret svg { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  /* Hangs off the nav's inline end, so it flips sides on its own in Arabic. */
  inset-inline-end: 0;
  z-index: var(--z-sheet);
  min-width: 210px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  list-style: none;
  background: var(--color-pure-white);
  border: 1px solid var(--color-hairline-mist);
  border-radius: var(--radius-mid);
  box-shadow: 0 12px 32px rgb(44 46 42 / 0.12);
}

.lang-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-small);
  color: var(--color-ink-black);
  font-size: var(--text-body-sm);
  text-decoration: none;
  transition: background var(--dur-fast);
}
.lang-menu a:hover { background: var(--color-cream-paper); }

.lang-name { flex: 1; min-width: 0; }
.lang-tick { color: var(--color-fresh-grass); font-weight: 500; opacity: 0; }
.lang-menu a.is-active { font-weight: 500; }
.lang-menu a.is-active .lang-tick { opacity: 1; }

@media (max-width: 620px) {
  .lang-btn { padding: 9px 12px 9px 13px; }
  .lang-menu { min-width: 190px; }
}

/* css/components/seo.css */
/* Below-the-fold content. Present for readers and crawlers when the queue is
   idle; gone the moment the page becomes a working tool. */

.seo {
  border-top: 1px solid var(--color-hairline-mist);
  padding: 56px 20px 40px;
}

.seo-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

/* /privacy /terms /about use a real <h1> for their page title (accessibility/
   SEO heading order) — same visual treatment as the .seo-block <h2>s used
   everywhere else, this is the only place an <h1> lives inside .seo-block. */
.seo-block h1,
.seo-block h2 {
  font-size: clamp(26px, 3.4vw, 32px);
  font-weight: 500; line-height: 1.2; letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.seo-block h3 {
  margin-top: 22px;
  font-size: var(--text-body); font-weight: 500;
  line-height: 1.35; letter-spacing: -0.01em;
}
.seo-block p {
  margin-top: 6px;
  font-size: var(--text-body); line-height: 1.6;
  color: var(--color-stone-gray);
}
.seo-block b { color: var(--color-ink-black); font-weight: 500; }
.seo-block a {
  color: var(--color-ink-black);
  text-decoration: none;
  border-bottom: 1px solid var(--color-stone-gray);
}
.seo-block a:hover { border-bottom-color: var(--color-ink-black); }
/* /privacy /terms /about 这类纯文字页用得到普通列表——.steps 那套编号圆章
   是给"如何使用"三步走用的，语义上不该套在政策条款的列举上。 */
.seo-block ul, .seo-block ol {
  margin-top: 6px;
  padding-inline-start: 22px;
  font-size: var(--text-body); line-height: 1.6;
  color: var(--color-stone-gray);
}
.seo-block li + li { margin-top: 4px; }

.steps {
  counter-reset: step;
  display: flex; flex-direction: column; gap: 14px;
  list-style: none;
}
.steps li {
  position: relative;
  padding-block: 18px;
  padding-inline: 62px 22px;    /* the wide side holds the number badge */
  background: var(--color-pure-white);
  border-radius: var(--radius-mid);
  font-size: var(--text-body); line-height: 1.55;
  color: var(--color-stone-gray);
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-inline-start: 18px; top: 17px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-fresh-grass);
  color: var(--color-ink-black);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-body-sm); font-weight: 500;
}
.steps b { display: block; color: var(--color-ink-black); }

.seo-sites { line-height: 1.7 !important; }

.seo-foot {
  border-top: 1px solid var(--color-hairline-mist);
  padding-top: 26px;
}
.seo-foot p {
  font-size: var(--text-body-sm); line-height: 1.6;
  color: var(--color-stone-gray);
}
.seo-foot-brand {
  font-size: var(--text-subheading) !important;
  font-weight: 500;
  color: var(--color-ink-black) !important;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.seo-foot-note { margin-top: 12px; font-size: var(--text-micro) !important; }
.seo-foot a { color: var(--color-ink-black); text-decoration: underline; }

/* Anchor for the "how it works" cue in the empty state. Filled with the brand
   accent so it reads as a real affordance, not another muted caption. */
.scroll-cue {
  margin-top: 18px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--color-fresh-grass);
  border-radius: var(--radius-full);
  background: var(--color-fresh-grass);
  color: var(--color-ink-black);
  font-size: var(--text-body-sm); font-weight: 500;
  text-decoration: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.scroll-cue:hover { background: var(--color-ink-black); border-color: var(--color-ink-black); color: var(--color-pure-white); }

/* Using the tool beats reading about it: once cards exist the page is an app
   again, one viewport tall with no stray scroll. */
body.is-compact .seo { display: none; }

@media (max-width: 620px) {
  .seo { padding: 40px 16px 32px; }
  .seo-inner { gap: 36px; }
  .steps li { padding-block: 16px; padding-inline: 56px 18px; }
}

/* css/components/toast.css */
/* Transient message, one at a time. */

.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: var(--z-toast);
  max-width: calc(100vw - 40px);
  padding: 14px 22px;
  border-radius: var(--radius-full);
  background: var(--color-ink-black);
  color: var(--color-pure-white);
  font-size: var(--text-body-sm); line-height: 1.4;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* Clear the batch action bar, which only exists once cards are queued. */
body.is-compact .toast { bottom: 92px; }
