
:root {
  color-scheme: dark;
  --color-ink-0: oklch(13.5% .018 295);
  --color-ink-1: oklch(17.2% .022 295);
  --color-ink-5: oklch(50% .022 290);
  --color-ink-7: oklch(82% .014 285);
  --color-ink-9: oklch(97% .008 90);
  --color-magenta: oklch(70% .24 340);
  --color-cyan: oklch(81% .14 200);
  --color-success: oklch(78% .16 150);
  --color-warn: oklch(82% .16 90);

  --bg: var(--color-ink-0);
  --bg-elev: var(--color-ink-1);
  --fg: var(--color-ink-9);
  --fg-dim: var(--color-ink-7);
  --fg-faint: var(--color-ink-5);
  --rule: oklch(100% 0 0 / .07);
  --rule-strong: oklch(100% 0 0 / .14);
  --grid: oklch(100% 0 0 / .025);
  --accent: var(--color-magenta);
  --accent-2: var(--color-cyan);
  --selection: oklch(70% .24 340 / .32);

  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-brand: "Plus Jakarta Sans", "Geist", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

::selection { background: var(--selection); color: var(--fg); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(ellipse 80vw 60vh at 18% -10%, oklch(70% .24 340 / .13), transparent 60%),
    radial-gradient(ellipse 70vw 70vh at 110% 30%, oklch(81% .14 200 / .09), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Faint 56px grid, masked toward the top like omp.sh. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-position: -1px -1px;
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(at 50% 30%, #000 30%, #0000 75%);
  mask-image: radial-gradient(at 50% 30%, #000 30%, #0000 75%);
}

main { width: min(720px, 92vw); margin: 0 auto; padding: 8vh 0 5rem; }

.skip-link {
  background: var(--accent); color: var(--bg); border-radius: 999px;
  padding: .5rem 1rem; font-weight: 600; position: absolute; top: 1rem; left: -9999px;
}
.skip-link:focus { left: 1rem; z-index: 10; }

/* --- masthead --------------------------------------------------------- */

.brand {
  font-family: var(--font-brand);
  font-weight: 800;
  letter-spacing: -.03em;
  font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.6rem);
  line-height: 1;
  margin: 0 0 .5rem;
}
.brand a { color: inherit; text-decoration: none; }
.brand .ask { color: var(--fg); }
.brand .omp {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-feature-settings: "ss01";
  letter-spacing: -.018em;
  text-wrap: balance;
  color: var(--fg-dim);
  font-size: clamp(1.02rem, .96rem + .3vw, 1.18rem);
  margin: 0 0 2rem;
}
.tagline a { color: var(--fg); text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--accent) 60%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1px; }
.tagline a:hover { text-decoration-color: var(--accent); }

/* --- form ------------------------------------------------------------- */

form { display: flex; flex-direction: column; gap: .8rem; }

textarea, input[type=text] {
  width: 100%;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: .85rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color .18s, box-shadow .18s;
}
textarea::placeholder, input::placeholder { color: var(--fg-faint); }
textarea:focus, input:focus {
  outline: none;
  border-color: color-mix(in oklch, var(--accent) 55%, var(--rule-strong));
  box-shadow: 0 0 0 3px oklch(70% .24 340 / .12);
}

/* Keyboard affordance under the textarea. Hidden until the script confirms a
   real keyboard, since on touch the on-screen Return key stays a newline. */
.hint {
  margin: -.35rem 0 0;
  font-family: var(--font-sans);
  font-size: .78rem;
  color: var(--fg-faint);
}
.hint kbd {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: .12em .42em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-elev);
  color: var(--fg-dim);
}

.row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.row input[type=text] { flex: 1; min-width: 220px; }

button#go {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: .98rem;
  color: var(--bg);
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: 999px;
  padding: .7rem 1.6rem;
  cursor: pointer;
  transition: filter .18s, transform .18s;
}
button#go:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
button#go:disabled { opacity: .5; cursor: wait; transform: none; }

/* --- example chips ---------------------------------------------------- */

.examples { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.4rem; }
.example {
  background: var(--bg-elev);
  color: var(--fg-dim);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.example:hover {
  color: var(--fg);
  border-color: color-mix(in oklch, var(--accent) 45%, var(--rule));
  background: color-mix(in oklch, var(--accent) 8%, var(--bg-elev));
}

/* --- result cards ----------------------------------------------------- */

#out { margin-top: 1.8rem; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 1.15rem 1.35rem;
  overflow-wrap: anywhere;
}
.card.escalated { border-left-color: var(--color-warn); }
.card.rejected { border-left-color: var(--fg-faint); }

.err { color: var(--color-warn); }

.cites {
  margin-top: 1.1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.9;
  color: var(--fg-faint);
}
.cites-label { text-transform: uppercase; letter-spacing: .18em; }
.cites a { color: var(--fg-dim); text-decoration: none; display: block; }
.cites a:hover { color: var(--fg); text-decoration: underline;
  text-decoration-color: var(--accent); text-underline-offset: 3px; }

.share {
  margin-top: 1rem; font-family: var(--font-mono); font-size: .78rem;
}
.share a { color: var(--accent-2); text-decoration: none; }
.share a:hover { text-decoration: underline; text-underline-offset: 3px; }

.q {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  letter-spacing: -.015em;
  color: var(--fg);
  font-size: clamp(1.15rem, 1.05rem + .5vw, 1.4rem);
  line-height: 1.35;
  text-wrap: balance;
  margin: 0 0 1.4rem;
}

footer {
  margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  font-size: .8rem; color: var(--fg-faint);
}
footer a { color: var(--fg-dim); }

/* --- prose (rendered answer markdown) --------------------------------- */

