/* ============================================================================
   RAG Showcase — dark-first, sci-fi-minimalist Material theme.
   Sleek, cool, elegant: a deep near-black canvas, a single luminous cyan accent
   (harmonizing with the architecture diagrams), geometric display headings, and
   hairline chrome. The light scheme is a clean, restrained toggle.
   ============================================================================ */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap");

/* --- Palette: dark (primary) ---------------------------------------------- */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0a0d14;
  --md-default-fg-color: #c9d2e3;
  --md-default-fg-color--light: #8b93a8;
  --md-default-fg-color--lighter: rgba(150, 175, 215, 0.20);
  --md-default-fg-color--lightest: rgba(130, 165, 210, 0.10);
  --md-code-bg-color: #10141d;
  --md-code-fg-color: #cdd6e6;
  --md-accent-fg-color: #38bdf8;
  --md-typeset-a-color: #4fc3f7;
  --md-primary-fg-color: #0a0d14; /* header shares the canvas */
  --md-primary-bg-color: #e7edf7;
  --md-footer-bg-color: #080b11;

  --sf-surface: #10141d;
  --sf-hairline: rgba(130, 165, 210, 0.14);
  --sf-hairline-lo: rgba(130, 165, 210, 0.09);
  --sf-accent: #38bdf8;
  --sf-accent-soft: rgba(56, 189, 248, 0.13);
}

/* --- Palette: light (toggle) ---------------------------------------------- */
[data-md-color-scheme="default"] {
  --md-accent-fg-color: #0891b2;
  --md-typeset-a-color: #0e7490;
  --md-default-fg-color--light: #4a5568;
  --md-footer-bg-color: #0a0d14;

  --sf-surface: #f5f7fa;
  --sf-hairline: rgba(15, 30, 60, 0.12);
  --sf-hairline-lo: rgba(15, 30, 60, 0.07);
  --sf-accent: #0891b2;
  --sf-accent-soft: rgba(8, 145, 178, 0.09);
}

/* --- Base typography ------------------------------------------------------ */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.md-typeset {
  font-size: 0.78rem;
  line-height: 1.72;
  letter-spacing: -0.003em;
  color: var(--md-default-fg-color);
}

/* Geometric display face for headings + brand — the sci-fi cue. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-header__title {
  font-family: "Space Grotesk", "Inter", -apple-system, sans-serif;
}
.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.9rem;
  margin-bottom: 0.5em;
  color: var(--md-default-fg-color);
}
.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.34rem;
  margin-top: 2.4em;
  padding-bottom: 0.36em;
  border-bottom: 1px solid var(--sf-hairline);
}
.md-typeset h3 {
  font-weight: 600;
  letter-spacing: -0.006em;
  font-size: 1.04rem;
  margin-top: 1.7em;
}
.md-typeset h4 {
  font-weight: 600;
  font-size: 0.86rem;
}
::selection {
  background: var(--sf-accent-soft);
}

/* --- Header + tabs: seamless canvas, cyan hairline ------------------------ */
.md-header,
.md-header--shadow {
  box-shadow: none;
  border-bottom: 1px solid var(--sf-hairline);
}
.md-tabs {
  border-bottom: 1px solid var(--sf-hairline);
}
.md-header__title {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.md-tabs__link {
  font-size: 0.72rem;
  opacity: 0.7;
}
.md-tabs__link--active,
.md-tabs__link:hover {
  opacity: 1;
}
[data-md-color-scheme="default"] .md-header,
[data-md-color-scheme="default"] .md-tabs {
  color: var(--md-default-fg-color);
}

/* --- Content column: use the viewport on large screens -------------------- */
.md-grid {
  max-width: 1440px;
}
@media screen and (min-width: 100em) {
  .md-grid {
    max-width: 1680px;
  }
}
/* Keep prose to a comfortable measure; tables, code, cards, diagrams go wide. */
.md-typeset > p,
.md-typeset > ul,
.md-typeset > ol,
.md-typeset > blockquote {
  max-width: 46rem;
}
.hero-tagline,
.md-typeset .grid,
.md-typeset table,
.md-typeset .admonition,
.md-typeset pre,
.md-typeset details,
.md-typeset iframe {
  max-width: none;
}

/* --- Links ---------------------------------------------------------------- */
.md-typeset a {
  text-decoration: none;
  transition: color 100ms;
}
.md-typeset a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

/* --- Tables: framed, hairline, cool header -------------------------------- */
.md-typeset table:not([class]) {
  font-size: 0.72rem;
  border: 1px solid var(--sf-hairline);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--sf-surface);
}
.md-typeset table:not([class]) th {
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--sf-accent-soft);
  color: var(--md-default-fg-color);
  border: none;
}
.md-typeset table:not([class]) td {
  border: none;
  border-top: 1px solid var(--sf-hairline-lo);
}
.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  padding: 0.5rem 0.9rem;
}
.md-typeset table:not([class]) tr:hover td {
  background: var(--sf-hairline-lo);
}
/* Endpoint / identifier names in tables should not wrap mid-token. */
.md-typeset table:not([class]) code {
  white-space: nowrap;
}

