/* Bifrost docs — a faithful port of the app's "candlelit cyber-cathedral" UI:
   the exact theme tokens (frontend/src/theme.ts), the candle-over-void canvas
   with film grain, the aurora-clipped wordmark, gold filigree rules, and frosted
   gothic-glass surfaces. Keep these in sync with theme.ts. */

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

:root {
  /* Base palette — the "Candlelit Cathedral" theme, verbatim. */
  --bf-void: #09080b;
  --bf-panel: #121116;
  --bf-surface: #19171d;
  --bf-surface-hi: #23202a;
  --bf-surface-off: #121016;
  --bf-text: #ece6f0;
  --bf-dim: #a6a1ab;
  --bf-faint: #6f6772;
  --bf-cyan: #38bdf8;
  --bf-violet: #a78bfa;
  --bf-gold: #c8a24b;
  --bf-gold-bright: #e6c878;
  --bf-rose: #f43f5e;
  --bf-good: #5fb87a;
  --bf-ink: #04121b;
  /* Derived translucencies (deriveVars in theme.ts). */
  --bf-hairline: rgba(200, 162, 75, 0.2);
  --bf-gold-inner: rgba(200, 162, 75, 0.35);
  --bf-glass-sheen: rgba(236, 230, 240, 0.06);
  --bf-glass-top: rgba(25, 23, 29, 0.66);
  --bf-glass-bot: rgba(18, 16, 22, 0.76);
  /* The gilded rule under a header: gold → violet → cyan → out. */
  --bf-rule: linear-gradient(90deg, rgba(200, 162, 75, 0.55), rgba(167, 139, 250, 0.22) 42%, rgba(56, 189, 248, 0.12) 70%, transparent);
  /* The aurora wordmark gradient (the runic brand). */
  --bf-aurora: linear-gradient(110deg, #7dd3fc 0%, #a5b4fc 25%, #f0abfc 50%, #5eead4 75%, #7dd3fc 100%);
}

.md-grid {
  max-width: 64rem;
}

/* ── Dark scheme (default) — maps Material onto the Bifrost tokens ─────────── */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--bf-void);
  --md-default-fg-color: var(--bf-text);
  --md-default-fg-color--light: var(--bf-dim);
  --md-default-fg-color--lighter: var(--bf-faint);
  --md-default-fg-color--lightest: #45413a;
  --md-primary-fg-color: var(--bf-panel);
  --md-primary-bg-color: var(--bf-text);
  --md-accent-fg-color: var(--bf-gold-bright);
  --md-typeset-a-color: var(--bf-cyan);
  --md-code-bg-color: #14131a;
  --md-code-fg-color: #d7e6f2;
  --md-typeset-mark-color: rgba(56, 189, 248, 0.25);
  --md-footer-bg-color: #0a090d;
  --md-footer-fg-color: var(--bf-dim);
}

/* The app canvas: a faint warm candlelight glow up top over the gothic void. */
[data-md-color-scheme="slate"] body {
  background:
    radial-gradient(110% 70% at 50% -12%, #241c10 0%, transparent 48%),
    var(--bf-void);
  background-attachment: fixed;
}

/* Film grain over the whole canvas — the app's stone/parchment tooth. */
[data-md-color-scheme="slate"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Header: frosted gothic bar with a gilded hairline + aurora wordmark ───── */
.md-header {
  background: linear-gradient(180deg, #131119, #0c0b10);
  border-bottom: 1px solid var(--bf-hairline);
  box-shadow: 0 1px 0 rgba(56, 189, 248, 0.08), 0 2px 16px rgba(0, 0, 0, 0.55);
}
.md-tabs {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
/* The site title gets the panning aurora wordmark, like the app's brand. */
.md-header__title .md-ellipsis {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  background-image: var(--bf-aurora);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: bf-pan 16s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(125, 211, 252, 0.25));
}
@keyframes bf-pan {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

/* ── Display font + gilded headings ───────────────────────────────────────── */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-family: "Cinzel", serif;
  letter-spacing: 0.01em;
  font-weight: 600;
}
.md-typeset h1 {
  color: var(--bf-gold-bright);
  text-shadow: 0 0 26px rgba(200, 162, 75, 0.2);
}
.md-typeset h2 {
  color: #f3eddf;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid transparent;
  border-image: var(--bf-rule) 1;
}
.md-typeset h3 {
  color: var(--bf-cyan);
}
.md-typeset a:hover {
  color: var(--bf-gold-bright);
}
.md-nav__link--active,
.md-nav__link--active > * {
  color: var(--bf-gold-bright) !important;
}

/* ── Frosted gothic-glass surfaces (the app's signature card) ─────────────── */
[data-md-color-scheme="slate"] .md-typeset table:not([class]),
[data-md-color-scheme="slate"] .md-typeset pre,
[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background: linear-gradient(176deg, var(--bf-glass-top) 0%, var(--bf-glass-bot) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bf-hairline);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 var(--bf-glass-sheen),
    inset 0 0 30px -18px var(--bf-gold-inner),
    0 14px 34px -16px rgba(0, 0, 0, 0.78);
}
.md-typeset table:not([class]) {
  overflow: hidden;
}
.md-typeset table:not([class]) th {
  background: linear-gradient(180deg, rgba(200, 162, 75, 0.16), rgba(200, 162, 75, 0.04));
  color: #f3eddf;
  font-family: "Cinzel", serif;
  font-weight: 600;
  letter-spacing: 0.03em;
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:hover {
  background: rgba(56, 189, 248, 0.05);
}

/* Code: a faint gold rim on blocks, a cyan rim on inline tokens. */
[data-md-color-scheme="slate"] .md-typeset :not(pre) > code {
  border: 1px solid rgba(56, 189, 248, 0.16);
}

/* ── Home hero: the centred README logo + brand wordmark ──────────────────── */
.md-typeset h1[align="center"],
.md-typeset p[align="center"] {
  text-align: center;
}
.md-typeset p[align="center"] img {
  filter: drop-shadow(0 0 22px rgba(56, 189, 248, 0.35));
}
/* The home "Bifrost" title wears the aurora wordmark instead of plain gold. */
.md-typeset h1[align="center"] {
  font-size: 2.7rem;
  background-image: var(--bf-aurora);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  animation: bf-pan 16s ease-in-out infinite;
}

/* Misc accents. */
.md-typeset hr {
  border: none;
  height: 1px;
  background: var(--bf-rule);
}
.md-search__input::placeholder {
  color: rgba(236, 230, 240, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .md-header__title .md-ellipsis,
  .md-typeset h1[align="center"] {
    animation: none;
  }
}