.prose { color: var(--fg); font-size: clamp(.97rem, .9rem + .2vw, 1.04rem); line-height: 1.72; }
.prose > :first-child { margin-top: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { color: var(--fg-dim); }
.prose strong { color: var(--fg); font-weight: 600; }
.prose em { font-family: var(--font-display); letter-spacing: -.005em; font-style: italic; }
.prose h3 {
  font-family: var(--font-display); letter-spacing: -.02em; color: var(--fg);
  margin-top: 1.9em; font-size: 1.24rem; font-weight: 500; line-height: 1.2;
}
.prose h4 {
  text-transform: uppercase; letter-spacing: .18em; font-size: .82rem;
  font-family: var(--font-mono); color: var(--fg-faint); margin-top: 1.6em; font-weight: 500;
}
.prose h5 {
  font-family: var(--font-mono); color: var(--fg-dim); font-size: .88rem;
  letter-spacing: .04em; margin-top: 1.5em; font-weight: 500;
}
.prose a {
  color: var(--fg); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in oklch, var(--accent) 60%, transparent);
  transition: text-decoration-color .2s;
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose code {
  font-family: var(--font-mono); background: oklch(100% 0 0 / .04);
  border: 1px solid var(--rule); color: var(--fg);
  border-radius: 3px; padding: .08em .36em; font-size: .88em;
}
.prose pre {
  font-family: var(--font-mono); background: oklch(9% .015 295);
  border: 1px solid var(--rule); color: var(--fg);
  border-radius: 8px; padding: 1rem 1.15rem; font-size: .84rem;
  line-height: 1.65; overflow-x: auto; max-width: 100%;
}
.prose pre code { font-size: inherit; color: inherit; background: 0 0; border: 0; padding: 0; }
.prose ul, .prose ol { padding-left: 0; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; padding-left: 1.5em; }
/* The dash is drawn, not typed: a glyph here depends on the webfont loading
   and tofus into a literal "u2014" codepoint box when it does not. */
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .82em;
  width: .7em;
  height: 1px;
  background: var(--accent);
}
.prose ol { counter-reset: list; list-style: none; padding-left: 0; }
.prose ol > li { counter-increment: list; padding-left: 2.5em; position: relative; }
.prose ol > li::before {
  content: counter(list, decimal-leading-zero);
  font-family: var(--font-mono); letter-spacing: .1em; color: var(--accent);
  font-size: .75em; position: absolute; top: .28em; left: 0;
}
.prose li + li { margin-top: .4em; }
.prose blockquote {
  border-left: 2px solid var(--accent); font-family: var(--font-display);
  color: var(--fg); padding: .1em 0 .1em 1.15em; font-size: 1.06em; font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose table { font-family: var(--font-mono); border-collapse: collapse; width: 100%; font-size: .84rem; }
.prose th {
  text-align: left; color: var(--fg-faint); text-transform: uppercase;
  letter-spacing: .18em; border-bottom: 1px solid var(--rule);
  padding: .65em .85em .65em 0; font-size: .72rem; font-weight: 500;
}
.prose td {
  border-bottom: 1px solid var(--rule); vertical-align: top;
  color: var(--fg-dim); padding: .55em .85em .55em 0;
}

/* --- live run: trace, reasoning, streamed draft ----------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.run {
  margin-bottom: 1.1rem;
  padding: .85rem 1.05rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: color-mix(in oklch, var(--bg-elev) 60%, transparent);
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.55;
}

.run-head { display: flex; align-items: center; gap: .6rem; color: var(--fg-dim); }
.run-phase { flex: 1; overflow-wrap: anywhere; }
.run-time { color: var(--fg-faint); font-variant-numeric: tabular-nums; flex: none; }

/* Liveness signal. Colour alone carries the finished state, so the reduced
   motion rule below can drop the animation without losing meaning. */
.run-dot {
  flex: none; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--accent-2); animation: run-pulse 1.2s ease-in-out infinite;
}
.run.done .run-dot { background: var(--color-success); animation: none; }
.run.failed .run-dot { background: var(--color-warn); animation: none; }
@keyframes run-pulse {
  0%, 100% { opacity: .25; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1); }
}

.trace { list-style: none; margin: .7rem 0 0; padding: 0; }
.trace li { display: flex; gap: .6rem; align-items: baseline; margin-top: .22rem; }
.trace .n { flex: none; color: var(--accent); }
.trace .d { color: var(--fg-dim); overflow-wrap: anywhere; }
.trace .t { flex: none; margin-left: auto; padding-left: .8rem; color: var(--fg-faint); }
@media (max-width: 560px) { .trace .t { display: none; } }

.think { margin-top: .8rem; }
.think summary {
  cursor: pointer; color: var(--fg-faint); list-style: none;
  display: flex; align-items: baseline; gap: .5rem;
}
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: "+"; color: var(--accent-2); }
.think[open] summary::before { content: "-"; }
.think summary:hover { color: var(--fg-dim); }
.think-text {
  margin-top: .55rem;
  max-height: 11rem;
  overflow-y: auto;
  padding-left: .85rem;
  border-left: 1px solid var(--rule-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .75rem;
  color: var(--fg-faint);
}

/* Raw model output, markers and all: it is replaced by the rendered card the
   moment the answer lands, and monospace reads as source rather than as prose
   whose bold syntax failed to render. */
.draft {
  margin-top: .85rem; padding-top: .8rem; border-top: 1px solid var(--rule);
  font-size: .8rem; line-height: 1.65;
  color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere;
}
/* Drawn caret: the answer is still arriving. */
.draft::after {
  content: ""; display: inline-block; width: .48em; height: 1em;
  margin-left: .1em; vertical-align: -.14em;
  background: var(--accent); animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

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