/* ---------------------------------------------------------------
   Bat — Notes
   Plain, fast, responsive. No framework, no build step.
   Readable column + system fonts = instant load on any device.
   --------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --fg: #1b1b1a;
  --muted: #6b6b66;
  --accent: #b5482e;
  --link: #2f6f7a;
  --link-soft: rgba(47,111,122,.38);
  --rule: #ececec;
  --maxw: 680px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

/* Always light/white — force it even if the OS is in dark mode. */
:root { color-scheme: light; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main, .hero, footer { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Article pages: tuned for reading, not for filling the screen.
   ~700px measure ≈ 70 chars/line, 19px text, 1.7 line-height — the
   typographic sweet spot. Figures may run a little wider than the text. */
/* Desktop style modeled on lilianweng.github.io (Hugo PaperMod theme):
   ~720px content column, system sans, 18px body, 1.6 leading, TOC box. */
body.wide main, body.wide footer { max-width: 768px; }   /* 720px content + 2×24px gutters */
.article { font-size: 16px; line-height: 1.6; }           /* matches lilianweng.github.io */
.article p { margin: 0 0 1.2em; }
.article .dek { font-size: 1.1em; line-height: 1.5; color: var(--muted); }
/* Content / citation links: same color as the paragraph text, plain underline. */
.article a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.article a:hover { text-decoration-thickness: 2px; }
.article .refs a { color: var(--fg); }

html { scroll-behavior: smooth; }
:target { scroll-margin-top: 24px; }

/* Table-of-contents box (PaperMod .toc) — compact, muted links */
.toc { margin: 8px 0 36px; border: 1px solid var(--rule); background: #f6f6f4; border-radius: 8px; padding: 8px 10px; font-size: 14px; line-height: 1.5; }
.toc > summary { cursor: pointer; font-weight: 600; padding: 4px 8px; color: var(--fg); }
.toc .inner { margin: 0; padding: 6px 8px 4px; }
.toc ol { margin: 0; padding-left: 30px; }
.toc li { margin: 1px 0; }
.toc .inner a { color: var(--muted); text-decoration: none; }
.toc .inner a:hover { color: var(--accent); text-decoration: underline; }

/* ---- Hero ---- */
.hero { padding-top: 64px; padding-bottom: 8px; }

.site-title {
  font-size: clamp(48px, 12vw, 96px);
  line-height: 0.95;
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.tagline {
  color: var(--muted);
  font-size: clamp(18px, 4vw, 24px);
  margin: 12px 0 0;
  min-height: 2.4em; /* reserve space so Pretext layout doesn't shift content */
}

/* Pretext-arranged words get absolutely positioned inside this box */
.tagline.pretext-ready { position: relative; }
.tagline .px-word {
  position: absolute;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px) rotate(var(--rot, 0deg));
  transition: opacity .5s ease, transform .5s ease;
  transition-delay: var(--delay, 0s);
}
.tagline .px-word.in { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); }

@media (prefers-reduced-motion: reduce) {
  .tagline .px-word { transition: none; }
}

/* ---- Nav ---- */
.topnav {
  display: flex;
  gap: 20px;
  margin: 40px 0 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 16px;
}
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a[aria-current="page"], .topnav a:hover { color: var(--fg); }

/* ---- Post list ---- */
.post-list { margin: 24px 0 64px; }
.post-link { padding: 24px 0; border-bottom: 1px solid var(--rule); }
.post-link a { text-decoration: none; color: inherit; display: block; }
.post-link h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.01em; }
.post-link a:hover h2 { color: var(--accent); }
.post-link .excerpt { margin: 8px 0 0; color: var(--muted); }
.meta { color: var(--muted); font-size: 14px; margin: 0; }
.status {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #f6f6f4;
  vertical-align: 1px;
}
.status-review { color: var(--accent); border-color: currentColor; background: #fff; }

/* ---- Article (post pages) ---- */
.article { margin: 24px 0 80px; }
.article h1 { font-size: clamp(30px, 7vw, 42px); line-height: 1.1; letter-spacing: -0.02em; margin: 8px 0 4px; }
.article .meta { margin-bottom: 32px; }
.article p { margin: 0 0 20px; }
.article h2 { margin: 40px 0 12px; font-size: 24px; }
.article h3 { margin: 32px 0 8px; font-size: 19px; }
.article a:visited { color: var(--fg); }
.article blockquote {
  margin: 24px 0; padding: 4px 20px;
  border-left: 3px solid var(--rule); color: var(--muted); font-style: italic;
}
.article pre {
  background: rgba(127,127,127,.10); padding: 16px; border-radius: 8px;
  overflow-x: auto; font-size: 14px; line-height: 1.5;
}
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.article pre code { font-size: inherit; }
.article img { max-width: 100%; height: auto; border-radius: 8px; }

.backlink { display: inline-block; margin: 0 0 24px; color: var(--muted); text-decoration: none; font-size: 15px; }
.backlink:hover { color: var(--fg); }

/* ---- Figures ---- */
/* Figures — small, centered, no border, centered caption (like the reference). */
.article figure { margin: 30px auto; max-width: 560px; }
.article figure img { width: 100%; height: auto; display: block; border-radius: 4px; }
.article figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.5; text-align: center; }
.article figcaption b { color: var(--fg); font-weight: 600; }

/* ---- Article extras ---- */
.dek { font-size: clamp(18px, 4.5vw, 22px); color: var(--muted); line-height: 1.45; margin: 0 0 28px; }
.article ul, .article ol { margin: 0 0 20px; padding-left: 24px; }
.article li { margin: 6px 0; }
.article hr { border: none; border-top: 1px solid var(--rule); margin: 40px 0; }
.article table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 15px; }
.article th, .article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.article th { font-weight: 600; }
.refs { font-size: 14px; line-height: 1.55; color: var(--muted); }
.refs li { margin: 7px 0; }
.refs a { color: var(--fg); word-break: break-word; }
.footnote-num { font-size: 0.7em; vertical-align: super; color: var(--accent); text-decoration: none; padding: 0 1px; }

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--rule);
  padding-top: 24px; padding-bottom: 48px;
  color: var(--muted); font-size: 14px;
}
footer a { color: var(--muted); }
