/*
 * The public landing page.
 *
 * A standalone stylesheet, not part of the Tailwind build. The marketing page has
 * its own visual language — cream, firebrick, hand-drawn underline — and pushing
 * that through the app's semantic tokens would fight both. It is also the only
 * page a visitor sees before signing in, so it loads this file *instead of*
 * app.css rather than on top of it.
 *
 * Ported from a standalone design sample (pocket-klear-landing.html, deleted once
 * this superseded it) with three changes the app forced:
 *
 *   1. No inline <style> block and no style="" attributes. The CSP is
 *      style-src 'self', which blocks both. The palette swatches and mock-chart
 *      heights that were inline attributes are the utility classes at the bottom.
 *   2. The font is self-hosted (font-src 'self'), not fetched from Google.
 *   3. Dark theme, via the same light-dark() mechanism as the rest of the app.
 *      A marketing page that ignored the theme switch would be the one bright
 *      page in an otherwise dark app.
 *
 * Bar widths are still set from JS via data-w. That is deliberate and CSP-safe:
 * style-src governs stylesheets and style attributes in markup, not CSSOM
 * assignments from a loaded script.
 */

@import "./fonts.css" layer(base);

:root {
  color-scheme: light dark;

  /* Warm neutrals. The dark set is a deep cocoa rather than a blue-grey, so the
     firebrick and gold stay in the same family instead of turning plummy. */
  --base: light-dark(#f6f2f0, #17100f);
  --base-2: light-dark(#ece3e0, #251a18);
  --surface: light-dark(#ffffff, #1f1614);
  --ink: light-dark(#2a1513, #f2e9e6);
  --ink-soft: light-dark(#6e5652, #b6a29d);
  --line: light-dark(#e8dcd8, #3a2a27);

  /* The brand red keeps its identity in both schemes; only its lightness moves,
     because #B22222 on a dark ground fails contrast for text. */
  --brick: light-dark(#b22222, #e05c52);
  --brick-deep: light-dark(#8b1a1a, #f08a80);
  --brick-bright: light-dark(#c93a34, #ee7a70);
  --gold: light-dark(#dfa02c, #e8b552);
  --green: light-dark(#3f9e6e, #56b98a);

  /* Tints of the above. light-dark() cannot appear inside a colour function, so
     the translucent fills are their own tokens. */
  --brick-tint: light-dark(rgba(178, 34, 34, 0.09), rgba(224, 92, 82, 0.16));
  --brick-ring: light-dark(rgba(178, 34, 34, 0.16), rgba(224, 92, 82, 0.22));
  --brick-glow: light-dark(rgba(178, 34, 34, 0.3), rgba(224, 92, 82, 0.26));
  --brick-glow-strong: light-dark(rgba(178, 34, 34, 0.42), rgba(224, 92, 82, 0.36));
  --green-tint: light-dark(rgba(63, 158, 110, 0.13), rgba(86, 185, 138, 0.18));
  --nav-bg: light-dark(rgba(246, 242, 240, 0.72), rgba(23, 16, 15, 0.72));
  --nav-bg-scrolled: light-dark(rgba(246, 242, 240, 0.92), rgba(23, 16, 15, 0.94));
  --on-brick: #ffffff;

  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(42, 21, 19, 0.06), 0 2px 8px rgba(42, 21, 19, 0.05);
  --shadow-md: 0 8px 30px rgba(42, 21, 19, 0.1);
  --shadow-lg: 0 20px 60px rgba(139, 26, 26, 0.16);
  --font: "IBM Plex Sans Thai Looped", system-ui, sans-serif;
}

/* The switcher stamps data-theme on <html>; these two blocks are what make an
   explicit choice beat the OS preference, in both directions. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--base);
  color: var(--ink);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2.5px solid var(--brick); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* Screen-reader-only, for the labels on the icon-sized controls in the nav. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Nav ---- */
nav.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
nav.top.scrolled { border-color: var(--line); background: var(--nav-bg-scrolled); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 72px; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: -0.005em;
  color: var(--brick-deep);
}
.brand img { height: 38px; width: auto; display: block; }
.brand.brand-sm { font-size: 1rem; }
.brand.brand-sm img { height: 30px; }

.nav-cta {
  font-weight: 600;
  font-size: 0.92rem;
  background: var(--brick);
  color: var(--on-brick);
  padding: 10px 20px;
  border-radius: 100px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 22px var(--brick-glow-strong); }

/* Sign in sits beside the primary action but must not compete with it. */
.nav-login {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}
.nav-login:hover { border-color: var(--brick); transform: translateY(-2px); }

/* Language switcher: plain links to /lang/{code}, which sets the cookie and
   redirects back. No JS, and the same endpoint the app's own switcher uses.

   Small on purpose — two-letter codes in a bar that is crowded on a phone. The
   fixed min-width keeps TH and EN the same size so the pill does not resize when
   the language changes, which would shift everything beside it. */
.lang {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.lang > * { min-width: 2.4em; padding: 5px 8px; line-height: 1.3; text-align: center; }
.lang .on { background: var(--brick); color: var(--on-brick); }
.lang a { color: var(--ink-soft); transition: background 0.15s; }
.lang a:hover { background: var(--base-2); color: var(--ink); }

/* ---- Hero ---- */
header { padding: 66px 0 40px; position: relative; }
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--brick-deep);
  background: var(--brick-tint);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 22px;
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brick);
  box-shadow: 0 0 0 4px var(--brick-ring);
}
h1 {
  font-weight: 700;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
h1 .hl { position: relative; white-space: nowrap; color: var(--brick); }
h1 .hl svg { position: absolute; left: -2%; bottom: -0.2em; width: 104%; height: 0.42em; overflow: visible; }
h1 .hl path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw 1s 0.7s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 30em; margin-bottom: 32px; font-weight: 300; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.btn-primary {
  font-weight: 600;
  font-size: 1rem;
  background: var(--brick);
  color: var(--on-brick);
  padding: 15px 30px;
  border-radius: 100px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 20px var(--brick-glow);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--brick-bright);
  box-shadow: 0 12px 30px var(--brick-glow-strong);
}
.btn-ghost { font-weight: 600; font-size: 1rem; color: var(--ink); padding: 15px 10px; position: relative; }
.btn-ghost::after { content: "→"; margin-left: 8px; display: inline-block; transition: transform 0.2s; }
.btn-ghost:hover::after { transform: translateX(5px); }

/* ---- Hero signature ---- */
.stage { position: relative; height: 460px; }
.card {
  position: absolute;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.slip {
  width: 230px; top: 12px; left: 0;
  padding: 20px 20px 26px;
  transform: rotate(-6deg);
  -webkit-mask-image: radial-gradient(circle at 8px 0, transparent 7px, #000 8px);
  mask-image: radial-gradient(circle at 8px 0, transparent 7px, #000 8px);
  animation: floatA 6s ease-in-out infinite;
}
@keyframes floatA { 50% { transform: rotate(-6deg) translateY(-10px); } }
.slip .r-head { text-align: center; border-bottom: 1.5px dashed var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.slip .r-store { font-weight: 600; font-size: 0.98rem; }
.slip .r-meta { font-size: 0.72rem; color: var(--ink-soft); }
.slip .r-line { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-soft); margin: 5px 0; }
.slip .r-total {
  display: flex; justify-content: space-between;
  font-weight: 700; font-size: 0.95rem;
  border-top: 1.5px dashed var(--line);
  margin-top: 12px; padding-top: 12px;
  color: var(--ink);
}
.slip .cam {
  position: absolute; top: -13px; right: -13px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brick);
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
}
.slip .cam svg { width: 19px; height: 19px; stroke: var(--on-brick); fill: none; stroke-width: 1.8; }

.entry { width: 290px; right: 0; bottom: 8px; padding: 20px; transform: rotate(3deg); animation: floatB 6s ease-in-out infinite; }
@keyframes floatB { 50% { transform: rotate(3deg) translateY(10px); } }
.entry .e-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 0.68rem;
  color: var(--green);
  background: var(--green-tint);
  padding: 4px 10px; border-radius: 100px; margin-bottom: 14px;
}
/* A tick, drawn as a mask so it takes the token colour. The data: URI is a mask
   image rather than a stylesheet or script, so CSP img-src/style-src do not
   apply to it. */
.entry .e-tag::before {
  content: "";
  width: 12px; height: 12px;
  background: var(--green);
  border-radius: 4px;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 12l2 2 4-4' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 12l2 2 4-4' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.entry .e-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.entry .e-store { font-weight: 600; font-size: 1.02rem; }
.entry .e-amt { font-weight: 700; font-size: 1.15rem; }

.split { display: flex; flex-direction: column; gap: 9px; }
.split-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.split-row .lbl { flex: 1; color: var(--ink-soft); }
.split-row .val { font-weight: 600; }
.pill { font-size: 0.68rem; padding: 2px 8px; border-radius: 100px; font-weight: 500; }
.pill-green { background: var(--green-tint); color: var(--green); }

.flow-arrow {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--base);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.flow-arrow svg { width: 30px; height: 30px; stroke: var(--brick); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.flow-arrow span { position: absolute; bottom: -24px; font-weight: 600; font-size: 0.68rem; color: var(--brick-deep); white-space: nowrap; }

/* ---- Pockets ---- */
.pockets { padding: 26px 0 8px; }
.pockets .p-lead { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 14px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 9px 16px;
  font-size: 0.86rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.chip .cd { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* ---- Sections ---- */
section { padding: 60px 0; }
section.tight { padding-top: 20px; }
.sec-head { max-width: 38em; margin-bottom: 46px; }
.sec-eyebrow {
  font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brick); margin-bottom: 12px; display: block;
}
.sec-title { font-weight: 700; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.14; letter-spacing: -0.01em; margin-bottom: 14px; }
.sec-sub { color: var(--ink-soft); font-size: 1.05rem; font-weight: 300; }

.feat { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; padding: 46px 0; border-top: 1px solid var(--line); }
.feat.flip .feat-visual { order: -1; }
.feat-num { font-weight: 600; font-size: 0.82rem; color: var(--brick); letter-spacing: 0.04em; margin-bottom: 14px; }
.feat h3 { font-weight: 700; font-size: 1.55rem; line-height: 1.18; letter-spacing: -0.005em; margin-bottom: 12px; }
.feat p { color: var(--ink-soft); font-size: 1.02rem; max-width: 30em; font-weight: 300; }
.feat-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow-md);
  min-height: 230px;
  display: flex; flex-direction: column; justify-content: center;
}

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row .bn { width: 92px; font-size: 0.82rem; color: var(--ink-soft); flex: none; }
.bar-track { flex: 1; height: 12px; background: var(--base-2); border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; width: 0; transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.bar-row .bv { width: 64px; text-align: right; font-weight: 600; font-size: 0.82rem; flex: none; }

.members { display: flex; flex-direction: column; gap: 12px; }
.member { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--base); border-radius: 13px; }
.ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 0.82rem; color: var(--on-brick); flex: none; }
.member .mn { flex: 1; font-size: 0.9rem; font-weight: 500; }
.member .mv { font-weight: 600; font-size: 0.9rem; }
.settle { margin-top: 6px; text-align: center; font-weight: 600; font-size: 0.85rem; color: var(--green); background: var(--green-tint); padding: 11px; border-radius: 12px; }

.forecast { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.fcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.fcol .fbar { width: 100%; border-radius: 8px 8px 4px 4px; background: var(--gold); opacity: 0.95; }
.fcol .fm { font-size: 0.72rem; color: var(--ink-soft); }

.taxwrap { display: flex; flex-direction: column; gap: 16px; }
.tax-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.tax-row .tl { color: var(--ink-soft); }
.tax-bar { height: 9px; background: var(--base-2); border-radius: 100px; overflow: hidden; margin-top: 6px; }
.tax-bar span { display: block; height: 100%; border-radius: 100px; background: var(--brick); width: 0; transition: width 1.1s ease; }
.tax-item { display: flex; justify-content: space-between; font-size: 0.8rem; }

.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 82%; padding: 12px 16px; border-radius: 16px; font-size: 0.9rem; line-height: 1.5; }
.bubble.wide { max-width: 100%; }
.bubble.user { align-self: flex-end; background: var(--ink); color: var(--base); border-bottom-right-radius: 5px; }
.bubble.ai { align-self: flex-start; background: var(--base); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.ai b { color: var(--brick-deep); }
.mini-break { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 0.8rem; color: var(--ink-soft); }
.mini-break .mb-row { display: flex; justify-content: space-between; margin-top: 3px; }

.trust { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 36px 0; }
.trust-item { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; }
.trust-item svg { width: 20px; height: 20px; stroke: var(--brick); fill: none; stroke-width: 2; }

/* ---- Waiting list ---- */
.final { margin: 40px 0 70px; }
.final-inner {
  background: var(--ink);
  color: var(--base);
  border-radius: 30px;
  padding: 70px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.final-inner::before {
  content: "";
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(178, 34, 34, 0.5), transparent 70%);
  top: -120px; right: -80px;
}
.final-inner::after {
  content: "";
  position: absolute; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(223, 160, 44, 0.26), transparent 70%);
  bottom: -120px; left: -60px;
}
.final h2 { font-weight: 700; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.12; letter-spacing: -0.01em; margin-bottom: 16px; position: relative; }
.final p { color: var(--ink-soft); font-size: 1.1rem; margin-bottom: 32px; font-weight: 300; position: relative; }
.final .btn-primary { position: relative; background: var(--surface); color: var(--brick-deep); }
.final .btn-primary:hover { background: var(--surface); color: var(--brick); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28); }

/* The form sits inside the dark panel, so its field has to read on that ground. */
.waitlist { position: relative; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 30em; margin: 0 auto; }
.waitlist input {
  flex: 1 1 15em;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 15px 20px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.waitlist input::placeholder { color: var(--ink-soft); }
.waitlist-note { position: relative; margin-top: 16px; font-size: 0.82rem; color: var(--ink-soft); }
.waitlist-note a { text-decoration: underline; }

.notice { position: relative; margin: 0 auto 22px; max-width: 34em; border-radius: 16px; padding: 14px 18px; font-size: 0.92rem; }
.notice.ok { background: var(--green-tint); color: var(--green); }
.notice.bad { background: var(--brick-tint); color: var(--brick-deep); }

footer { border-top: 1px solid var(--line); padding: 34px 0; font-size: 0.86rem; color: var(--ink-soft); }
.foot-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------------
   Utilities replacing the inline style="" attributes of the original.
   Present because the CSP is style-src 'self' — see the file header.
   --------------------------------------------------------------------------- */

.sw-brick { background: var(--brick); }
.sw-brick-deep { background: var(--brick-deep); }
.sw-ink { background: var(--ink); }
.sw-gold { background: var(--gold); }
.sw-green { background: var(--green); }

/* Mock-chart heights. A fixed set rather than an arbitrary value, so the
   stylesheet stays a stylesheet and the markup carries no geometry. */
.h55 { height: 55%; }
.h60 { height: 60%; }
.h70 { height: 70%; }
.h75 { height: 75%; }
.h90 { height: 90%; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 36px; }
  .stage { height: 400px; margin-top: 10px; }
  .feat { grid-template-columns: 1fr; gap: 26px; padding: 40px 0; }
  .feat.flip .feat-visual { order: 0; }
  h1 .hl { white-space: normal; }
}
@media (max-width: 640px) {
  /* The same call to action is in the hero immediately below, so on a narrow screen
     this was the identical button twice within one thumb's reach — crowding out the
     language switcher and Sign in, which have nowhere else to live. */
  .nav-cta { display: none; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 18px; }
  .stage { height: 430px; }
  .slip { width: 200px; left: -4px; }
  .entry { width: 250px; }
  .btn-primary, .btn-ghost { width: 100%; text-align: center; }
  .final-inner { padding: 50px 24px; }
  .nav-inner { padding: 12px 0; }
  /* The waiting-list field and its button stack, so the button must not stay
     full-width-in-a-row and end up beside a field it no longer fits next to. */
  .waitlist input { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  h1 .hl path { stroke-dashoffset: 0; }
}
