/* Long-form post styles. Matches the main site: white page, EB Garamond body,
   Inter headings, and the blue→teal gradient link underline. */
:root {
  --bg: #ffffff;
  --fg: #212529;
  --muted: #666666;
  --rule: #e4e6ea;
  --panel: #f5f7fa;
  --accent: #3e62b4;          /* darker step of the site gradient, for text */
  --grad: linear-gradient(110deg, #5B7FD6, #4FB3A9);
  --todo-bg: #fff2b8;
  --todo-fg: #5a4600;
  --media-bg: #0d0f0c;
  --measure: 40rem;
  --wide: 60rem;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  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(--serif);
  font-size: 1.3rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

/* links: same gradient underline as the homepage, but inline so long links wrap */
a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  background-image: var(--grad);
  background-repeat: no-repeat;
  background-size: 100% 0.1em;
  background-position: 0 92%;
  transition: background-size .25s cubic-bezier(.6, 0, .4, 1);
}
a:hover { background-size: 100% 0.2em; }

.col { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.wide { max-width: var(--wide); margin-left: auto; margin-right: auto; }
.site-nav, header.masthead, main, .site-footer, .hero { padding-left: 16px; padding-right: 16px; }

/* site nav */
.site-nav { padding-top: 1.4rem; }
.nav-inner {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-bottom: 0.9rem; border-bottom: 1px solid var(--rule);
}
.site-name { font-family: var(--sans); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; background-size: 0 0; }
.site-name:hover { background-size: 100% 0.15em; }
.nav-link { font-size: 1.1rem; }

/* masthead */
header.masthead { padding-top: 3rem; padding-bottom: 0.2rem; }
.kicker {
  font-family: var(--sans); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.9rem;
}
h1 {
  font-family: var(--sans); font-weight: 700; letter-spacing: -0.025em;
  font-size: clamp(2.1rem, 5.6vw, 3.2rem); line-height: 1.08; margin: 0 0 0.9rem;
  text-wrap: balance;
}
.dek { font-size: 1.45rem; line-height: 1.4; color: var(--muted); margin: 0 0 1.4rem; font-style: italic; text-wrap: pretty; }
.byline {
  font-family: var(--sans); font-size: 0.86rem; color: var(--muted);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 0.8rem 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.2rem; align-items: baseline;
}
.byline strong { color: var(--fg); font-weight: 600; }

/* hero: inside the wide column, like the site's other media */
.hero { margin: 2rem auto 2.4rem; max-width: calc(var(--wide) + 32px); }
.hero video {
  display: block; width: 100%; height: auto; border-radius: 8px; background: var(--media-bg);
  max-height: 78vh; object-fit: cover; aspect-ratio: 16 / 9;
}

/* body text */
h2 {
  font-family: var(--sans); font-weight: 700; letter-spacing: -0.015em;
  font-size: clamp(1.4rem, 3vw, 1.75rem); line-height: 1.2; margin: 3.2rem 0 1rem;
  text-wrap: balance;
}
p { margin: 0 0 1.15rem; text-wrap: pretty; }

/* Markdown body: everything sits in the reading column, figures break out wider */
.post-body > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.post-body > figure.wide, .post-body > .pair-wrap { max-width: var(--wide); }
.post-body > figure.portrait { max-width: 30rem; }
.post-body > figure.portrait.slim { max-width: 22rem; }
.post-body > ul, .post-body > ol { padding-left: 1.2rem; margin-bottom: 1.3rem; }
.post-body > ul > li, .post-body > ol > li { margin: 0 0 0.75rem; }
.post-body li::marker { color: var(--accent); }
.post-body h3 { font-family: var(--sans); font-weight: 700; font-size: 1.2rem; margin: 2.2rem auto 0.8rem; }
.post-body p > img { display: block; width: 100%; height: auto; border-radius: 6px; }
.post-body blockquote { border-left: 3px solid var(--rule); padding-left: 1rem; color: var(--muted); font-style: italic; }
.post-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem auto; }
.post-body code { font-size: 0.8em; background: var(--panel); padding: 0.1em 0.35em; border-radius: 4px; }

/* figures */
figure { margin: 2rem auto; }
figure video, figure img {
  display: block; width: 100%; height: auto; border-radius: 6px; background: var(--media-bg);
}
figure img.chart { background: #fff; padding: 0.6rem; border: 1px solid var(--rule); }
figcaption {
  font-family: var(--sans); font-size: 0.8rem; line-height: 1.5; color: var(--muted);
  margin-top: 0.6rem; max-width: var(--measure);
}
figure.wide figcaption { margin-left: auto; margin-right: auto; }
figure.portrait { max-width: 30rem; }
figure.portrait.slim { max-width: 22rem; }

.pair { display: grid; grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.pair > figure { margin: 0; }
.pair-wrap { margin: 2rem auto; }

.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.photos img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 5px; }

/* asides */
aside.note {
  background: var(--panel); border-left: 3px solid #5B7FD6;
  border-radius: 0 6px 6px 0; padding: 1rem 1.2rem 0.4rem; margin: 1.8rem auto 2rem;
  font-family: var(--sans); font-size: 0.88rem; line-height: 1.6;
}
aside.note h4 {
  font-family: var(--sans); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.45rem;
}
aside.note p { margin: 0 0 0.75rem; }
aside.note ul { margin: 0 0 0.75rem; padding-left: 1.1rem; }
aside.note li { margin: 0 0 0.45rem; }

/* draft notes for the authors: resolve these before publishing */
mark.todo {
  background: var(--todo-bg); color: var(--todo-fg); font-family: var(--sans); font-size: 0.7em;
  padding: 0.08em 0.4em; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

.post-end { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }
.site-footer { padding-bottom: 2.5rem; }
.site-footer hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0 1.2rem; }
.site-footer p { font-family: var(--serif); font-size: 0.8rem; color: var(--muted); text-align: center; margin: 0; }

/* blog index */
.post-list { list-style: none; padding: 0; margin: 2.5rem 0 0; }
.post-list li { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-list .date { display: block; font-family: var(--sans); font-size: 0.78rem; color: var(--muted); margin-bottom: 0.3rem; }
.post-list h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.post-list h2 a { font-weight: 700; }
.post-list p { margin: 0; color: var(--muted); font-size: 1.15rem; line-height: 1.45; }

@media (max-width: 640px) {
  body { font-size: 1.15rem; }
  .dek { font-size: 1.22rem; }
  header.masthead { padding-top: 2rem; }
  .hero { margin-top: 1.4rem; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .pair > figure.portrait { max-width: 20rem; margin: 0 auto; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  aside.note { padding: 0.9rem 1rem 0.3rem; }
}