/* --- Admonitions + details: hairline with a cyan edge --------------------- */
.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--sf-hairline);
  border-left: 2px solid var(--sf-accent);
  border-radius: 6px;
  box-shadow: none;
  font-size: 0.74rem;
  background: var(--sf-surface);
}
.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 600;
  background: transparent;
}

/* --- Code ----------------------------------------------------------------- */
.md-typeset code {
  font-size: 0.84em;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.md-typeset :not(pre) > code {
  background: var(--sf-accent-soft);
  color: var(--md-default-fg-color);
}
.md-typeset pre > code {
  font-size: 0.76rem;
  line-height: 1.6;
}
.highlight {
  border-radius: 8px;
}
[data-md-color-scheme="slate"] .md-typeset pre > code {
  border: 1px solid var(--sf-hairline-lo);
  border-radius: 8px;
}

/* --- Buttons: cyan primary ------------------------------------------------ */
.md-typeset .md-button {
  border-radius: 7px;
  border-width: 1px;
  font-weight: 600;
  padding: 0.5em 1.15em;
  transition: background-color 130ms, color 130ms, border-color 130ms, box-shadow 130ms;
}
.md-typeset .md-button + .md-button {
  margin-left: 0.45rem;
}
.md-typeset .md-button--primary {
  background: var(--sf-accent);
  border-color: var(--sf-accent);
  color: #06121c;
}
.md-typeset .md-button--primary:hover {
  background: transparent;
  color: var(--sf-accent);
  box-shadow: 0 0 0 1px var(--sf-accent), 0 0 18px -6px var(--sf-accent);
}
.md-typeset .md-button:not(.md-button--primary):hover {
  border-color: var(--sf-accent);
  color: var(--sf-accent);
}

/* --- Grid cards: hairline + cyan hover glow ------------------------------- */
.md-typeset .grid.cards > ul > li {
  border: 1px solid var(--sf-hairline);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  background: var(--sf-surface);
  box-shadow: none;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.md-typeset .grid.cards > ul > li:hover {
  border-color: var(--sf-accent);
  transform: translateY(-2px);
  box-shadow: 0 0 22px -10px var(--sf-accent);
}
.md-typeset .grid.cards > ul > li > hr {
  margin: 0.6em 0;
  background: var(--sf-hairline);
}
.md-typeset .grid.cards > ul > li > p:first-child {
  font-weight: 600;
  font-size: 0.9rem;
}

/* --- Home hero ------------------------------------------------------------ */
.md-typeset .hero-tagline > p {
  font-size: 1.04rem;
  line-height: 1.62;
  color: var(--md-default-fg-color--light);
  max-width: 44rem;
  margin: 0.35rem 0 1.4rem;
}

/* --- Embedded diagram iframes --------------------------------------------- */
.md-typeset iframe.diagram {
  width: 100%;
  border: 1px solid var(--sf-hairline);
  border-radius: 10px;
  /* Match the diagram documents' own background: a white box would flash
     while the lazy-loaded iframe paints against the dark-first theme. */
  background: #020617;
}

/* --- Sidebar nav ---------------------------------------------------------- */
.md-nav {
  font-size: 0.7rem;
}
.md-nav__title {
  font-weight: 600;
}
.md-nav__link--active,
.md-nav__link:focus,
.md-nav__link:hover {
  color: var(--sf-accent);
}

/* --- Footer --------------------------------------------------------------- */
.md-footer-meta {
  font-size: 0.68rem;
}
