/*
 * Scriblane (by Botlane) web UI.
 * Tokens are copied from botlaneio/neural_substrate src/styles/tokens.css (the botlane.io design
 * system) and base rules from src/app/globals.css; see brand/BRAND.md. Dark is the default theme.
 */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/InterVariable-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/InterVariable-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2-variations");
}

:root {
  --sp-4: 4px; --sp-8: 8px; --sp-12: 12px; --sp-16: 16px; --sp-20: 20px; --sp-24: 24px;
  --sp-32: 32px; --sp-40: 40px; --sp-48: 48px; --sp-64: 64px; --sp-96: 96px;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px; --fs-16: 16px;
  --fs-17: 17px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px; --fs-48: 48px;
  --ls-display: -0.022em; --ls-heading: -0.012em; --ls-body: -0.011em;
  --w-regular: 400; --w-medium: 510; --w-semibold: 590;
  --font-sans: "Inter Variable", Inter, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --font-features: "cv01" on, "ss03" on, "zero" on;
  --r-2: 2px; --r-4: 4px; --r-6: 6px; --r-12: 12px; --r-full: 9999px;
  --container: 1200px; --gutter: var(--sp-32);

  --bg: #f4f5f7; --card: #ffffff; --soft: #f5f6f8; --line: #e3e6ea; --ring: rgba(0, 0, 0, 0.08);
  --fg: #171717; --body: #4d4d4d; --muted: #666666; --skel: #e4e7eb; --skel2: #d1d5db;
  --btn-bg: #171717; --btn-fg: #ffffff; --ok: #297a3a;
  --c-blue: #4f5bd5; --c-purple: #7048e8; --c-amber: #e8890c; --c-teal: #0d9488;
  --brand-purple: color-mix(in srgb, var(--c-purple) 88%, #000);
  --win-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1), 0 2px 4px rgba(15, 23, 42, 0.04);
  /* Text-only shades (Botlane addition, not in tokens.css): amber #e8890c and teal #0d9488 are 2.6:1 and
     3.7:1 on white, below WCAG AA for text, so text uses darker inks (5.8:1+ and 5.0:1+). Fills, dots, bars
     and borders keep the brand accents. See brand/BRAND.md. */
  --amber-ink: color-mix(in srgb, var(--c-amber) 60%, #000); --teal-ink: color-mix(in srgb, var(--c-teal) 80%, #000);
  /* Hairline palette (neural_substrate src/vendor/hairline/core/styles.ts, LIGHT) */
  --hairline-plate: var(--bg); --hairline-hi: #232327; --hairline-edge: #a4a4ac;
  --hairline-mid: #c3c3c9; --hairline-lo: #e0e0e4;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08090a; --card: #0f1011; --soft: #161718; --line: #23252a; --ring: rgba(255, 255, 255, 0.08);
  --fg: #ffffff; --body: #d0d6e0; --muted: #8a8f98; --skel: #26272a; --skel2: #34353a;
  --btn-bg: #ffffff; --btn-fg: #08090a; --ok: #62c073;
  --c-blue: #7c86ec; --c-purple: #a08bf5; --c-amber: #f0b44c; --c-teal: #3cc7b8;
  --win-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --amber-ink: var(--c-amber); --teal-ink: var(--c-teal);
  /* Hairline palette, DARK: white-ish strokes on black */
  --hairline-plate: var(--bg); --hairline-hi: #d0d6e0; --hairline-edge: #5b5d64;
  --hairline-mid: #3e3e44; --hairline-lo: #29292d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  min-height: 100vh; background: var(--bg); color: var(--fg);
  font-family: var(--font-sans); font-feature-settings: var(--font-features);
  font-size: var(--fs-15); line-height: 1.5; letter-spacing: var(--ls-body);
  overflow-x: clip; transition: background-color 0.2s ease, color 0.2s ease;
}
a { color: inherit; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
code, pre, .mono { font-family: var(--font-mono); font-feature-settings: normal; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link {
  position: absolute; z-index: 100; top: var(--sp-8); left: var(--sp-8); padding: var(--sp-8) var(--sp-12);
  border-radius: var(--r-6); background: var(--btn-bg); color: var(--btn-fg); font-size: var(--fs-14);
  text-decoration: none; transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── Header ── */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); box-shadow: inset 0 -1px 0 var(--line); }
.site-header .container { display: flex; align-items: center; gap: var(--sp-16); height: 64px; }
.logo { display: inline-flex; align-items: center; gap: var(--sp-8); text-decoration: none; color: var(--fg); }
.logo-mark { width: 40px; height: 24px; display: block; }
.logo-word { height: 17px; width: auto; display: block; }
.logo-word.light { display: none; }
/* Product lockup: Scriblane, with a small "by botlane" wordmark. */
.logo-name { font-size: 19px; font-weight: var(--w-semibold); letter-spacing: -0.02em; line-height: 1; color: var(--fg); }
.by-botlane { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; padding-left: var(--sp-8); box-shadow: inset 1px 0 0 var(--line); font-size: 11px; line-height: 1; color: var(--muted); white-space: nowrap; }
.by-botlane .logo-word { height: 11px; }
:root:not([data-theme="dark"]) .logo-word.dark { display: none; }
:root:not([data-theme="dark"]) .logo-word.light { display: block; }
.art.light { display: none; }
:root:not([data-theme="dark"]) .art.dark { display: none; }
:root:not([data-theme="dark"]) .art.light { display: block; }

/* ── Theme controls: neural_substrate ThemeToggle.module.css and ThemeSegment.module.css ── */
.theme-toggle { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0; border: none;
  border-radius: var(--r-6); background: transparent; color: var(--fg); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.theme-toggle:hover { background: var(--card); }
.theme-toggle .moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .moon { display: block; }
.theme-segment { display: inline-flex; flex: 0 0 auto; padding: 2px; border-radius: var(--r-6); background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
.theme-segment button { min-height: 32px; padding: 0 var(--sp-12); border: none; border-radius: var(--r-6); background: transparent;
  font: inherit; font-size: var(--fs-13); color: var(--muted); cursor: pointer; }
.theme-segment button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--line); }
.mobile-only { display: none; }

/* Light: spotlight and soft vignette, from neural_substrate src/app/globals.css (public pages only;
   the dashboard keeps a flat canvas so dense tables stay calm). */
:root:not([data-theme="dark"]) body:is(.landing, .auth, .docs-page, .redoc-page) {
  background-image:
    linear-gradient(to bottom, rgba(244, 245, 247, 0) 70%, var(--bg) 100%),
    radial-gradient(ellipse 62% 48% at 50% 66%, #ffffff 0%, rgba(255, 255, 255, 0.75) 38%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(ellipse 120% 95% at 50% 45%, rgba(15, 23, 42, 0) 52%, rgba(15, 23, 42, 0.09) 100%),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.06) 0%, rgba(15, 23, 42, 0) 28%),
    radial-gradient(38% 30% at 28% 0%, rgba(94, 106, 210, 0.07), transparent 70%),
    radial-gradient(34% 28% at 76% 2%, rgba(13, 148, 136, 0.05), transparent 70%);
  background-size: 100% 1400px; background-repeat: no-repeat;
}
.product { font-size: var(--fs-14); font-weight: var(--w-medium); color: var(--muted); padding-left: var(--sp-12); box-shadow: inset 1px 0 0 var(--line); white-space: nowrap; }
.nav { margin-left: auto; display: flex; align-items: center; gap: var(--sp-4); }
.nav a { font-size: var(--fs-14); color: var(--body); text-decoration: none; padding: var(--sp-8) var(--sp-12); border-radius: var(--r-6); }
.nav a:hover { color: var(--fg); background: var(--soft); }
.nav a.btn-primary, .nav a.btn-primary:hover { color: var(--btn-fg); background: var(--btn-bg); }
.status { display: inline-flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-13); color: var(--muted); padding: 0 var(--sp-8); }
.status .dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--skel2); }
.status[data-state="ok"] .dot { background: var(--ok); }
.status[data-state="down"] .dot { background: var(--c-amber); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r-6); background: transparent; color: var(--body); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--fg); }

