:root {
  --ink: #171717;
  --muted: #5c5c5c;
  --accent: #0b3b6f;
  --accent-light: #1a5a9e;
  --paper: #f7f4ef;
  --grid: rgba(11, 59, 111, 0.08);
  --rule: rgba(23, 23, 23, 0.15);
  --mono: "IBM Plex Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
}

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local("EB Garamond"), local("EBGaramond");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local("IBM Plex Mono"), local("IBMPlexMono");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: linear-gradient(180deg, rgba(247, 244, 239, 0.96), rgba(247, 244, 239, 0.96)),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(0deg, var(--grid) 1px, transparent 1px);
  background-size: cover, 32px 32px, 32px 32px;
  background-position: center;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

a:hover {
  border-bottom-color: var(--accent);
}

/* ─── Homepage ─────────────────────────────────────────────── */

body.home-page {
  font-size: 18px;
  line-height: 1.6;
}

#home {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Site header */
.site-header {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}

.site-header__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.site-header__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 10px;
}

.site-header__title {
  font-size: 36px;
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.site-header__tagline {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
  font-style: italic;
}

.site-header__links {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
  align-items: center;
}

.site-header__links a {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: none;
}

.site-header__links a:hover {
  color: var(--accent);
  border-bottom: none;
}

/* Post list */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Post card */
.post-card {
  border-bottom: 1px solid var(--rule);
}

.post-card:first-child {
  border-top: 1px solid var(--rule);
}

.post-card__link {
  display: flex;
  gap: 28px;
  padding: 32px 0;
  align-items: flex-start;
  color: var(--ink);
  border-bottom: none;
  text-decoration: none;
}

.post-card__link:hover {
  border-bottom: none;
}

.post-card__link:hover .post-card__title {
  color: var(--accent);
}

.post-card__link:hover .post-card__read-more {
  color: var(--accent-light);
}

.post-card__image-wrap {
  flex-shrink: 0;
  width: 180px;
  height: 120px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #fff;
}

.post-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-card__meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-card__title {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
  transition: color 0.15s;
}

.post-card__description {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.post-card__tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
}

.post-card__tag:hover {
  color: var(--accent);
  border-bottom: none;
}

.site-header__title-link {
  color: inherit;
  border-bottom: none;
}

.site-header__title-link:hover {
  border-bottom: none;
}

.post-card__read-more {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 6px;
  transition: color 0.15s;
}

/* Featured card: slightly more prominent */
.post-card--featured .post-card__image-wrap {
  width: 200px;
  height: 134px;
}

.post-card--featured .post-card__title {
  font-size: 25px;
}

/* Site footer */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  border-bottom: none;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom: none;
}

/* ─── Individual post page (Paged.js) ──────────────────────── */

body.post-page {
  font-size: 18px;
  line-height: 1.7;
}

#content {
  max-width: 740px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

/* Post cover (shown before body, on first "page") */
.post-cover {
  padding-bottom: 48px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--rule);
}

.post-cover__back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 40px;
  border-bottom: none;
}

.post-cover__back:hover {
  color: var(--accent);
  border-bottom: none;
}

.post-cover__title {
  font-size: 42px;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.015em;
}

.post-cover__meta {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.post-cover__description {
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
  font-style: italic;
  margin: 8px 0 0;
}

/* Post body */
.post {
  padding: 0;
  border-bottom: none;
}

.post__body {
  font-size: 18px;
  line-height: 1.75;
}

.post__body p {
  margin: 0 0 1.2em;
}

.post__body h1 {
  font-size: 30px;
  font-weight: 500;
  margin: 2em 0 0.6em;
  padding-top: 0.5em;
  border-top: 1px solid var(--rule);
}

.post__body h2 {
  font-size: 24px;
  font-weight: 500;
  margin: 1.8em 0 0.5em;
}

.post__body h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 1.5em 0 0.4em;
}

.post__body h4 {
  font-size: 18px;
  font-weight: 500;
  margin: 1.2em 0 0.3em;
}

.post__body img {
  max-width: 100%;
  display: block;
  margin: 1.5em auto;
  border: 1px solid var(--rule);
  padding: 6px;
  background: #fff;
}

.post__body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  color: var(--muted);
  margin: 1.2em 0;
  font-style: italic;
}

.post__body blockquote p {
  margin: 0;
}

.post__body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(11, 59, 111, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
}

.post__body pre {
  background: #111;
  color: #f5f5f5;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: 6px;
  margin: 1.4em 0;
}

.post__body pre code {
  background: none;
  padding: 0;
  font-size: 0.82em;
  color: inherit;
}

.post__body ul,
.post__body ol {
  padding-left: 1.6em;
  margin: 0.8em 0 1.2em;
}

.post__body li {
  margin-bottom: 0.3em;
}

.post__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 16px;
}

.post__body th,
.post__body td {
  border: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
}

.post__body th {
  background: rgba(11, 59, 111, 0.06);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

/* Callout boxes */
.post__body .callout {
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  margin: 1.4em 0;
  border-radius: 0 4px 4px 0;
  background: rgba(11, 59, 111, 0.06);
  font-size: 16px;
  line-height: 1.6;
}

.post__body .callout-note {
  border-left-color: #0b3b6f;
  background: rgba(11, 59, 111, 0.06);
}

.post__body .callout-caution {
  border-left-color: #b45309;
  background: rgba(180, 83, 9, 0.06);
}

.post__body .callout-info {
  border-left-color: #0e7490;
  background: rgba(14, 116, 144, 0.06);
}

/* Footnotes */
.post__body .footnotes {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--muted);
  padding-left: 1.4em;
}

.post__body .footnotes li {
  margin-bottom: 0.4em;
}

/* KaTeX display math spacing */
.post__body .katex-display {
  margin: 1.5em 0;
  overflow-x: auto;
}

/* ─── Paged.js print layout ─────────────────────────────────── */

@page {
  size: 8.5in 11in;
  margin: 0.9in 1in;
  @top-center {
    content: "Lakeside Reflections";
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    color: #5c5c5c;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }
  @bottom-center {
    content: counter(page);
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    color: #5c5c5c;
  }
}

@page :first {
  @top-center { content: none; }
  @bottom-center { content: none; }
}

.pagedjs_page {
  background: var(--paper);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.pagedjs_margin-top,
.pagedjs_margin-bottom {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.pagedjs_pagebox {
  padding: 0;
}

.pagedjs_pages {
  margin: 48px auto 96px;
}

/* ─── Responsive ────────────────────────────────────────────── */

@media (max-width: 680px) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header__title {
    font-size: 28px;
  }

  .post-card__link {
    flex-direction: column;
    gap: 16px;
  }

  .post-card__image-wrap {
    width: 100%;
    height: 180px;
  }

  .post-cover__title {
    font-size: 30px;
  }

  #content {
    padding: 32px 16px 64px;
  }
}

/* ─── Print ─────────────────────────────────────────────────── */

@media print {
  body {
    background: #fff;
  }

  .pagedjs_page {
    box-shadow: none;
  }
}
