/*
 * FlowDrop Office docs in the FlowDrop editor's look.
 *
 * Values come from FlowDrop's design tokens
 * (flowdrop_ui_components/lib/flowdrop/build/tokens.css): zinc grays, blue
 * primary, violet accent, light header, 8px surfaces and 12px bubbles, and
 * the editor's dark scheme.
 */

/* Light scheme: FlowDrop light tokens. */
[data-md-color-scheme="default"] {
  --fd-background: #fff;
  --fd-foreground: #18181c;
  --fd-muted: #f8f8fb;
  --fd-muted-foreground: #71717b;
  --fd-subtle: #f0f0f5;
  --fd-header: #f5f7fa;
  --fd-header-foreground: #27272b;
  --fd-border: #dcdce4;
  --fd-border-muted: #eaeaef;
  --fd-primary: #3b82f6;
  /* Primary hover token, used for link text so it passes AA on white. */
  --fd-primary-text: #1d4ed8;
  --fd-primary-muted: #eff6ff;
  --fd-accent: #8b5cf6;
  --fd-accent-muted: #f5f3ff;
  --fd-layout-background: linear-gradient(135deg, #f9fafb 0%, #e0e7ff 50%, #c7d2fe 100%);
}

/* Dark scheme: FlowDrop dark tokens. */
[data-md-color-scheme="slate"] {
  --fd-background: #1a1a1e;
  --fd-foreground: #f5f5f8;
  --fd-muted: #242428;
  --fd-muted-foreground: #dcdce4;
  --fd-subtle: #2a2a30;
  --fd-header: #1f1f24;
  --fd-header-foreground: #eaeaef;
  --fd-border: #3a3a40;
  --fd-border-muted: #2e2e33;
  --fd-primary: #60a5fa;
  --fd-primary-text: #93c5fd;
  --fd-primary-muted: rgb(59, 130, 246, 0.12);
  --fd-accent: #a78bfa;
  --fd-accent-muted: rgb(139, 92, 246, 0.12);
  --fd-layout-background: linear-gradient(135deg, #1a1a1e 0%, #1e1e2e 50%, #24243a 100%);
  --md-hue: 240;
}

/* Map FlowDrop tokens onto Material's variables. */
[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--fd-background);
  --md-default-fg-color: var(--fd-foreground);
  --md-default-fg-color--light: var(--fd-muted-foreground);
  --md-default-fg-color--lighter: var(--fd-border);
  --md-default-fg-color--lightest: var(--fd-border-muted);
  --md-primary-fg-color: var(--fd-header);
  --md-primary-fg-color--light: var(--fd-subtle);
  --md-primary-fg-color--dark: var(--fd-header);
  --md-primary-bg-color: var(--fd-header-foreground);
  --md-primary-bg-color--light: var(--fd-muted-foreground);
  --md-accent-fg-color: var(--fd-accent);
  --md-accent-fg-color--transparent: var(--fd-accent-muted);
  --md-typeset-color: var(--fd-foreground);
  --md-typeset-a-color: var(--fd-primary-text);
  --md-code-bg-color: var(--fd-muted);
  --md-code-fg-color: var(--fd-foreground);
  --md-footer-bg-color: var(--fd-header);
  --md-footer-bg-color--dark: var(--fd-subtle);
  --md-footer-fg-color: var(--fd-header-foreground);
  --md-footer-fg-color--light: var(--fd-muted-foreground);
  --md-footer-fg-color--lighter: var(--fd-muted-foreground);
}

/* Header and tabs: the editor's light navbar with a hairline border. */
.md-header,
.md-tabs {
  border-bottom: 1px solid var(--fd-border);
  box-shadow: none;
}

.md-header[data-md-state="shadow"],
.md-header--shadow {
  box-shadow: 0 1px 2px rgb(24, 24, 28, 0.06);
}

.md-tabs__link {
  opacity: 1;
  color: var(--fd-muted-foreground);
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: var(--fd-header-foreground);
}

/* Logo: larger, and on a light squircle in dark mode so its black outlines
   stay visible, like the rounded-square icons on editor nodes. */
.md-header__button.md-logo img {
  width: auto;
  height: 1.8rem;
}

[data-md-color-scheme="slate"] .md-header__button.md-logo img {
  padding: 0.1rem;
  border-radius: 0.5rem;
  background: #f5f5f8;
}

/* Sidebar titles sit on the page gradient, without Material's solid band. */
.md-nav__title,
.md-sidebar .md-nav__title,
.md-nav--lifted > .md-nav__list > .md-nav__item--active > .md-nav__link {
  background: transparent;
  box-shadow: none;
}

.md-search__form {
  border: 1px solid var(--fd-border);
  border-radius: 0.5rem;
  background: var(--fd-background);
}

/* The editor canvas gradient behind the page; content sits on a card. */
.md-main {
  background: var(--fd-layout-background) fixed;
}

.md-content {
  margin: 1rem 0;
  border: 1px solid var(--fd-border);
  border-radius: 0.5rem;
  background: var(--fd-background);
}

/* Type scale: the editor runs at 15px body text. */
.md-typeset {
  font-size: 0.75rem;
  line-height: 1.6;
}

.md-typeset h1 {
  color: var(--fd-foreground);
  font-weight: 700;
}

.md-typeset h2,
.md-typeset h3 {
  font-weight: 600;
}

/* Surfaces: 8px radius like nodes and cards. */
.md-typeset .admonition,
.md-typeset details,
.md-typeset pre > code,
.md-typeset .highlight,
.md-typeset table:not([class]) {
  border-radius: 0.5rem;
}

.md-typeset table:not([class]) {
  overflow: hidden;
  border: 1px solid var(--fd-border);
  box-shadow: none;
}

.md-typeset table:not([class]) th {
  color: var(--fd-header-foreground);
  background: var(--fd-header);
  font-weight: 600;
}

.md-typeset code {
  border-radius: 0.25rem;
}

.md-typeset .admonition,
.md-typeset details {
  border-width: 1px;
  box-shadow: none;
}

/* Note and warning in FlowDrop's info and warning colors. */
.md-typeset .admonition.note,
.md-typeset details.note {
  border-color: var(--fd-primary);
}

.md-typeset .note > .admonition-title,
.md-typeset .note > summary {
  background: var(--fd-primary-muted);
}

.md-typeset .note > .admonition-title::before,
.md-typeset .note > summary::before {
  background-color: var(--fd-primary);
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-color: #f59e0b;
}

.md-typeset .warning > .admonition-title,
.md-typeset .warning > summary {
  background: rgb(245, 158, 11, 0.12);
}

.md-typeset .warning > .admonition-title::before,
.md-typeset .warning > summary::before {
  background-color: #f59e0b;
}

/* Images framed like the FlowDrop docs, with the surface radius. */
article img {
  padding: 5px;
  border: 1px solid var(--fd-border);
  border-radius: 0.5rem;
  background: var(--fd-muted);
}