/* ── Hero ── */
.hero { padding-top: var(--sp-64); padding-bottom: var(--sp-40); }
.eyebrow { font-size: var(--fs-13); font-weight: var(--w-medium); color: var(--muted); }
.hero h1 { margin-top: var(--sp-12); font-size: var(--fs-48); font-weight: var(--w-medium); line-height: 1; letter-spacing: var(--ls-display); text-wrap: balance; max-width: 760px; }
.lede { margin-top: var(--sp-20); max-width: 640px; font-size: var(--fs-17); line-height: 1.6; color: var(--body); text-wrap: pretty; }

/* ── Layout ── */
.workspace { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: var(--sp-24); align-items: start; padding-bottom: var(--sp-96); }
.workspace > * { min-width: 0; }
.card { background: var(--card); border-radius: var(--r-12); box-shadow: var(--win-shadow); }
.panel { padding: var(--sp-24); display: flex; flex-direction: column; gap: var(--sp-20); }
.panel h2, .window h2 { font-size: var(--fs-16); font-weight: var(--w-semibold); letter-spacing: var(--ls-heading); }
.hint { font-size: var(--fs-13); color: var(--muted); }

/* Drop zone */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-8); min-height: 168px; padding: var(--sp-24); text-align: center; border-radius: var(--r-12); background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: box-shadow 0.15s ease, background-color 0.15s ease; }
.drop:hover, .drop[data-over] { box-shadow: inset 0 0 0 1px var(--muted); }
.drop:focus-within { outline: 2px solid var(--fg); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop svg { color: var(--muted); }
.drop strong { font-weight: var(--w-medium); font-size: var(--fs-14); }
.drop .file { font-family: var(--font-mono); font-size: var(--fs-13); color: var(--fg); word-break: break-all; }

/* Segmented control (ThemeSegment pattern) */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: var(--fs-13); font-weight: var(--w-medium); color: var(--body); margin-bottom: var(--sp-8); padding: 0; }
.segment { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: var(--r-6); background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.segment label { position: relative; display: flex; flex-direction: column; align-items: center; padding: var(--sp-8); border-radius: var(--r-4); font-size: var(--fs-14); font-weight: var(--w-medium); color: var(--muted); cursor: pointer; text-align: center; }
.segment label small { font-size: var(--fs-11); font-weight: var(--w-regular); }
.segment input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segment label:has(input:checked) { background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--line); }
.segment label:has(input:focus-visible) { outline: 2px solid var(--fg); outline-offset: 1px; }

