@import "tailwindcss";

@layer base {
  :root {
    --color-bg-primary: #141118;
    --color-bg-secondary: #1e1a25;
    --color-bg-tertiary: #2f2938;
    --color-bg-brand-soft: #1a0244;
    --color-bg-accent-soft: #25060e;

    --color-surface-dark: #1e1a25;
    --color-surface-highlight: #2f2938;
    --color-surface-darker: #0f0e13;

    --color-text-primary: #ffffff;
    --color-text-secondary: #a8a4b2;
    --color-text-muted: #767284;

    --color-primary: #6116da;
    --color-primary-hover: #7a2ce0;
    --color-primary-soft: #35087c;

    --color-accent: #ff6490;
    --color-accent-hover: #fb2576;
    --color-accent-soft: #4f0520;

    --color-border-light: #453c53;
    --color-border-default: #342e40;
    --color-border-strong: #141118;

    /* Overlays and panels: the page's own colours, so the light look and a brand reach them too. */
    --color-ink: #ffffff;
    --color-glass: color-mix(in srgb, var(--color-bg-tertiary) 40%, transparent);
    --color-hairline: color-mix(in srgb, var(--color-ink) 5%, transparent);
    --color-grid: color-mix(in srgb, var(--color-ink) 3%, transparent);
    --color-scroll-thumb: #4a4059;
    --color-scroll-thumb-hover: #5d5270;
    --color-canvas: #1b172d;
    /* Text on a solid primary fill (buttons, the play button, active tabs). */
    --color-on-primary: #ffffff;

    /* Status tints the components use as text. In the dark look they are the colours as drawn; the light
       look darkens them. --color-tint-share is how much of a data colour readable() keeps (src/utils). */
    --color-tint-share: 100%;
    --color-tint-amber-400: #fbbf24;
    --color-tint-blue-300: rgb(147,197,253);
    --color-tint-blue-400: #60a5fa;
    --color-tint-red-400: #f87171;
    --color-tint-violet-400: #a78bfa;
    --color-tint-slate-200: #e2e8f0;
    --color-tint-slate-400: #94a3b8;
    --color-tint-slate-500: #64748b;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Noto Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    color-scheme: dark;
  }

  /* The light look: the viewer's setting picks it. The page's colours turn light, and so do the Tailwind
     colours the components use for text (white, slate, and the -300/-400 tints), each to a shade that
     reads on white. Tailwind reads these variables when the page runs, so no component changes class. */
  @media (prefers-color-scheme: light) {
    :root {
      --color-bg-primary: #ffffff;
      --color-bg-secondary: #f7f5fb;
      --color-bg-tertiary: #ece8f4;
      --color-bg-brand-soft: #efe7fd;
      --color-bg-accent-soft: #fde7ef;

      --color-surface-dark: #f7f5fb;
      --color-surface-highlight: #ece8f4;
      --color-surface-darker: #f2eff8;

      --color-text-primary: #1b1530;
      --color-text-secondary: #4a4360;
      --color-text-muted: #6b6480;

      --color-primary: #6316db;
      --color-primary-hover: #4f0fb5;
      --color-primary-soft: #e6dafc;

      --color-accent: #c8105a;
      --color-accent-hover: #a50d4a;
      --color-accent-soft: #fde4ee;

      --color-border-light: #d9d3e6;
      --color-border-default: #e4dff0;
      --color-border-strong: #c9c1da;

      --color-ink: var(--color-text-primary);
      --color-scroll-thumb: #cfc8dd;
      --color-scroll-thumb-hover: #b8b0c9;
      --color-canvas: #f4f2f9;
      --color-on-primary: #ffffff;

      --color-tint-share: 62%;
      --color-tint-amber-400: #b45309;
      --color-tint-blue-300: #1d4ed8;
      --color-tint-blue-400: #1d4ed8;
      --color-tint-red-400: #b91c1c;
      --color-tint-violet-400: #6d28d9;
      --color-tint-slate-200: var(--color-text-primary);
      --color-tint-slate-400: #475569;
      --color-tint-slate-500: #475569;

      /* Text Tailwind colours follow the page's own text colours, so a brand's text reaches them too. */
      --color-white: var(--color-text-primary);
      --color-slate-100: var(--color-text-primary);
      --color-slate-200: var(--color-text-primary);
      --color-slate-300: var(--color-text-secondary);
      --color-slate-400: var(--color-text-secondary);
      --color-slate-500: var(--color-text-muted);
      --color-slate-600: var(--color-text-muted);
      --color-emerald-400: #047857;
      --color-green-400: #15803d;
      --color-cyan-400: #0e7490;
      --color-amber-300: #b45309;
      --color-amber-400: #b45309;
      --color-rose-400: #be123c;
      --color-red-300: #b91c1c;
      --color-red-400: #b91c1c;
      --color-blue-300: #1d4ed8;
      --color-blue-400: #1d4ed8;
      --color-purple-400: #7e22ce;
      --color-violet-400: #6d28d9;

      color-scheme: light;
    }
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html, body, #root {
    height: 100%;
    width: 100%;
    overflow: hidden;
  }

  body {
    font-family: var(--font-body);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
  }

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

  ::-webkit-scrollbar-track {
    background: var(--color-bg-primary);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--color-surface-highlight);
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
  }
}

/* Utility classes */
.glass-panel {
  background: var(--color-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-hairline);
}

.flow-grid {
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
}

.code-block {
  font-family: var(--font-mono);
  background: var(--color-surface-darker);
  border: 1px solid var(--color-surface-highlight);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.font-display {
  font-family: var(--font-display);
}

.font-body {
  font-family: var(--font-body);
}

/* Logs terminal scrollbar */
.logs-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.logs-scrollbar::-webkit-scrollbar-track {
  background: var(--color-surface-darker);
}

.logs-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-scroll-thumb);
  border-radius: 10px;
}

.logs-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-scroll-thumb-hover);
}

/* The Product's brand: `yad docs brand <site>` writes it between these two lines. Outside every layer, so it
   wins over the looks above. Empty: the site keeps the looks above. */
/* yad-brand:begin */
/* yad-brand:end */
