/* Learn LLM: palette taken from the post covers (deep teal, orange rule, mint). */
:root {
  --teal-900: #122a29;
  --teal-800: #16302f;
  --teal-700: #1d4543;
  --teal-600: #275a56;
  --orange: #ef8f3c;
  --orange-ink: #b55d12;
  --mint: #7fd4b2;
  --paper: #f8f6f1;
  --card: #ffffff;
  --ink: #15201f;
  --ink-2: #3c4a48;
  --muted: #687674;
  --line: #e4e0d6;
  --code-bg: #f0eee7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 42, 41, 0.06), 0 8px 24px -12px rgba(18, 42, 41, 0.18);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Charter", "Source Serif Pro", "Georgia", "Songti SC", "Noto Serif SC", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.wrap-narrow { width: min(700px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: #fff; padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(18, 42, 41, 0.94);
  backdrop-filter: saturate(1.4) blur(10px);
  color: #eef5f3;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; text-decoration: none; }
.brand-bar { width: 5px; height: 22px; background: var(--orange); border-radius: 2px; }
.brand-sm { font-size: 17px; }
.nav { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; color: #cfe0dc; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav .nav-sub { background: var(--orange); color: #1b1206; font-weight: 700; margin-left: 6px; }
.nav .nav-sub:hover { background: #f6a35a; color: #1b1206; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--orange); color: #1b1206; font-weight: 700; font-size: 16px;
  padding: 12px 20px; border-radius: 999px; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: #f6a35a; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: #e6f0ed; box-shadow: inset 0 0 0 1.5px rgba(230, 240, 237, 0.35); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- hero ---------- */
.hero {
  background: radial-gradient(1100px 500px at 85% 120%, rgba(127, 212, 178, 0.16), transparent 60%),
    linear-gradient(135deg, var(--teal-900), var(--teal-700));
  color: #f2f7f5;
  padding: 72px 0 80px;
}
.hero .wrap { border-left: 6px solid var(--orange); padding-left: 28px; }
.eyebrow { margin: 0 0 14px; color: #f2b27a; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.hero h1 { margin: 0; font-size: clamp(34px, 5.2vw, 60px); line-height: 1.07; letter-spacing: -0.025em; max-width: 16ch; }
.hero .lede { color: #c3d6d1; font-size: clamp(17px, 1.6vw, 20px); max-width: 60ch; margin: 20px 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections ---------- */
section.wrap { margin-top: 56px; }
.section-title { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; font-weight: 700; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.section-head .section-title { margin: 0; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.meta .kind { color: var(--orange-ink); font-weight: 700; }

.chips, .tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chips a, .tags a {
  display: inline-block; text-decoration: none; font-size: 14px;
  padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
}
.chips a:hover, .tags a:hover { border-color: var(--teal-600); color: var(--teal-700); }
.chips span { color: var(--muted); margin-left: 2px; }
.chips-lg a { font-size: 17px; padding: 10px 18px; }

/* lead */
.lead {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; overflow: hidden;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.lead-cover img, .lead-cover .cover-gen { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1200 / 630; }
.lead-body { padding: 32px 36px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.lead h3 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; }
.lead h3 a, .card h3 a { text-decoration: none; }
.lead h3 a:hover, .card h3 a:hover { color: var(--teal-600); }
.lead .summary { color: var(--ink-2); margin: 0 0 16px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-cover, .lead-cover { display: block; text-decoration: none; }
.card-cover img, .card-cover .cover-gen { aspect-ratio: 1200 / 630; width: 100%; object-fit: cover; }
.card-body { padding: 18px 20px 22px; }
.card h3 { font-size: 19px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.01em; }
.card .summary { margin: 0; color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* generated cover for posts without one */
.cover-gen {
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, var(--teal-900), var(--teal-600));
  color: #fff; padding: 0 9% 0 calc(9% + 10px); position: relative;
}
.cover-gen::before { content: ""; position: absolute; left: 7%; top: 22%; bottom: 22%; width: 5px; background: var(--orange); }
.cover-kicker { color: #f2b27a; font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.cover-title { font-weight: 800; font-size: clamp(17px, 1.9vw, 22px); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cover-gen.lg .cover-title { font-size: clamp(22px, 2.8vw, 34px); }

/* subscribe */
.subscribe {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--teal-800), var(--teal-700)); color: #eef5f3;
  border-radius: var(--radius); padding: 28px 32px; border-left: 6px solid var(--orange);
}
.subscribe h2 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.subscribe p { margin: 0; color: #c3d6d1; }

/* archive */
.page-head { margin-top: 56px; }
.page-head h1 { font-size: clamp(32px, 4vw, 46px); letter-spacing: -0.025em; margin: 0 0 8px; line-height: 1.1; }
.page-head .lede { color: var(--ink-2); font-size: 18px; margin: 0; }
.page-head .lede a { color: var(--teal-600); }
.archive { margin-top: 24px !important; }
.year { font-size: 15px; color: var(--muted); margin: 32px 0 6px; letter-spacing: .06em; }
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.row a { font-weight: 650; font-size: 18px; text-decoration: none; }
.row a:hover { color: var(--teal-600); }
.row .kind { color: var(--orange-ink); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- post ---------- */
.post-header { margin-top: 56px; }
.post-header h1 { font-size: clamp(32px, 4.6vw, 48px); line-height: 1.1; letter-spacing: -0.028em; margin: 6px 0 14px; }
.post-subtitle { font-size: 21px; line-height: 1.45; color: var(--ink-2); margin: 0 0 18px; }
.byline { color: var(--muted); font-size: 15px; margin: 0; padding-bottom: 24px; border-bottom: 1px solid var(--line); }

.prose { font-family: var(--serif); font-size: 19px; line-height: 1.72; margin-top: 32px; color: #1d2827; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3 { font-family: var(--sans); letter-spacing: -0.015em; line-height: 1.25; color: var(--ink); }
.prose h2 { font-size: 27px; margin: 1.9em 0 0.5em; }
.prose h3 { font-size: 21px; margin: 1.6em 0 0.4em; }
.prose h2 + *, .prose h3 + * { margin-top: 0; }
.prose a { color: var(--teal-600); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--orange-ink); }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: 0.4em; }
.prose li p { margin: 0; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--orange); color: var(--ink-2); }
.prose code { font-family: var(--mono); font-size: 0.82em; background: var(--code-bg); padding: 2px 6px; border-radius: 5px; }
.prose pre {
  font-size: 14.5px; line-height: 1.6; background: var(--teal-900); color: #dcebe7;
  padding: 18px 20px; border-radius: 12px; overflow-x: auto; margin: 1.5em 0;
}
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose figure { margin: 2em 0; }
.prose figure img { border-radius: 10px; border: 1px solid var(--line); margin-inline: auto; background: #fff; }
.prose figcaption { font-family: var(--sans); font-size: 14.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; text-align: center; }
.prose img { border-radius: 10px; margin: 1.6em auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 15px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.math-display { overflow-x: auto; overflow-y: hidden; margin: 1.4em 0; padding: 6px 0; }
.math-display .katex { font-size: 1.1em; }

.post[lang="zh-CN"] .prose { font-family: var(--sans); font-size: 18px; line-height: 1.85; }

.post-footer { margin-top: 56px; display: grid; gap: 24px; }
.origin { color: var(--muted); font-size: 15px; margin: 0; }
.origin a { color: var(--teal-600); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager-link { display: block; text-decoration: none; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 650; line-height: 1.35; }
.pager-link:last-child { text-align: right; }
.pager-link span { display: block; color: var(--muted); font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.pager-link:hover { border-color: var(--teal-600); }

/* ---------- footer ---------- */
.site-footer { margin-top: 96px; background: var(--teal-900); color: #b9ccc7; padding: 44px 0 28px; font-size: 15px; }
.site-footer .brand { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.footer-inner p { max-width: 46ch; margin: 10px 0 0; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.footer-links a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.footer-links a:hover { color: #fff; }
.footer-links svg { width: 15px; height: 15px; }
.footer-meta { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px; color: #8aa29c; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .lead { grid-template-columns: 1fr; }
  .lead-body { padding: 24px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid, .grid-2 { grid-template-columns: 1fr; }
  .nav a:not(.nav-sub):not([href="/archive/"]) { display: none; }
  .hero { padding: 48px 0 56px; }
  .hero .wrap { padding-left: 18px; border-left-width: 5px; }
  .prose { font-size: 17.5px; }
  .post-subtitle { font-size: 18.5px; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .row .kind { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager-link:last-child { text-align: left; }
  .subscribe { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
