/* Ever Smarter — shared design system.
 *
 * Constraints, from _headers: script-src 'none' and style-src 'self'. No JS,
 * no inline styles, no web fonts. Every bit of character has to come from
 * system typefaces, CSS motion and data-URI texture -- which is why the
 * display face is a serif: on a Chinese device 宋体 reads editorial and
 * considered, where the default 黑体 reads like every other admin panel.
 */

:root {
  color-scheme: light dark;

  /* Warm ink on warm paper. Deliberately not blue-on-white: this is a tool
     people open next to a till, not a dashboard for a pitch deck. */
  --paper: #f7f3ec;
  --paper-raised: #fffdfa;
  --paper-sunk: #efe9df;
  --ink: #17130f;
  --ink-soft: #4a423a;
  --ink-faint: #857a6e;
  --rule: #ddd3c5;

  /* Amber carries the brand; teal is reserved for data so a figure never
     competes with a button for attention. */
  --amber: #b4661a;
  --amber-bright: #d98324;
  --amber-wash: #f6e8d5;
  --teal: #12545a;
  --teal-wash: #dceaea;

  --display: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC",
    "Times New Roman", Georgia, serif;
  --body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", monospace;

  --shell: min(1080px, calc(100% - 2.5rem));
  --lift: 0 1px 2px rgba(23, 19, 15, 0.04), 0 12px 32px rgba(23, 19, 15, 0.07);
  --lift-high: 0 2px 4px rgba(23, 19, 15, 0.05), 0 28px 60px rgba(23, 19, 15, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14110e;
    --paper-raised: #1e1a16;
    --paper-sunk: #100d0b;
    --ink: #f4ede3;
    --ink-soft: #c3b8aa;
    --ink-faint: #8d8175;
    --rule: #332c25;
    --amber: #e2954a;
    --amber-bright: #f0a95f;
    --amber-wash: #2c2118;
    --teal: #6fb7bd;
    --teal-wash: #16292b;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
    --lift-high: 0 2px 4px rgba(0, 0, 0, 0.5), 0 28px 60px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.75;
  /* Grain, then a warm bloom from the top-left. The grain keeps large flat
     areas from looking like unpainted canvas on big screens. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 8% -10%, var(--amber-wash), transparent 60%);
  background-attachment: fixed, scroll;
}

::selection { background: var(--amber-wash); color: var(--ink); }

/* -- type ------------------------------------------------------------------ */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
  /* Chinese headings break anywhere, so a long one strands a single glyph on
     the last line. Balancing spreads the lines evenly instead. */
  text-wrap: balance;
}

h1 { font-size: clamp(2.3rem, 6vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.12rem; letter-spacing: 0; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--amber); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--amber-bright); }

strong { font-weight: 650; }

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lede {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
}

/* -- chrome ---------------------------------------------------------------- */

.shell { width: var(--shell); margin-inline: auto; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 0 0.6rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--amber-bright), var(--amber));
  box-shadow: 0 5px 14px rgba(180, 102, 26, 0.32);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-spacer { flex: 1; }

.topbar-link {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.topbar-link:hover { color: var(--amber); border-bottom-color: var(--amber); }

.foot {
  margin-top: 4.5rem;
  padding: 1.8rem 0 2.6rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  align-items: baseline;
}

.foot-spacer { flex: 1; }

/* -- buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--body);
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary {
  background: linear-gradient(150deg, var(--amber-bright), var(--amber));
  color: #fff;
  box-shadow: 0 8px 22px rgba(180, 102, 26, 0.3);
}

.btn-primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(180, 102, 26, 0.38);
}

.btn-ghost {
  border-color: var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
}

.btn-ghost:hover { border-color: var(--amber); color: var(--amber); transform: translateY(-2px); }

/* The arrow leans forward on hover -- the whole "graceful" budget spent in
   one place rather than sprinkled everywhere. */
.btn .arrow { transition: transform 0.22s cubic-bezier(0.3, 0.9, 0.4, 1); }
.btn:hover .arrow { transform: translateX(4px); }

/* -- chat mockups (shared by both pages) ----------------------------------- */

.chat { display: flex; flex-direction: column; gap: 0.55rem; }

.bubble {
  max-width: 92%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  font-size: 0.94rem;
  line-height: 1.7;
}

.bubble p { margin: 0 0 0.3rem; }
.bubble p:last-child { margin-bottom: 0; }

.bubble.ask {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: linear-gradient(150deg, var(--amber-bright), var(--amber));
  color: #fff;
}

.bubble.say {
  align-self: flex-start;
  border: 1px solid var(--rule);
  border-bottom-left-radius: 5px;
  background: var(--paper-raised);
}

.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--teal-wash);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.figure { font-family: var(--mono); font-size: 0.95em; letter-spacing: -0.01em; }

/* -- motion ---------------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.rise { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.d1 { animation-delay: 0.06s; }
.d2 { animation-delay: 0.13s; }
.d3 { animation-delay: 0.2s; }
.d4 { animation-delay: 0.27s; }
.d5 { animation-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 640px) {
  :root { --shell: calc(100% - 1.75rem); }
  body { font-size: 16px; }
  .bubble { max-width: 100%; }
}