details summary { cursor: pointer; font-size: var(--fs-13); color: var(--muted); }
.input { width: 100%; margin-top: var(--sp-8); min-height: 40px; padding: 0 var(--sp-12); border: 0; border-radius: var(--r-6); background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); font: inherit; font-size: var(--fs-14); }
.input:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }

/* Buttons (neural_substrate src/components/ui/Button.module.css) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-8); min-height: 44px; padding: 0 var(--sp-20); border: 0; border-radius: var(--r-6); font: inherit; font-size: var(--fs-14); font-weight: var(--w-medium); text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.btn-secondary:hover { background: var(--soft); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 32px; padding: 0 var(--sp-12); font-size: var(--fs-13); }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.msg { font-size: var(--fs-13); color: var(--muted); min-height: 1.5em; }
.msg[data-kind="error"] { color: var(--amber-ink); }

/* ── Result window (AppWindow pattern) ── */
.window { overflow: hidden; display: flex; flex-direction: column; min-height: 520px; }
.titlebar { display: flex; align-items: center; gap: var(--sp-12); min-height: 48px; padding: 0 var(--sp-16); background: color-mix(in srgb, var(--soft) 70%, var(--card)); box-shadow: inset 0 -1px 0 var(--line); }
.lights { display: flex; gap: var(--sp-8); }
.lights span { width: 12px; height: 12px; border-radius: 50%; background: var(--skel2); }
.wintitle { font-size: var(--fs-13); font-weight: var(--w-medium); color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar .actions { margin-left: auto; display: flex; gap: var(--sp-8); }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-12); padding: var(--sp-40) var(--sp-24); text-align: center; }
.empty img, .empty object { width: min(420px, 100%); aspect-ratio: 5 / 4; }
.empty p { color: var(--muted); font-size: var(--fs-14); max-width: 360px; }

.result { display: flex; flex-direction: column; }
.meta { display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-24); padding: var(--sp-16) var(--sp-20); box-shadow: inset 0 -1px 0 var(--line); font-size: var(--fs-13); color: var(--muted); }
.meta b { color: var(--fg); font-weight: var(--w-medium); }

