/*
 * Webfonts matching the Marimo notebook reports (PT Sans / Lora / Fira Mono),
 * loaded from the same jsDelivr-hosted bundle Marimo ships.
 * Filenames are content-hashed and pinned to marimo 0.23.9 — re-check/bump
 * these URLs whenever the marimo dependency is upgraded.
 */
@font-face {
  font-family: "PT Sans";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/PTSans-Regular-Bam3NpBI.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "PT Sans";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/PTSans-Bold-C_DwAp7Z.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/Lora-VariableFont_wght-CZceb_kH.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Fira Mono";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/FiraMono-Regular-CEsLFVD9.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Fira Mono";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/FiraMono-Medium-D5MAsWEG.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Fira Mono";
  src: url("https://cdn.jsdelivr.net/npm/@marimo-team/frontend@0.23.9/dist/assets/FiraMono-Bold-C6PDArdf.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #555555;
  --link: #0066cc;
  --border: #dddddd;
  --code-bg: #f5f5f5;
  --code-accent: #0066cc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1f1f;
    --fg: #ffffff;
    --fg-muted: #aaaaaa;
    --link: #6cb6ff;
    --border: #5a5a5a;
    --code-bg: #2d2d2d;
    --code-accent: #66d9aa;
  }
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: "PT Sans", ui-sans-serif, system-ui, sans-serif;
  /* Marimo's prose paragraphs land at ~14.4px (its app sets a ~90% base); match it. */
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 50rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
  padding-block: 2rem;
}

a {
  color: var(--link);
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Lora", serif;
  /* Marimo renders Lora headings at the regular weight, not the browser-default bold,
   * with its ligatures on — otherwise the variable font shows its 700 master. */
  font-weight: 400;
  font-feature-settings: "rlig" 1, "calt" 1;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

/* 2.25em of the ~14.4px base ≈ 32.4px, matching the reports' h1. */
h1 { margin-top: 0; font-size: 2.25em; }

p { margin-block: 1em; }

code {
  font-family: "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  background-color: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  font-family: "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  background-color: var(--code-bg);
  padding: 1em;
  border-radius: 4px;
  border-left: 3px solid var(--code-accent);
  overflow-x: auto;
  margin-block: 1.5em;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 1em;
}

table {
  border-collapse: collapse;
  margin-block: 1.5em;
}

th, td {
  padding: 0.5em 1em;
  border: 1px solid var(--border);
  text-align: left;
}

th {
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

img, video {
  max-width: 100%;
  height: auto;
}

blockquote {
  margin-inline: 0;
  padding-inline: 1em;
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
}

/* Anchor links */
a.anchor-link {
  opacity: 0;
  display: inline;
  transition: opacity 0.2s ease;
  text-decoration: none;
  color: var(--fg-muted);
}
a.anchor-link::after {
  content: '#';
  font-size: 0.8em;
  margin-inline: 0.4em;
}
:hover > a.anchor-link {
  opacity: 1;
}
