/* Malva design tokens, aligned with the current app theme
   (malva_explorer/static/css/malva.css, "Kirby" tokens):
   - dark: golden primary #ffc83e on #0d1116, teal accent #7fe0d4
   - light: slate primary #1b1b1b on #f4f5f3 */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #1b1b1b;
  --md-primary-fg-color--light: #5f6d78;
  --md-primary-fg-color--dark: #15191c;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #1b1b1b;
  --md-text-link-color: #1b1b1b;
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #ffc83e;
  --md-primary-fg-color--light: #ffe08a;
  --md-primary-fg-color--dark: #e0ac1f;
  --md-primary-bg-color: #0d1116;
  --md-accent-fg-color: #7fe0d4;
  --md-text-link-color: #ffc83e;
}

/* Brand font stack, with Noto Sans SC fallback for CJK glyphs
   (matches base.html: Space Grotesk + Noto Sans SC + DM Mono). */
:root,
[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-text-font-family: "Space Grotesk", "Noto Sans SC", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --md-code-font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;
}

/* Slightly rounder code blocks and tables to match the app look. */
.md-typeset code {
  border-radius: 4px;
}

.md-typeset table:not([class]) {
  border-radius: 8px;
  overflow: hidden;
}

/* Larger brand logo in the header. */
.md-header__button.md-logo img {
  border-radius: 6px;
}

/* "Back to Malva" button, injected by
   assets/javascripts/back-to-app.js. It uses the header foreground and
   background variables, so it adapts to both colour schemes. */
.md-back-to-app {
  display: inline-flex;
  align-items: center;
  margin-left: 0.6rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  color: var(--md-primary-bg-color);
  border-color: var(--md-primary-bg-color);
  transition: background-color 120ms ease, color 120ms ease;
}

.md-back-to-app:hover {
  color: var(--md-primary-fg-color);
  background-color: var(--md-primary-bg-color);
}

.md-back-to-app-short {
  display: none;
}

@media (max-width: 45em) {
  .md-back-to-app {
    margin-left: 0.3rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.68rem;
  }

  .md-back-to-app-full {
    display: none;
  }

  .md-back-to-app-short {
    display: inline;
  }
}

/* Version selector label, rendered by the theme next to the site title.
   It already inherits the header text colour; this keeps the hover state
   consistent with the rest of the header. */
.md-version__current:hover {
  opacity: 0.85;
}

/* Highlight the "Tutorials" entry in the sidebar navigation. */
.md-nav__link[href="tutorials/"] {
  font-weight: 700;
}

/* Responsive inline video embeds (see tutorials.md). */
.malva-video {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1rem 0;
}

.malva-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}