.banner { margin: var(--sp-16) var(--sp-20) 0; padding: var(--sp-12) var(--sp-16); border-radius: var(--r-6); font-size: var(--fs-14); box-shadow: inset 0 0 0 1px var(--line); }
.banner strong { font-weight: var(--w-semibold); display: flex; align-items: center; gap: var(--sp-8); }
.banner ul { margin: var(--sp-8) 0 0; padding-left: var(--sp-20); color: var(--body); }
.banner li + li { margin-top: var(--sp-4); }
.banner.review { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-amber) 55%, var(--line)), inset 3px 0 0 var(--c-amber); background: color-mix(in srgb, var(--c-amber) 7%, var(--card)); }
.banner.review strong { color: var(--amber-ink); }
.banner.ok { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 45%, var(--line)), inset 3px 0 0 var(--ok); }
.banner.ok strong { color: var(--ok); }
.banner .warn { margin-top: var(--sp-8); color: var(--muted); font-size: var(--fs-13); }

/* Tabs */
.tabs { display: flex; gap: var(--sp-4); padding: var(--sp-16) var(--sp-20) 0; box-shadow: inset 0 -1px 0 var(--line); }
.tab { position: relative; border: 0; background: none; padding: var(--sp-8) var(--sp-12) var(--sp-12); font: inherit; font-size: var(--fs-14); font-weight: var(--w-medium); color: var(--muted); cursor: pointer; border-radius: var(--r-6) var(--r-6) 0 0; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: var(--sp-12); right: var(--sp-12); bottom: 0; height: 2px; border-radius: 2px; background: var(--fg); }
.tabpanel { padding: var(--sp-20); }
.tabpanel[hidden] { display: none; }

table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
caption { text-align: left; font-size: var(--fs-13); font-weight: var(--w-semibold); color: var(--fg); padding: var(--sp-20) 0 var(--sp-8); }
.tabpanel > table:first-child caption, .tabpanel > .tablewrap:first-child caption { padding-top: 0; }
th { text-align: left; font-size: var(--fs-12); font-weight: var(--w-medium); color: var(--muted); padding: var(--sp-8) var(--sp-12); box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
td { padding: var(--sp-12); box-shadow: inset 0 -1px 0 var(--line); vertical-align: top; color: var(--body); }
td.v { color: var(--fg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.flag td { background: color-mix(in srgb, var(--c-amber) 6%, transparent); }
tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--c-amber), inset 0 -1px 0 var(--line); }
.tablewrap { overflow-x: auto; position: relative; } /* contain sr-only children so they cannot widen the page */
.missing { color: var(--amber-ink); font-weight: var(--w-medium); }
.note { display: block; margin-top: var(--sp-4); font-size: var(--fs-12); color: var(--amber-ink); }
.badge { display: inline-flex; align-items: center; padding: 1px var(--sp-8); border-radius: var(--r-full); font-size: var(--fs-11); font-weight: var(--w-medium); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }

.conf { display: inline-flex; align-items: center; gap: var(--sp-8); font-variant-numeric: tabular-nums; font-size: var(--fs-13); }
.conf .bar { width: 56px; height: 4px; border-radius: var(--r-full); background: var(--skel); overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: var(--ok); }
.conf.low .bar i { background: var(--c-amber); }
.conf.low { color: var(--amber-ink); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); font-size: var(--fs-13); }
.checks li { display: flex; gap: var(--sp-8); align-items: baseline; color: var(--body); }
.checks .p { color: var(--ok); }
.checks .f { color: var(--amber-ink); }
.checks li.fail { color: var(--fg); }

pre.code { margin: 0; padding: var(--sp-16); max-height: 560px; overflow: auto; border-radius: var(--r-6); background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-13); line-height: 1.6; color: var(--body); white-space: pre-wrap; word-break: break-word; }
.panelbar { display: flex; justify-content: flex-end; gap: var(--sp-8); margin-bottom: var(--sp-12); }

/* ── Footer ── */
.site-footer { box-shadow: inset 0 1px 0 var(--line); padding: var(--sp-32) 0 var(--sp-48); font-size: var(--fs-13); color: var(--muted); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-24); justify-content: space-between; }
.site-footer a { color: var(--body); }

@media (max-width: 960px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .hero h1 { font-size: var(--fs-32); }
}
@media (max-width: 640px) {
  :root { --gutter: var(--sp-20); }
  .hero { padding-top: var(--sp-40); padding-bottom: var(--sp-24); }
  .lede { font-size: var(--fs-16); }
  .product, .nav a.hide-sm, .status .label { display: none; }
  .meta { padding: var(--sp-12) var(--sp-16); }
  .tabpanel { padding: var(--sp-16); }
  .banner { margin: var(--sp-12) var(--sp-16) 0; }
  .tabs { padding: var(--sp-12) var(--sp-16) 0; }
  td, th { padding: var(--sp-8); }
  .conf .bar { width: 32px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
