/* Shared by the home page and article pages: tokens, type, top bar, footer. */
@font-face {
  font-family: "Latin Modern";
  src: url("./libs/latex-css-1.8.0/fonts/LM-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern";
  src: url("./libs/latex-css-1.8.0/fonts/LM-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern";
  src: url("./libs/latex-css-1.8.0/fonts/LM-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --rule: #d6d6d6;
  --link: #1b3fb5;
  --tint: #f2f3f5;
  --focus: #deeaff;

  /* Tool chrome (top bar, capture UI, code blocks) stays dark in both themes. */
  --cap-bg: #1a1c1f;
  --cap-ink: #e8eaed;
  --cap-muted: #a9afb8;
  --cap-rule: #33363b;
  --cap-select: #2c4a8f;
  --cap-link: #8fb2ff;

  --serif: "Latin Modern", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141517;
    --ink: #e8e8e6;
    --muted: #a2a2a0;
    --rule: #333538;
    --link: #8fb2ff;
    --tint: #212327;
    --focus: #29364f;
  }
}

:root[data-theme="dark"] {
  --paper: #141517;
  --ink: #e8e8e6;
  --muted: #a2a2a0;
  --rule: #333538;
  --link: #8fb2ff;
  --tint: #212327;
  --focus: #29364f;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--cap-link); outline-offset: 2px; }

/* --------------------------------------------------------------- top bar */
.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  padding: 6px 20px;
  background: var(--cap-bg);
  border-bottom: 1px solid var(--cap-rule);
  font: 13px var(--mono);
}

.site-bar a { padding: 6px 0; color: var(--cap-muted); text-decoration: none; }
.site-bar a:hover { color: var(--cap-ink); }
.site-bar .brand { margin-right: auto; color: var(--cap-ink); font-weight: 500; }
.site-bar .theme-toggle { --size: 36px; --icon-fill: var(--cap-ink); --icon-fill-hover: #fff; padding: 8px; color: var(--cap-ink); }

/* ---------------------------------------------------------------- footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  margin-top: 64px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-size: 15px;
  color: var(--muted);
}

.site-footer nav { display: flex; gap: 20px; }
.site-footer a:hover { color: var(--link); }

@media (max-width: 860px) {
  .site-bar { padding: 4px 16px; gap: 2px 16px; }
  .site-bar .optional { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
