/* (c) 2026 Bhavani Shankar Ajith. All rights reserved. See /LICENSE. */
/* Long-form reading pages. Light, serif, one column — the layout a piece of
   writing wants, rather than the layout the rest of the site wants. */

:root {
  --ink: #242424;
  --ink-soft: #4a4a4a;
  --muted: #6b6b6b;
  --rule: #e8e8e8;
  --accent: #0066cc;
  --mark: #fff4c2;
  --serif: Charter, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --col: 42rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.58;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 57px;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--sans);
  font-size: 14px;
}

.masthead__name {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.masthead__back {
  margin-left: auto;
  color: var(--muted);
  text-decoration: none;
}

.masthead__back:hover { color: var(--ink); }

/* reading progress */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 30;
  will-change: transform;
}

/* ---------- article ---------- */

.post {
  max-width: var(--col);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 5rem;
}

.post__kicker {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.post h1 {
  font-family: var(--sans);
  font-size: clamp(2rem, 5.4vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.028em;
  font-weight: 700;
  margin: 0 0 1rem;
}

.post__standfirst {
  font-size: 1.32rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 2rem;
}

.post__byline {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 2rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}

.post__avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.post__who { font-size: 15px; font-weight: 500; color: var(--ink); }
.post__meta { font-size: 14px; color: var(--muted); }

.post p { margin: 0 0 1.6rem; }

.post h2 {
  font-family: var(--sans);
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.018em;
  font-weight: 650;
  margin: 3rem 0 0.9rem;
}

.post h3 {
  font-family: var(--sans);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.2rem 0 0.6rem;
}

.post a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.post a:hover { color: var(--accent); }

.post strong { font-weight: 700; }

.post ul, .post ol { margin: 0 0 1.6rem; padding-left: 1.4rem; }
.post li { margin-bottom: 0.7rem; }

.post blockquote {
  margin: 2rem 0;
  padding-left: 1.4rem;
  border-left: 3px solid var(--ink);
  font-style: italic;
  color: var(--ink-soft);
}

.post blockquote p:last-child { margin-bottom: 0; }

mark { background: var(--mark); padding: 0 0.15em; }

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: #f4f4f4;
  padding: 0.12em 0.38em;
  border-radius: 3px;
}

pre {
  background: #f7f7f7;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.6rem;
}

pre code { background: none; padding: 0; font-size: 14px; line-height: 1.6; }

/* ---------- figures: tables and callouts get to break the column ---------- */

.figure {
  margin: 2.4rem 0;
}

.figure__cap {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 0.8rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
}

th, td {
  text-align: right;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; white-space: normal; }

th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: #ccc;
}

td { font-variant-numeric: tabular-nums; }

tr.is-key td { background: #fafafa; font-weight: 600; }

.table-wrap { overflow-x: auto; }

/* a row of headline numbers */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin: 2.4rem 0;
}

.stat { background: #fff; padding: 1.1rem 1rem; }
.stat__v { font-family: var(--sans); font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat__k { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 0.35rem; line-height: 1.35; }

/* a boxed aside */
.note {
  margin: 2.4rem 0;
  padding: 1.2rem 1.3rem;
  background: #fbfbf8;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}

.note p:last-child { margin-bottom: 0; }
.note strong { font-family: var(--sans); font-size: 0.95rem; }

/* ---------- footer ---------- */

.post__end {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 15px;
}

.post__links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.post__links a {
  text-decoration: none;
  border: 1px solid #d4d4d4;
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.post__links a:hover { border-color: #111; background: #fafafa; color: var(--ink); }

.more {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
  font-family: var(--sans);
}

.more h2 { font-size: 1.05rem; font-weight: 600; color: var(--muted); margin: 0 0 1.1rem; letter-spacing: 0.02em; }
.more ul { list-style: none; margin: 0; padding: 0; }
.more li { border-top: 1px solid var(--rule); }
.more a { display: block; padding: 1.1rem 0; text-decoration: none; color: var(--ink); }
.more a:hover .more__t { color: var(--accent); }
/* these are spans inside the link, so they need to be told to stack */
.more__t { display: block; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.more__d { display: block; font-size: 14.5px; color: var(--muted); margin-top: 0.25rem; }

@media (max-width: 40em) {
  body { font-size: 19px; }
  .post { padding-top: 2.4rem; }
  .post__standfirst { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress { transition: none; }
}

/* ============ publication home ============ */

.pub {
  max-width: 60rem;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.pub__title {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 1rem;
}

.pub__tagline {
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 34rem;
  margin: 0;
}

.feed {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

.feed__item { border-bottom: 1px solid var(--rule); }

.feed__item > a {
  display: grid;
  grid-template-columns: 1fr 8.5rem;
  gap: 2rem;
  align-items: start;
  padding: 2.4rem 0;
  text-decoration: none;
  color: inherit;
}

.feed__item:first-child > a { padding-top: 2.8rem; }

.feed__kicker {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.feed__title {
  font-family: var(--sans);
  font-size: 1.55rem;
  line-height: 1.22;
  letter-spacing: -0.022em;
  font-weight: 700;
  margin: 0 0 0.55rem;
  color: var(--ink);
}

.feed__item > a:hover .feed__title { color: var(--accent); }

.feed__deck {
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}

.feed__meta {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
}

.feed__thumb {
  width: 8.5rem;
  aspect-ratio: 4 / 3;
  background: #f4f4f2;
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
}

.feed__thumb svg { width: 58%; height: auto; }

.pub__foot {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--muted);
}

.pub__foot a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 40em) {
  .pub { padding-top: 2.8rem; }
  .feed__item > a { grid-template-columns: 1fr; gap: 1rem; }
  .feed__thumb { display: none; }
  .feed__title { font-size: 1.32rem; }
}
