@import "tailwindcss";

@theme {
  --color-bg: #080c14;
  --color-bg-subtle: #0b1120;
  --color-surface: #0f1623;
  --color-surface-raised: #162032;
  --color-surface-hover: #1c2d45;
  --color-fg: #d4dce8;
  --color-fg-bright: #f1f5f9;
  --color-fg-dim: #94a3b8;
  --color-muted: #5a6b82;
  --color-border: #1c2a3f;
  --color-border-light: #253550;
  --color-accent: #f0a030;
  --color-accent-hover: #fbbf24;
  --color-cyan: #22d3ee;
  --color-red: #ef4444;
  --color-green: #22c55e;
  --color-purple: #a78bfa;

  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;

  --spacing-sidebar: 260px;
  --spacing-sidebar-collapsed: 60px;
  --spacing-topbar: 48px;
  --spacing-content: 1100px;
}

/* Live indicator for active agent/Bevy runs (used by inline-styled badges). */
@keyframes vn-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

/* Moving gradient sweep across an active run's status banner. */
@keyframes vn-sweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(220%);
  }
}

/* Bouncing dots used by "working…" / typing indicators. */
@keyframes vn-dots {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Spinner for an in-flight tool call. */
@keyframes vn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Flowing gradient along an active run's top edge (background-position). */
@keyframes vn-flow {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@layer base {
  :root {
    --bg: var(--color-bg);
    --bg-subtle: var(--color-bg-subtle);
    --surface: var(--color-surface);
    --surface-base: var(--color-bg);
    --surface-sunken: var(--color-bg-subtle);
    --surface-raised: var(--color-surface-raised);
    --surface-hover: var(--color-surface-hover);
    --fg: var(--color-fg);
    --fg-bright: var(--color-fg-bright);
    --fg-dim: var(--color-fg-dim);
    --muted: var(--color-muted);
    --border: var(--color-border);
    --border-light: var(--color-border-light);
    --accent: var(--color-accent);
    --amber: var(--color-accent);
    --accent-hover: var(--color-accent-hover);
    --accent-dim: #b47818;
    --accent-bg: rgba(240, 160, 48, 0.08);
    --accent-border: rgba(240, 160, 48, 0.25);
    --cyan: var(--color-cyan);
    --cyan-dim: #0891b2;
    --cyan-bg: rgba(34, 211, 238, 0.08);
    --red: var(--color-red);
    --red-dim: #dc2626;
    --red-bg: rgba(239, 68, 68, 0.08);
    --green: var(--color-green);
    --green-dim: #16a34a;
    --green-bg: rgba(34, 197, 94, 0.08);
    --purple: var(--color-purple);
    --purple-dim: #8b5cf6;
    --purple-bg: rgba(167, 139, 250, 0.08);
    --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-body: "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-pill: 9999px;
  }

  *, *::before, *::after {
    box-sizing: border-box;
  }

  html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  body {
    @apply h-screen overflow-hidden bg-bg font-body text-fg;
    line-height: 1.6;
  }

  #root {
    @apply flex h-screen;
  }

  a {
    @apply text-cyan no-underline transition-colors duration-150 hover:text-accent;
  }

  h1, h2, h3, h4, h5, h6 {
    @apply font-display text-fg-bright;
    line-height: 1.25;
    letter-spacing: 0;
  }

  h1 {
    @apply text-[2rem] font-bold;
  }

  h2 {
    @apply mb-4 text-2xl font-semibold;
  }

  h3 {
    @apply mb-3 text-[1.2rem] font-semibold;
  }

  h4 {
    @apply mb-2 text-[1.05rem] font-semibold;
  }

  p {
    @apply mb-4;
  }

  code {
    @apply rounded bg-surface-raised px-1.5 py-0.5 font-mono text-[0.9em] text-accent;
  }

  pre {
    @apply mb-4 overflow-x-auto rounded-lg border border-border bg-surface p-4 font-mono text-[0.85rem];
    line-height: 1.5;
  }

  ul, ol {
    @apply mb-4 pl-6;
  }

  li {
    @apply mb-1;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  input,
  select,
  textarea {
    @apply rounded border border-border bg-surface-raised px-3 py-2 text-fg focus:border-cyan focus:outline-none focus:ring-2 focus:ring-cyan/10;
  }

  ::selection {
    @apply bg-accent text-bg;
  }

  * {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-light) transparent;
  }

  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    @apply rounded-full bg-border-light;
  }

  ::-webkit-scrollbar-thumb:hover {
    @apply bg-muted;
  }

  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }

    50% {
      opacity: 0.4;
    }
  }

  /* ------------------------------------------------------------------
   * .doc-prose — styling for AI-generated / rendered HTML documentation.
   * Used by <DocHtml>. Targets bare semantic tags (no classes needed on
   * the generated markup) and keeps the dark sci-fi look of the rest of
   * the docs site.
   * ------------------------------------------------------------------ */
  .doc-prose {
    color: var(--color-fg);
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .doc-prose > :first-child {
    margin-top: 0;
  }

  .doc-prose h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-fg-bright);
    margin: 0 0 var(--sp-4) 0;
    letter-spacing: -0.01em;
  }

  .doc-prose h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-accent);
    margin: var(--sp-6) 0 var(--sp-3) 0;
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--color-border);
  }

  .doc-prose h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-cyan);
    margin: var(--sp-5) 0 var(--sp-2) 0;
  }

  .doc-prose p {
    margin: 0 0 var(--sp-3) 0;
    max-width: 72ch;
  }

  .doc-prose ul,
  .doc-prose ol {
    margin: 0 0 var(--sp-3) 0;
    padding-left: 1.4rem;
  }

  .doc-prose ul { list-style: disc; }
  .doc-prose ol { list-style: decimal; }

  .doc-prose li {
    margin: var(--sp-1) 0;
  }

  .doc-prose a {
    color: var(--color-cyan);
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .doc-prose a:hover {
    color: var(--color-accent-hover);
  }

  .doc-prose strong { color: var(--color-fg-bright); }
  .doc-prose em { color: var(--color-fg); }

  .doc-prose code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    color: var(--color-accent);
  }

  .doc-prose pre {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--sp-3) var(--sp-4);
    overflow-x: auto;
    margin: 0 0 var(--sp-4) 0;
  }

  .doc-prose pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-fg);
    font-size: 0.85rem;
  }

  .doc-prose blockquote {
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    margin: 0 0 var(--sp-3) 0;
    padding: var(--sp-2) var(--sp-4);
    color: var(--color-fg-dim);
    border-radius: 0 8px 8px 0;
  }

  .doc-prose hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--sp-6) 0;
  }

  .doc-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 var(--sp-4) 0;
    font-size: 0.88rem;
  }

  .doc-prose th,
  .doc-prose td {
    border-bottom: 1px solid var(--color-border);
    padding: var(--sp-2) var(--sp-3);
    text-align: left;
  }

  .doc-prose th {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
  }

  .doc-prose td { color: var(--color-fg); }

  .doc-prose tr:hover td {
    background: var(--color-surface-raised);
  }

  .doc-prose div.mermaid {
    display: flex;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--sp-4);
    margin: 0 0 var(--sp-4) 0;
    overflow-x: auto;
  }

  .doc-prose div.mermaid svg {
    max-width: 100%;
    height: auto;
  }
}
