:root {
  --ink: #172134;
  --muted: #687185;
  --paper: #fbfaf6;
  --card: #ffffff;
  --line: #dce2e8;
  --brand: #2468a2;
  --brand-dark: #17466f;
  --accent: #d7edf8;
  --code: #101725;
  --shadow: 0 18px 50px rgba(23, 33, 52, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--paper);
  font: 17px/1.72 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; height: auto; }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 20; background: white; padding: .75rem 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(220, 226, 232, .85);
  background: rgba(251, 250, 246, .94);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 126px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.brand { display: flex; flex-direction: column; gap: .1rem; margin-right: auto; text-decoration: none; color: var(--ink); }
.brand img { width: 310px; height: auto; display: block; }
.main-nav { display: flex; align-items: center; gap: 1.35rem; }
.main-nav a { color: var(--ink); font-size: .9rem; font-weight: 650; text-decoration: none; }
.main-nav a:hover { color: var(--brand); }
.menu-toggle { display: none; border: 1px solid var(--line); border-radius: 999px; background: white; padding: .55rem .9rem; font: inherit; }

main { min-height: 70vh; }
.hero {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(3.5rem, 7vw, 6rem) 0 clamp(3rem, 5vw, 4.5rem);
  position: relative;
}
.hero::after {
  content: "λ";
  position: absolute;
  z-index: -1;
  right: 1%;
  top: 8%;
  color: var(--accent);
  font: 700 clamp(12rem, 28vw, 25rem)/1 Georgia, serif;
}
.hero-kicker, .section-heading > span {
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 880px;
  margin: .5rem 0 1.4rem;
  font: 700 clamp(2.6rem, 4.8vw, 4.75rem)/1.02 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.hero p { max-width: 700px; margin: 0 0 2rem; color: var(--muted); font-size: clamp(1.1rem, 2vw, 1.35rem); }
.button {
  display: inline-flex;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: .82rem 1.3rem;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 9px 24px rgba(36, 104, 162, .2);
}
.button:hover { background: var(--brand-dark); color: white; }

.listing, .archive {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 3.5rem 0 7rem;
}
.home .listing { padding-top: 3rem; }
.section-heading { margin: 0 0 2.5rem; }
.section-heading :is(h1, h2) { margin: .25rem 0 .7rem; font: 700 clamp(2.2rem, 5vw, 4rem)/1.05 Georgia, serif; letter-spacing: -.03em; }
.section-heading p { max-width: 700px; color: var(--muted); }
.post-card {
  display: grid;
  grid-template-columns: minmax(180px, 270px) 1fr;
  gap: clamp(1.4rem, 4vw, 3rem);
  padding: 2.2rem 0;
  border-top: 1px solid var(--line);
}
.card-image { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: 12px; background: var(--accent); }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.post-card:hover .card-image img { transform: scale(1.025); }
.eyebrow { display: flex; flex-wrap: wrap; gap: .55rem 1.1rem; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow a { text-decoration: none; }
.post-card h2 { margin: .45rem 0 .65rem; font: 700 clamp(1.6rem, 3vw, 2.35rem)/1.12 Georgia, serif; letter-spacing: -.018em; }
.post-card h2 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover { color: var(--brand); }
.post-card p { margin: 0 0 .7rem; color: var(--muted); }
.read-more { font-weight: 750; text-decoration: none; }
.pagination { display: flex; gap: .5rem; margin-top: 2rem; }
.pagination a, .pagination span { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; }
.pagination span { color: white; background: var(--brand); border-color: var(--brand); }

.article-shell { width: min(860px, calc(100% - 40px)); margin: 0 auto; padding: clamp(4rem, 9vw, 8rem) 0 7rem; }
.article-header { margin-bottom: 2.8rem; }
.back-link { display: inline-block; margin-bottom: 2rem; font-weight: 700; text-decoration: none; }
.article-header h1 { margin: .7rem 0 1.2rem; font: 700 clamp(2.7rem, 7vw, 5.4rem)/1.02 Georgia, serif; letter-spacing: -.04em; }
.article-header h1, .section-heading h1 { overflow-wrap: anywhere; }
.article-content { font-family: Georgia, "Times New Roman", serif; font-size: 1.09rem; }
.article-content > :first-child { margin-top: 0; }
.article-content h2, .article-content h3, .article-content h4 { scroll-margin-top: 8rem; color: var(--ink); line-height: 1.2; }
.article-content h2 { margin: 2.8rem 0 1rem; font-size: 2rem; }
.article-content h3 { margin: 2.2rem 0 .8rem; font-size: 1.5rem; }
.article-content p { margin: 1.1rem 0; }
.article-content a { overflow-wrap: anywhere; }
.math-display {
  margin: 1.6rem 0;
  overflow-x: auto;
  text-align: center;
}
.article-content .math-display img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
}
.math-inline { display: inline-block; max-width: 100%; vertical-align: middle; }
.article-content .math-inline img {
  display: inline-block;
  max-width: 100%;
  height: 1.35em;
  width: auto;
  margin: 0 .08em;
  border-radius: 0;
  vertical-align: -.25em;
}
.article-content blockquote { margin: 2rem 0; padding: .25rem 0 .25rem 1.5rem; border-left: 4px solid var(--brand); color: var(--muted); font-style: italic; }
.article-content img { display: block; margin: 2rem auto; border-radius: 8px; }
.wp-caption { margin: 2.2rem auto; color: var(--muted); text-align: center; font-size: .88rem; }
.wp-caption img { margin-bottom: .7rem; }
.wp-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 2rem 0; }
.wp-gallery img { width: 100%; height: 100%; object-fit: cover; margin: 0; }
.embed-link { padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 10px; font-family: ui-sans-serif, system-ui, sans-serif; }
.code-block { position: relative; margin: 1.8rem 0; }
.article-content pre { overflow-x: auto; margin: 0; padding: 1.4rem; border-radius: 12px; background: var(--code); color: #eef5ff; font: .88rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 4; }
.article-content code { padding: .12em .35em; border-radius: 4px; background: #eaf0f5; color: #24384a; font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.article-content pre code { padding: 0; background: transparent; color: inherit; }
.copy-code { position: absolute; right: .65rem; top: .65rem; border: 1px solid #405069; border-radius: 999px; background: #1c2940; color: #f6f8fb; padding: .35rem .65rem; cursor: pointer; }
.article-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: .65rem .8rem; }
.article-tags { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); }
.post-navigation { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 3.5rem; }
.post-navigation a { padding: 1.2rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-weight: 700; }
.post-navigation span { display: block; margin-bottom: .25rem; color: var(--muted); font: 700 .7rem ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.page-shell { padding-top: 5rem; }

.archive-year { display: grid; grid-template-columns: 110px 1fr; gap: 2rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.archive-year h2 { margin: 0; font: 700 2.5rem Georgia, serif; }
.archive-year ol { list-style: none; margin: 0; padding: 0; }
.archive-year li { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; padding: .55rem 0; }
.archive-year time { color: var(--muted); font-size: .9rem; }
.archive-year a { color: var(--ink); font-family: Georgia, serif; font-weight: 700; text-decoration: none; }
.not-found { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 8rem 0; text-align: center; }
.not-found h1 { font: 700 clamp(3rem, 8vw, 6rem) Georgia, serif; margin: .4rem 0 1rem; }

.site-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 2.4rem 0 3.5rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; color: var(--muted); font-size: .9rem; }
.site-footer div { margin-right: auto; }

@media (max-width: 820px) {
  .header-inner { min-height: 94px; }
  .brand img { width: 205px; }
  .menu-toggle { display: block; }
  .main-nav { display: none; position: absolute; top: 70px; right: 20px; flex-direction: column; align-items: stretch; min-width: 210px; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
  .main-nav.is-open { display: flex; }
  .post-card { grid-template-columns: 1fr; }
  .card-image { aspect-ratio: 16/9; }
  .archive-year { grid-template-columns: 1fr; gap: .5rem; }
  .archive-year li { grid-template-columns: 1fr; gap: .1rem; padding: .8rem 0; }
  .post-navigation { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .header-inner, .hero, .listing, .archive, .article-shell, .site-footer { width: min(100% - 28px, 1180px); }
  .hero { padding-top: 4rem; }
  .hero h1 { font-size: 2.6rem; }
  .article-header h1 { font-size: 2.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
