/* OPXP ask portal — the Hebbs chat treatment.
   Tokens and fonts follow ask-hebbs/site/chat: dark espresso console, ember
   accent, Cabinet Grotesk + General Sans. Light marketing pages, dark product
   screens: a prospect who saw the site recognises this as the same product. */

:root {
  --ink: #211a0e;
  --ink-2: #2a2213;
  --ink-3: #332918;
  --line: #453a24;
  --line-soft: #352b19;
  --paper: #fdf7ea;
  --text: #f0e6d2;
  --muted: #b3a389;
  --faint: #7d7059;
  --ember: #d4881c;
  --ember-soft: #e6a53f;
  --ember-rgb: 212, 136, 28;
  --bad: #e08a8a;

  --display: "Cabinet Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: rgba(var(--ember-rgb), 0.28); color: #fff; }
a { color: var(--ember-soft); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }

.ground {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120vw 80vh at 78% -10%, rgba(var(--ember-rgb), 0.1), transparent 60%),
    radial-gradient(90vw 70vh at 8% 8%, rgba(var(--ember-rgb), 0.07), transparent 62%),
    radial-gradient(70vw 60vh at 50% 108%, rgba(95, 125, 58, 0.06), transparent 60%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.035'/></svg>");
}

/* ═══ lock ═══ */

.lock {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.5s var(--ease), filter 0.5s var(--ease);
}

.lock.leaving { opacity: 0; filter: blur(8px); pointer-events: none; }
.lock-inner { width: 100%; max-width: 420px; text-align: center; }

.lock .brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--paper);
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}

.lock .tagline {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 auto 40px;
  max-width: 34ch;
}

.key-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}

.key-row { display: flex; flex-direction: column; gap: 14px; }

#keyInput {
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-align: center;
}

#keyInput:focus { border-color: var(--ember); outline: none; }

#continueBtn {
  padding: 15px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--ember);
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.25s var(--ease);
  box-shadow: 0 14px 40px -16px rgba(var(--ember-rgb), 0.55);
}

#continueBtn:hover { transform: translateY(-1px); }
#continueBtn:active { transform: translateY(0); }
#continueBtn:disabled { opacity: 0.55; cursor: default; transform: none; }

.hint {
  min-height: 18px;
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--bad);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.hint.show { opacity: 1; }

.lock-sub {
  margin-top: 30px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ═══ chat ═══ */

.chat {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.6s var(--ease) 0.1s;
}

.chat.in { opacity: 1; }

.chat-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 9, 16, 0.7);
  backdrop-filter: blur(12px);
}

.chat-head .brand { font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--paper); }

.chat-head .scale {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-left: 10px;
}

.chat-head .home {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
  text-decoration: none;
  white-space: nowrap;
}

.chat-head .home:hover { color: var(--text); }

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.col {
  width: 100%;
  max-width: 720px;
  padding-inline: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Starters begin as full-width buttons in the thread, then dock into the
   composer as a one-line scrolling pill row once a question has been asked.
   Same element, same handler: it just moves in the DOM and changes shape. */
.starters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }

.try-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 2px;
}

.starter {
  text-align: left;
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.starter:hover { border-color: var(--line); background: var(--ink-3); }
.starter:disabled { opacity: 0.45; cursor: default; }

.starters.horizontal {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 4px;
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}

.starters.horizontal::-webkit-scrollbar { height: 4px; }
.starters.horizontal::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.starters.horizontal .try-label { width: auto; flex: none; margin-bottom: 0; margin-right: 2px; }
.starters.horizontal .starter { flex: none; padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; white-space: nowrap; }

.msg { max-width: 78%; font-size: 0.98rem; line-height: 1.6; }

.msg.user {
  align-self: flex-end;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 18px;
  color: var(--paper);
}

.answer {
  align-self: flex-start;
  max-width: 82%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  background: var(--ink-2);
}

.answer p { margin: 0 0 16px; color: var(--text); }
.answer p:last-of-type { margin-bottom: 0; }
.answer strong { color: var(--paper); font-weight: 600; }

.answer ul { list-style: none; margin: 0; padding: 0; }
.answer li { position: relative; padding-left: 15px; margin-bottom: 14px; }
.answer li:last-child { margin-bottom: 0; }

.answer li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 1px;
  background: var(--ember);
}

/* Provenance sits on the claim. Our answers carry several sources per bullet,
   so the platform is named once per run and the rest are numbered. */
.srcs { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 4px; }

.src {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ember-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--ember-rgb), 0.3);
  white-space: nowrap;
}

.src:hover { border-bottom-color: var(--ember); }

.from {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.receipt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ember-soft);
}

.receipt .who { color: var(--faint); }

.thinking { align-self: flex-start; display: flex; align-items: center; gap: 10px; padding: 14px 4px; }
.dots { display: flex; gap: 5px; }

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  animation: pulse 1.2s ease-in-out infinite;
}

.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 60%, 100% { opacity: 0.25; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* The status line is the proof of work: the brain visibly reading its own
   files. Worth more in a pitch than a spinner. */
.thinking .what { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.ceiling {
  align-self: stretch;
  border: 1px solid rgba(var(--ember-rgb), 0.32);
  border-radius: 16px;
  padding: 24px 26px;
  background: linear-gradient(165deg, rgba(var(--ember-rgb), 0.1), transparent 65%), var(--ink-2);
}

.ceiling h4 { font-family: var(--display); font-size: 1.15rem; font-weight: 600; color: var(--paper); margin: 0 0 8px; }
.ceiling p { margin: 0 0 18px; color: var(--muted); font-size: 0.94rem; }
.ceiling .row { display: flex; gap: 10px; flex-wrap: wrap; }

.ceiling .row button,
.ceiling .row a {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.ceiling .primary { background: var(--ember); color: var(--ink); border: none; font-weight: 600; }
.ceiling .secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }

.notice {
  align-self: flex-start;
  max-width: 82%;
  border: 1px solid rgba(224, 138, 138, 0.35);
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--muted);
  font-size: 0.94rem;
}

.composer {
  flex: none;
  padding: 14px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 1px solid var(--line-soft);
}

.composer-col { width: 100%; max-width: 720px; padding-inline: 20px; }

.counter {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ask-row { display: flex; gap: 10px; }

#askInput {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--paper);
  font-size: 0.96rem;
  font-family: inherit;
}

#askInput:focus { border-color: var(--ember); outline: none; }
#askInput:disabled { opacity: 0.5; }

.ask-row button {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--ember);
  color: var(--ink);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ask-row button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══ plain pages ═══ */

.plain { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 24px; }
.plain-inner { max-width: 30rem; text-align: center; }
.plain h1 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; color: var(--paper); margin: 0 0 10px; }
.plain p { color: var(--muted); margin: 0; font-size: 0.95rem; }

/* ═══ admin ═══ */

body.admin-page { overflow: auto; }
.admin { position: relative; z-index: 2; padding: 32px 24px; max-width: 74rem; margin: 0 auto; }
.admin .brand { font-family: var(--display); font-weight: 600; color: var(--paper); }
.admin h1 { font-family: var(--display); font-weight: 600; font-size: 1.6rem; margin: 18px 0 28px; color: var(--paper); }
.admin h2 { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin: 40px 0 14px; }
.admin table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin th { text-align: left; font-family: var(--mono); font-weight: 400; color: var(--faint); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 0 14px 8px 0; }
.admin td { padding: 10px 14px 10px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
.admin .tag { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.admin .fail { color: var(--bad); }

@media (max-width: 700px) {
  .msg.user { max-width: 88%; }
  .answer { max-width: 94%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .lock.leaving { display: none; }
}
