/* Cassius: shared look for the public page and the Studio.
   Dark first (it reads as an AI product and makes text stand out), with a matching light
   version for devices set to light mode. Every colour is a token, so both themes stay in step. */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

:root {
  --bg: #0e1013;
  --surface: #16191e;
  --raised: #1d2128;
  --line: #2a2f38;
  --text: #e9ebef;
  --muted: #9198a5;
  --faint: #6b7280;
  --accent: #c9a46a;        /* brass: lamplight on a Baker Street desk */
  --accent-ink: #17130c;
  --accent-soft: rgba(201, 164, 106, 0.14);
  --danger: #f07a6a;
  --unsure: rgba(201, 164, 106, 0.22);
  --gamble: rgba(201, 164, 106, 0.5);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f9; --surface: #ffffff; --raised: #eef0f3; --line: #dde1e7;
    --text: #15181d; --muted: #5b6370; --faint: #8a919c;
    --accent: #8a6326; --accent-ink: #ffffff; --accent-soft: rgba(138, 99, 38, 0.1);
    --danger: #b3261e; --unsure: rgba(138, 99, 38, 0.14); --gamble: rgba(138, 99, 38, 0.32);
    --shadow: 0 10px 40px rgba(20, 24, 30, 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --surface: #ffffff; --raised: #eef0f3; --line: #dde1e7;
  --text: #15181d; --muted: #5b6370; --faint: #8a919c;
  --accent: #8a6326; --accent-ink: #ffffff; --accent-soft: rgba(138, 99, 38, 0.1);
  --danger: #b3261e; --unsure: rgba(138, 99, 38, 0.14); --gamble: rgba(138, 99, 38, 0.32);
  --shadow: 0 10px 40px rgba(20, 24, 30, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The Cassius mark: a small faceted diamond, drawn in CSS. */
.mark {
  width: 22px; height: 22px; border-radius: 6px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--bg)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent);
  flex: none;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.45; cursor: default; }

.field-label { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--text);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Chat messages, shared by both pages. */
.msg { display: flex; gap: 14px; align-items: flex-start; }
.msg .avatar { margin-top: 6px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--raised); border: 1px solid var(--line); border-radius: 18px 18px 4px 18px;
  padding: 10px 16px; max-width: min(80%, 560px); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.bot .text { flex: 1; min-width: 0; padding-top: 1px; white-space: normal; overflow-wrap: anywhere; }
.msg.bot .who { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.caret { display: inline-block; width: 8px; height: 1.05em; vertical-align: -0.15em; background: var(--accent); border-radius: 2px; animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 4px; padding: 8px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .caret, .thinking i { animation: none; } }
