/* Shared design system for the marketing site and the dashboard.
   Palette is warm and commerce-flavoured rather than the usual cool SaaS blue —
   the product lives next to price tags and haggling, not dashboards. */

:root {
  --ink: #0a0c11;
  --ink-2: #0d1016;
  --surface: #131820;
  --surface-2: #1a2029;
  --surface-3: #212936;
  --line: #262f3d;
  --line-soft: rgba(255, 255, 255, 0.06);
  --fg: #eef1f6;
  --muted: #97a1b2;
  --faint: #64707f;

  --accent: #ff7a2f;
  --accent-2: #ffab5e;
  --accent-soft: rgba(255, 122, 47, 0.13);
  --accent-glow: rgba(255, 122, 47, 0.28);

  --good: #35c77e;
  --good-soft: rgba(53, 199, 126, 0.13);
  --warn: #f5b544;
  --cool: #5b9dff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --ring: 0 0 0 3px var(--accent-soft);

  --display: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  --ink: #faf8f5;
  --ink-2: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #f7f4ef;
  --surface-3: #efeae2;
  --line: #e2dcd2;
  --line-soft: rgba(0, 0, 0, 0.05);
  --fg: #15181d;
  --muted: #5f6873;
  --faint: #949ba5;

  --accent: #d9541b;
  --accent-2: #f07a3d;
  --accent-soft: rgba(217, 84, 27, 0.09);
  --accent-glow: rgba(217, 84, 27, 0.18);

  --good: #128a52;
  --good-soft: rgba(18, 138, 82, 0.1);
  --shadow: 0 18px 48px rgba(40, 30, 20, 0.12);
  --shadow-sm: 0 3px 12px rgba(40, 30, 20, 0.07);
}

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

body {
  margin: 0;
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  background: var(--ink);
}

/* Colour bleeding in from the corners, drifting slowly.
   Two layers rather than one: each carries a different set of pools and moves
   on its own timing, so they cross rather than sliding together as a sheet —
   which is what makes it read as light rather than as a moving picture.
   Kept at low alpha and behind everything, because this sits under body text
   and the moment it competes for attention it has failed. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

body::before {
  background-image:
    radial-gradient(38vw 30vw at 8% 4%, rgba(52, 168, 83, 0.20), transparent 62%),
    radial-gradient(42vw 34vw at 94% 8%, rgba(66, 133, 244, 0.18), transparent 64%),
    radial-gradient(34vw 30vw at 50% 104%, rgba(251, 188, 5, 0.13), transparent 62%);
  animation: drift-a 44s var(--ease) infinite alternate;
}

body::after {
  background-image:
    radial-gradient(36vw 30vw at 96% 88%, rgba(234, 67, 53, 0.17), transparent 62%),
    radial-gradient(30vw 26vw at 4% 92%, rgba(0, 191, 178, 0.14), transparent 62%),
    radial-gradient(30vw 26vw at 62% -6%, var(--accent-soft), transparent 60%);
  animation: drift-b 58s var(--ease) infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3%, 2.5%, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to   { transform: translate3d(-3.5%, -2%, 0) scale(1); }
}

/* Movement in the background of a page someone is reading is a real problem for
   some people. Honour the system setting: keep the colour, drop the motion. */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

/* Light theme needs far less of it — the same alpha over white reads as a
   smear rather than as light. */
:root[data-theme="light"] body::before,
:root[data-theme="light"] body::after { opacity: 0.45; }

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 22px;
}

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

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); line-height: 1.06; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.14; }
h3 { font-size: 1.12rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 100px;
  padding: 7px 13px;
  margin-bottom: 18px;
}

.lede { color: var(--muted); font-size: 1.08rem; max-width: 56ch; }
.muted { color: var(--muted); }

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 6px 18px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 10px 26px var(--accent-glow); }
.btn-ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--fg);
}
.btn-ghost:hover { background: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- surfaces ---------- */

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
/* A one-pixel highlight along the top edge reads as light falling on the card. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--line-soft) 20%, var(--line-soft) 80%, transparent);
  pointer-events: none;
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.3);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; text-decoration: none; letter-spacing: -0.01em; }
/* The packaged icon, so the site, the extension popup and the browser toolbar
   all show one mark rather than three that merely resemble each other. */
.brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  box-shadow: 0 3px 10px var(--accent-glow);
}
.nav-links { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.15s var(--ease); }
.nav-links a:hover { color: var(--fg); }

/* ---------- forms ---------- */

.field { display: block; margin-bottom: 18px; }
.field > .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field > .help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.5; }

/* Matched by exclusion rather than by listing types: the email field was
   missed off the old list and rendered as a white browser default in the middle
   of a dark form. Anything that isn't a checkbox, radio or slider is a text-like
   field and should look like one. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
select {
  width: 100%;
  padding: 11px 13px;
  background: var(--ink-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 15px/1.5 var(--sans);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
/* Chrome paints autofilled fields with its own opaque background, which
   background-color can't override — an inset shadow is the only thing that
   covers it, and -webkit-text-fill-color the only thing that fixes the text. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px var(--ink-2) inset;
  caret-color: var(--fg);
  /* Chrome animates the background in; an absurd delay stops it appearing. */
  transition: background-color 9999s ease-out;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 130px; }

/* ---------- chat mock (hero + playground) ---------- */

.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  animation: rise 0.4s var(--ease) both;
}
.bubble.buyer { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 5px; }
.bubble.seller {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 5px 16px var(--accent-glow);
}
.bubble:nth-child(2) { animation-delay: 0.08s; }
.bubble:nth-child(3) { animation-delay: 0.16s; }
.bubble:nth-child(4) { animation-delay: 0.24s; }

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

/* ---------- playground thread ---------- */

.chat-card { display: flex; flex-direction: column; }

.thread {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 220px; max-height: 420px;
  overflow-y: auto;
  padding: 14px;
  margin: 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  scroll-behavior: smooth;
}
.thread .empty { margin: auto; }

/* The thread re-renders whole on every turn, so only the newest bubble should
   animate — otherwise the entire history replays its entrance each time. */
.thread .bubble { animation: none; }
.thread .bubble:last-child { animation: rise 0.4s var(--ease) both; }

.thread .bubble.typing { opacity: 0.65; }

.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  min-height: 44px; max-height: 130px;
  resize: vertical;
  margin: 0;
}

/* ---------- paused banner ---------- */

/* A class-level `display` outranks the UA rule for [hidden], so `.hidden = true`
   would leave the banner on screen. Every element that sets display and toggles
   the hidden attribute needs this. */
[hidden] { display: none !important; }

.paused-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--warn, #e0a33e) 45%, transparent);
  background: color-mix(in srgb, var(--warn, #e0a33e) 12%, var(--surface-2));
  font-size: 14px;
}
.paused-banner span { color: var(--muted); }
.paused-banner .btn { margin-left: auto; }

/* ---------- misc ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 100px;
  font: 600 11.5px/1.5 var(--sans);
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--line);
}
.pill.good { color: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 32%, transparent); }
.pill.warn { color: var(--warn); background: rgba(245, 181, 68, 0.1); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }

.bar {
  height: 8px;
  border-radius: 100px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width 0.7s var(--ease);
}

.scroll-x { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  background: var(--ink-2);
}
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

.theme-toggle {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); width: 36px; height: 36px;
  cursor: pointer; color: var(--muted); font-size: 15px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.theme-toggle:hover { color: var(--fg); background: var(--surface-3); }

/* Respect users who'd rather not have things moving. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 720px) {
  .nav-links { display: none; }
}
