/* ==========================================================================
   asiai Design System — "Precision Instrument"
   Unifies dashboard, homepage, and docs under one visual identity.
   ========================================================================== */

/* --- Geist Fonts (self-hosted, no Google Fonts CDN) --- */

@font-face {
  font-family: 'Geist Sans';
  src: url('../fonts/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Sans';
  src: url('../fonts/Geist-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Sans';
  src: url('../fonts/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Sans';
  src: url('../fonts/Geist-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- Typography override --- */

:root {
  --md-text-font: 'Geist Sans', system-ui, -apple-system, sans-serif;
  --md-code-font: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Dark mode: "Precision Instrument" palette --- */

[data-md-color-scheme="slate"] {
  /* Background hierarchy */
  --md-default-bg-color: #09090b;
  --md-default-bg-color--light: #111113;
  --md-default-bg-color--lighter: #18181b;
  --md-default-bg-color--lightest: #1f1f23;

  /* Code & surfaces — enough contrast vs #09090b bg */
  --md-code-bg-color: #161618;

  /* Accent — Cyan */
  --md-primary-fg-color: #06b6d4;
  --md-primary-fg-color--light: rgba(6, 182, 212, 0.7);
  --md-primary-fg-color--dark: #0891b2;
  --md-primary-bg-color: #09090b;
  --md-primary-bg-color--light: #111113;

  --md-accent-fg-color: #06b6d4;
  --md-accent-fg-color--transparent: rgba(6, 182, 212, 0.1);
  --md-accent-bg-color: #06b6d4;
  --md-accent-bg-color--light: rgba(6, 182, 212, 0.1);

  /* Text */
  --md-default-fg-color: #fafafa;
  --md-default-fg-color--light: #a1a1aa;
  --md-default-fg-color--lighter: #71717a;
  --md-default-fg-color--lightest: #27272a;

  /* Typeset links */
  --md-typeset-a-color: #06b6d4;

  /* Header — dark bg, not accent-colored */
  --md-header-bg-color: #0d0d0f;
  --md-header-fg-color: #fafafa;

  /* Footer */
  --md-footer-bg-color: #09090b;
  --md-footer-bg-color--dark: #09090b;

  /* Nav/sidebar */
  --md-sidebar-bg-color: #09090b;
}

/* Header bar — solid dark, all elements white */
[data-md-color-scheme="slate"] .md-header {
  background-color: #0d0d0f;
  border-bottom: 1px solid #1c1c1f;
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-header__button,
[data-md-color-scheme="slate"] .md-header .md-header__button img,
[data-md-color-scheme="slate"] .md-header .md-search__icon,
[data-md-color-scheme="slate"] .md-header .md-icon {
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-header__topic {
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-search__form {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
[data-md-color-scheme="slate"] .md-header .md-search__input {
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
[data-md-color-scheme="slate"] .md-header .md-source {
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-source__icon svg {
  fill: #fafafa;
}
[data-md-color-scheme="slate"] .md-header .md-select__link {
  color: #fafafa;
}

/* Tabs bar */
[data-md-color-scheme="slate"] .md-tabs {
  background-color: #09090b;
  border-bottom: 1px solid #1c1c1f;
}

/* Inline code — visible against page bg */
[data-md-color-scheme="slate"] .md-typeset code {
  background-color: #1a1a1e;
  border: 1px solid #27272a;
}

/* Code blocks — distinct surface */
[data-md-color-scheme="slate"] .md-typeset pre > code {
  background-color: #0f0f12;
  border: 1px solid #1c1c1f;
}

/* Nav sidebar — ensure text contrast */
[data-md-color-scheme="slate"] .md-nav__link {
  color: #a1a1aa;
}
[data-md-color-scheme="slate"] .md-nav__link:hover,
[data-md-color-scheme="slate"] .md-nav__link--active {
  color: #fafafa;
}
[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link {
  color: #06b6d4;
}

/* Tables — subtle borders */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background-color: #111113;
  border-bottom: 1px solid #1c1c1f;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) td {
  border-bottom: 1px solid #1c1c1f;
}

/* Admonitions — darker backgrounds + ARIA role */
[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background-color: #111113;
  border-color: #1c1c1f;
}

/* Search */
[data-md-color-scheme="slate"] .md-search__form {
  background-color: #111113;
  border: 1px solid #1c1c1f;
}

/* --- Light mode: lighter cyan accent --- */

[data-md-color-scheme="default"] {
  --md-primary-fg-color: #0891b2;
  --md-primary-fg-color--light: rgba(8, 145, 178, 0.7);
  --md-primary-fg-color--dark: #0e7490;

  --md-accent-fg-color: #0891b2;
  --md-accent-fg-color--transparent: rgba(8, 145, 178, 0.1);

  --md-typeset-a-color: #0891b2;
}

/* --- Subtle refinements --- */

/* Language selector — click instead of hover (WCAG 4.1.2) */
.md-select .md-select__inner {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.md-select:focus-within .md-select__inner,
.md-select.md-select--open .md-select__inner {
  opacity: 1;
  pointer-events: auto;
}
/* Override hover behavior — only show on focus-within or JS toggle */
.md-select:hover .md-select__inner {
  opacity: 0;
  pointer-events: none;
}
.md-select:hover:focus-within .md-select__inner,
.md-select:hover.md-select--open .md-select__inner {
  opacity: 1;
  pointer-events: auto;
}

/* Links in tables — underline for accessibility (WCAG 1.4.1) */
[data-md-color-scheme="slate"] .md-typeset table a,
[data-md-color-scheme="default"] .md-typeset table a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
[data-md-color-scheme="slate"] .md-typeset table a:hover {
  color: #06b6d4;
}

/* Smoother scrollbar (dark mode) */
[data-md-color-scheme="slate"] ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-track {
  background: #09090b;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 3px;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}
