/*
 * Aloita demo site — one design system, used by every demo.
 *
 * Tokens first, then one definition per component. Demos never override a
 * component: if two things should look alike, they share the class. Colours are
 * Aloita's own tokens (src/KanbanAI.Api/wwwroot/css/tokens.css) so the demo site
 * reads as part of the product, plus the cyan from the logo's gradient.
 */

/* ══ Tokens ═══════════════════════════════════════════════════════════════ */
:root {
  /* Surfaces — a violet-cast dark ramp, one step per elevation. */
  --bg: #0c0e15;
  --surface: #141721;
  --panel: #1c2030;
  --raised: #252a3d;
  --line: #292e44;
  --line-strong: #3a4060;

  --text: #e4e7f1;
  --text-bright: #f6f7fc;
  --text-muted: #8e93a8;

  /* Brand — Aloita purple, and the cyan the logo's "A" fades from. */
  --accent: #6c5ce7;
  --accent-hover: #7d6ff0;
  --accent-soft: rgba(108, 92, 231, 0.14);
  --accent-glow: rgba(108, 92, 231, 0.35);
  --spark: #35d6f0;
  --gradient-accent: linear-gradient(135deg, #35d6f0 0%, #6c5ce7 55%, #8b5cf6 100%);

  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.14);
  --warn: #f39c12;
  --warn-soft: rgba(243, 156, 18, 0.14);
  --stop: #f85149;
  --stop-soft: rgba(248, 81, 73, 0.14);
  --info: #74b9ff;
  --info-soft: rgba(116, 185, 255, 0.14);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
  --focus-ring: 0 0 0 3px var(--accent-glow);

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-sans: Inter, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --shell: min(1180px, 100% - 3rem);
}

/* ══ Base ═════════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text-bright);
}

p { margin: 0; }

.shell { width: var(--shell); margin-inline: auto; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--spark);
}

.muted { color: var(--text-muted); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  background: var(--accent); color: #fff; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip:focus { left: var(--space-4); top: var(--space-4); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ══ Top rail ═════════════════════════════════════════════════════════════ */
.rail {
  position: sticky; top: 0; z-index: 10;
  background: rgba(12, 14, 21, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.rail__inner {
  display: flex; align-items: center; gap: var(--space-7);
  min-height: 60px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; display: block; }
.brand__name {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text-bright);
}
.brand__kind {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted);
  padding-left: var(--space-3); border-left: 1px solid var(--line-strong);
}

.tabs { display: flex; gap: var(--space-1); margin-left: auto; flex-wrap: wrap; }
/* Utility nav sits after the demo tabs without pushing them around. */
.tabs--utility { margin-left: 0; padding-left: var(--space-4); border-left: 1px solid var(--line); }
.tab {
  font: inherit; font-size: 0.86rem; font-weight: 500;
  color: var(--text-muted); background: none; border: 1px solid transparent;
  padding: var(--space-2) var(--space-4); border-radius: 999px; cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active {
  color: var(--text-bright); background: var(--accent-soft); border-color: var(--accent);
}

/* ══ Hero ═════════════════════════════════════════════════════════════════ */
.hero {
  position: relative; overflow: hidden;
  padding: var(--space-8) 0 var(--space-7);
  border-bottom: 1px solid var(--line);
}
/* One ambient wash, echoing the logo's cyan→violet orbit. */
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto -10%; height: 420px;
  background:
    radial-gradient(520px 260px at 18% 90%, rgba(53, 214, 240, 0.13), transparent 70%),
    radial-gradient(560px 280px at 78% 20%, rgba(108, 92, 231, 0.22), transparent 70%);
  pointer-events: none;
}
/* The container keeps the shell's full width so the hero lines up with the
   panels below; only the text measures are constrained. */
.hero__inner { position: relative; }
.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3rem); margin: var(--space-4) 0 0;
  max-width: 20ch;
}
.hero__lede {
  margin-top: var(--space-4); font-size: 1.02rem; color: var(--text-muted);
  max-width: 58ch;
}

/* ══ Pipeline — the signature ═════════════════════════════════════════════
   The stages a demo can actually confirm. Steps light up as the real work
   happens, so the page narrates the product while it runs. */
.pipeline {
  display: flex; align-items: stretch; flex-wrap: wrap;
  gap: var(--space-2); margin-top: var(--space-7);
}
.stage {
  flex: 1 1 150px; min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.3s, background 0.3s;
}
.stage__no {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
  color: var(--text-muted);
}
.stage__label { font-size: 0.86rem; font-weight: 500; color: var(--text-muted); }
.stage__bar { height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.stage__bar::after {
  content: ""; display: block; height: 100%; width: 0; background: var(--gradient-accent);
  transition: width 0.45s ease;
}

.stage.is-active { border-color: var(--accent); background: var(--panel); }
.stage.is-active .stage__label { color: var(--text-bright); }
.stage.is-active .stage__no { color: var(--spark); }
.stage.is-active .stage__bar::after { width: 100%; animation: sweep 1.4s ease-in-out infinite; }

.stage.is-done { border-color: var(--line-strong); }
.stage.is-done .stage__label { color: var(--text); }
.stage.is-done .stage__no { color: var(--ok); }
.stage.is-done .stage__bar::after { width: 100%; background: var(--ok); }

@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .stage__bar::after { animation: none !important; transition: none; }
}

/* ══ Layout ═══════════════════════════════════════════════════════════════ */
.work {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-5); padding: var(--space-7) 0 var(--space-8);
  align-items: start;
}
.work--single { grid-template-columns: minmax(0, 640px); }
@media (max-width: 900px) { .work { grid-template-columns: 1fr; } }

