/* Tangle brand — base styles + utilities.
   Mirrors sandbox-ui's globals.css with sandbox-only @source rules stripped.
   Consumers should @import this AFTER @import "tailwindcss". */

@layer base {
  * {
    border-color: hsl(var(--border));
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: var(--font-sans);
    font-feature-settings:
      "rlig" 1,
      "calt" 1,
      "ss01" 1;
  }

  ::selection {
    background: var(--bg-selection);
    color: hsl(var(--hsl-foreground));
  }

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

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

  ::-webkit-scrollbar-thumb {
    background: hsl(var(--border) / 0.7);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.4);
  }
}

@layer utilities {
  .text-gradient-brand {
    background-image: var(--tangle-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }

  /* Retained as a flat no-op so any stray consumer renders without a halo.
     Tangle Quiet has no glow chrome. */
  .glow-brand {
    box-shadow: none;
  }

  .depth-1 { background-color: var(--depth-1); }
  .depth-2 { background-color: var(--depth-2); }
  .depth-3 { background-color: var(--depth-3); }
  .depth-4 { background-color: var(--depth-4); }

  .surface-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    transition: border-color var(--transition-default), box-shadow var(--transition-default);
  }

  .surface-card:hover {
    border-color: hsl(var(--border));
  }

  .bg-mesh {
    position: relative;
  }

  .bg-mesh::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 80% 50% at 20% 40%, var(--mesh-teal), transparent),
      radial-gradient(ellipse 60% 40% at 80% 20%, var(--mesh-violet), transparent),
      radial-gradient(ellipse 50% 60% at 50% 80%, var(--mesh-blue), transparent);
    pointer-events: none;
    z-index: 0;
  }

  .noise {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
  }

  .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }

  .status-dot-running { background: var(--status-running); box-shadow: var(--shadow-status-running); }
  .status-dot-stopped { background: var(--status-stopped); }
  .status-dot-error { background: var(--status-error); box-shadow: var(--shadow-status-error); }
}

/* Markdown prose — applied via `tangle-prose` on the Markdown renderer. The
 * @tailwindcss/typography plugin is not loaded, so structured markdown (tables,
 * lists, spacing between blocks) had NO styling: table cells collided and text
 * ran flush into code blocks. Self-contained, theme-tokened so it re-skins. */
.tangle-prose {
  color: var(--text-primary);
  line-height: 1.7;
}
.tangle-prose > * + * { margin-top: 0.85em; }
.tangle-prose h1, .tangle-prose h2, .tangle-prose h3, .tangle-prose h4 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}
.tangle-prose h1 { font-size: 1.4em; }
.tangle-prose h2 { font-size: 1.25em; }
.tangle-prose h3 { font-size: 1.1em; }
.tangle-prose p, .tangle-prose ul, .tangle-prose ol { margin: 0; }
.tangle-prose ul, .tangle-prose ol { padding-left: 1.4em; }
.tangle-prose li { margin: 0.25em 0; }
.tangle-prose li > ul, .tangle-prose li > ol { margin-top: 0.25em; }
.tangle-prose a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tangle-prose blockquote {
  border-left: 2px solid var(--border-default);
  padding-left: 0.9em;
  color: var(--text-muted);
}
.tangle-prose hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 1.2em 0; }
.tangle-prose :not(pre) > code {
  background: var(--md3-surface-container-high);
  padding: 0.12em 0.36em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-mono);
}
.tangle-prose pre { margin: 0.85em 0; }

/* Tables — border-collapse with hairline dividers + real cell padding, so
 * columns read as a grid instead of colliding (the "no dividers" report). */
.tangle-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85em 0;
  font-size: 0.95em;
  display: block;
  overflow-x: auto;
}
.tangle-prose thead { border-bottom: 1px solid var(--border-default); }
.tangle-prose th {
  text-align: left;
  font-weight: 600;
  padding: 0.5em 0.85em;
  color: var(--text-primary);
  white-space: nowrap;
}
.tangle-prose td {
  padding: 0.5em 0.85em;
  border-top: 1px solid var(--border-subtle);
  vertical-align: top;
}
.tangle-prose th:not(:first-child), .tangle-prose td:not(:first-child) {
  border-left: 1px solid var(--border-subtle);
}