/* ══ Panel — the one card in the system ═══════════════════════════════════ */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--space-6);
}
.panel__head { margin-bottom: var(--space-5); }
.panel h2 { font-size: 1.15rem; }
.panel__sub { margin-top: var(--space-2); font-size: 0.85rem; color: var(--text-muted); }

/* ══ Fields ═══════════════════════════════════════════════════════════════ */
.field { margin-bottom: var(--space-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

label {
  display: block; margin-bottom: var(--space-2);
  font-size: 0.8rem; font-weight: 600; color: var(--text);
}

input, textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: var(--space-3) var(--space-4);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 6.5rem; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--stop); }

.hint {
  margin-top: var(--space-2); text-align: right;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted);
}
.error { margin-top: var(--space-2); font-size: 0.8rem; color: var(--stop); }

/* ══ Button ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font: inherit; font-weight: 600; color: #fff;
  background: var(--gradient-accent); border: 0;
  padding: var(--space-3) var(--space-6); border-radius: var(--radius);
  cursor: pointer; transition: filter 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .spinner {
  display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn.is-busy .spinner { display: inline-block; }
.btn.is-busy { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn .spinner { animation: none; } }

/* ══ Note — every inline message, one shape ═══════════════════════════════ */
.note {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  font-size: 0.85rem; margin-bottom: var(--space-4);
  border: 1px solid transparent;
}
.note--info { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.note--warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.note--error { background: var(--stop-soft); border-color: var(--stop); color: var(--stop); }
.note--ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

/* ══ Pill — one shape, colour by state ════════════════════════════════════ */
.pill {
  flex: none; white-space: nowrap;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: var(--space-1) var(--space-3); border-radius: 999px;
  background: var(--raised); color: var(--text-muted);
  display: inline-flex; align-items: center; gap: var(--space-2);
}
.pill::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.pill--proceed { background: var(--ok-soft); color: var(--ok); }
.pill--rejected { background: var(--stop-soft); color: var(--stop); }
.pill--refinement { background: var(--info-soft); color: var(--info); }
.pill--pending { background: var(--warn-soft); color: var(--warn); }
.pill--submitting { background: var(--accent-soft); color: var(--purple, #a29bfe); }

/* ══ Item list — submitted requests ═══════════════════════════════════════ */
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.item {
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  animation: rise 0.25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .item { animation: none; } }

.item__head {
  display: flex; align-items: start; justify-content: space-between; gap: var(--space-3);
  width: 100%; padding: var(--space-3) var(--space-4);
  font: inherit; color: inherit; text-align: left;
  background: none; border: 0;
}
button.item__head { cursor: pointer; transition: background 0.12s; }
button.item__head:hover { background: var(--raised); }

.item__text { display: flex; flex-direction: column; min-width: 0; gap: var(--space-1); }
.item__title { font-size: 0.9rem; font-weight: 600; color: var(--text-bright); }
.item__meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.item__chevron { flex: none; color: var(--text-muted); font-size: 0.7rem; line-height: 2; }

.item__details {
  border-top: 1px solid var(--line); background: var(--bg);
  padding: var(--space-4); display: grid; gap: var(--space-4);
}

.comment { display: grid; gap: var(--space-1); }
.comment__head {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted);
}
.comment__author { color: var(--spark); }
.comment__body {
  font-size: 0.85rem; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.comment + .comment { border-top: 1px solid var(--line); padding-top: var(--space-4); }

.empty { font-size: 0.85rem; color: var(--text-muted); }

/* ══ Footer ═══════════════════════════════════════════════════════════════ */
.footer { border-top: 1px solid var(--line); padding: var(--space-6) 0; }
.footer p { font-size: 0.78rem; color: var(--text-muted); }

/* ══ Login gate ═══════════════════════════════════════════════════════════ */
body.centered { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6); }
.gate { width: min(400px, 100%); display: grid; gap: var(--space-5); }
.gate__brand { display: flex; align-items: center; gap: var(--space-3); justify-content: center; }

/* ══ Config page ══════════════════════════════════════════════════════════ */
/* Anchors and buttons both appear in the rail, so .tab must sit right either way. */
a.tab { text-decoration: none; display: inline-block; }

.work--single > form { display: grid; gap: var(--space-5); }
#demos { display: grid; gap: var(--space-5); }

.actions { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }

/* The counter stays mono; a sentence should not look like code. */
.hint--left {
  text-align: left; font-family: var(--font-sans); font-size: 0.78rem;
  margin-top: var(--space-2);
}

/* Where a value came from — .env or this page. */
.origin {
  margin-left: var(--space-2);
  font-family: var(--font-mono); font-size: 0.65rem; font-weight: 400;
  letter-spacing: 0.04em; text-transform: lowercase;
  padding: 2px var(--space-2); border-radius: 999px;
  background: var(--raised); color: var(--text-muted);
}
.origin[data-origin="saved"] { background: var(--accent-soft); color: var(--spark); }
.origin[data-origin="unset"] { background: var(--warn-soft); color: var(--warn); }

.linkbtn {
  margin-top: var(--space-2);
  font: inherit; font-size: 0.78rem; color: var(--text-muted);
  background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline;
}
.linkbtn:hover { color: var(--stop); }

code {
  font-family: var(--font-mono); font-size: 0.9em;
  color: var(--spark); background: var(--surface);
  padding: 1px 5px; border-radius: var(--radius-sm);
}
