/* iA Writer Quattro keeps the publication quiet, direct, and unmistakably text-first. */
@font-face {
  font-family: "iA Writer Quattro";
  src: url("/fonts/iAWriterQuattroS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("/fonts/iAWriterQuattroS-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("/fonts/iAWriterQuattroS-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --accent: #e94f37;
  --accent-dark: #bd3824;
  --accent-soft: rgb(233 79 55 / 0.08);
  --bg: #fdfcfa;
  --surface: #fff;
  --text: #272727;
  --muted: rgb(39 39 39 / 0.58);
  --faint: rgb(39 39 39 / 0.36);
  --rule: rgb(39 39 39 / 0.12);
  --font: "iA Writer Quattro", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 42rem;
  --reader-width: 72rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: min(100% - 2.5rem, var(--measure));
  margin: 0 auto;
  padding: 2.75rem 0 5rem;
}

a { color: var(--accent-dark); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgb(233 79 55 / 0.35); outline-offset: 3px; }

/* Compact publication navigation. */
.site-nav { border-bottom: 1px solid var(--rule); background: rgb(253 252 250 / 0.94); }
.site-nav__inner {
  width: min(100% - 2.5rem, var(--measure));
  min-height: 4rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.site-nav__brand {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}
.site-nav__brand:hover { text-decoration: none; }
.site-nav__links { display: flex; align-items: center; gap: clamp(1rem, 4vw, 1.75rem); }
.site-nav__links a { color: var(--muted); font-size: 0.86rem; }
.site-nav__links a:hover { color: var(--text); text-decoration: none; }
.site-nav__links a[aria-current="page"] { color: var(--accent-dark); font-weight: 700; }

/* Editorial masthead: the same voice, with hierarchy and far less dead space. */
.pub-header { border-top: 3px solid var(--accent); padding: 1.1rem 0 2.1rem; }
.pub-kicker {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.55rem;
  color: var(--faint);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.pub-title {
  margin: 0;
  color: var(--accent);
  font-size: clamp(2.8rem, 11vw, 4.8rem);
  font-weight: 700;
  letter-spacing: -0.085em;
  line-height: 0.98;
}
.pub-cursor {
  display: inline-block;
  margin-left: 0.06em;
  color: var(--text);
  font-weight: 400;
  animation: pub-cursor-blink 1.1s steps(1, end) infinite;
}
.pub-tagline {
  max-width: 36rem;
  margin: 1.25rem 0 0;
  color: var(--text);
  font-size: clamp(1.05rem, 3vw, 1.28rem);
  line-height: 1.55;
}
.pub-credit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.pub-byline { margin: 0; color: var(--muted); font-size: 0.82rem; }
.pub-byline b { color: var(--text); }
.pub-actions { flex: none; }
.rss-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
}
.rss-btn:hover { text-decoration: none; color: var(--accent); }

/* The list stays deliberately plain: this restraint is the site's strongest asset. */
.post-section { margin-top: 1.2rem; }
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--text);
}
.section-heading h2 {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.section-heading span { color: var(--faint); font-size: 0.72rem; }
.post-list { margin: 0; }
.post-card {
  position: relative;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-card::before {
  content: "";
  position: absolute;
  top: 1.8rem;
  left: -1rem;
  width: 3px;
  height: 0;
  background: var(--accent);
  transition: height 160ms ease;
}
.post-card:hover::before { height: 2rem; }
.post-card h2 { margin: 0 0 0.35rem; font-size: 1.32rem; line-height: 1.32; }
.post-card h2 a { color: inherit; }
.post-card h2 a:hover { color: var(--accent-dark); text-decoration: none; }
.post-card .excerpt { margin: 0 0 0.75rem; color: rgb(39 39 39 / 0.86); }
.post-meta { display: flex; justify-content: space-between; align-items: center; color: var(--faint); font-size: 0.76rem; }
.post-meta .hearts { white-space: nowrap; }

/* Essays. */
.post-kicker { margin: 0 0 1rem; color: var(--accent); font-weight: 700; font-size: 0.82rem; }
.post-title { margin: 0.4rem 0 0.8rem; font-size: clamp(2rem, 7vw, 3.25rem); line-height: 1.12; letter-spacing: -0.045em; }
.post-subtitle { margin: 0 0 1.2rem; color: var(--muted); font-size: 1.08rem; font-style: italic; }
.post-body { margin-top: 2.5rem; }
.post-body p { margin: 0 0 1.25rem; }
.post-body h2 { margin: 2.3rem 0 0.7rem; font-size: 1.35rem; line-height: 1.35; }
.post-body code { padding: 0.12rem 0.3rem; background: var(--accent-soft); border-radius: 4px; font-size: 0.88em; }
.post-nav { margin: 3rem 0 2rem; text-align: right; font-weight: 700; }
.post-footer-actions { display: flex; gap: 0.65rem; margin: 2rem 0; flex-wrap: wrap; }
.pill { border: 1px solid var(--rule); border-radius: 6px; padding: 0.45rem 0.8rem; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.footer-card { margin-top: 2rem; padding: 1.5rem; border: 1px solid var(--rule); border-top-color: var(--accent); background: var(--accent-soft); }
.footer-card .pub-title { font-size: 1.35rem; letter-spacing: -0.04em; color: var(--text); }
.footer-card .pub-tagline { margin-top: 0.5rem; font-size: 0.86rem; color: var(--muted); }

/* Reading shelf. */
.reading-header { margin-bottom: 2.8rem; }
.page-kicker { margin: 0 0 0.9rem; color: var(--accent-dark); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.reading-title { margin: 0; font-size: clamp(2.25rem, 8vw, 3.8rem); line-height: 1.05; letter-spacing: -0.065em; }
.reading-intro { max-width: 38rem; margin: 1rem 0 0; color: var(--muted); }
.reading-sync { display: flex; align-items: center; gap: 0.4rem; margin: 0.8rem 0 0; color: var(--faint); font-size: 0.72rem; }
.reading-sync span { color: var(--accent-dark); font-size: 0.95rem; }
.read-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--text); }
.read-list li { border-bottom: 1px solid var(--rule); }
.read-card {
  display: block;
  width: 100%;
  padding: 1.45rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.read-card__title { display: block; font-size: 1.25rem; font-weight: 700; line-height: 1.35; }
.read-card .blurb { display: block; margin-top: 0.45rem; color: rgb(39 39 39 / 0.82); font-size: 0.92rem; }
.read-card__footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.75rem; color: var(--faint); font-size: 0.72rem; }
.read-card__meta { display: flex; align-items: center; gap: 0.42rem; min-width: 0; flex-wrap: wrap; }
.feed-badge { padding: 0.08rem 0.32rem; border: 1px solid rgb(233 79 55 / 0.28); border-radius: 3px; color: var(--accent-dark); font-size: 0.61rem; font-weight: 700; letter-spacing: 0.07em; }
.read-card__footer > :last-child { color: var(--accent-dark); opacity: 0; transform: translateX(-0.4rem); transition: opacity 140ms ease, transform 140ms ease; }
.read-card:hover .read-card__title { color: var(--accent-dark); }
.read-card:hover .read-card__footer > :last-child { opacity: 1; transform: translateX(0); }

/* Source-preserving browser sheet. The website remains the website. */
.reader-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(20 20 20 / 0.48); opacity: 0; backdrop-filter: blur(4px); transition: opacity 220ms ease; }
.reader-backdrop.is-open { opacity: 1; }
.reader-sheet {
  position: fixed;
  inset: 1.25rem;
  z-index: 50;
  width: min(calc(100% - 2.5rem), var(--reader-width));
  height: calc(100dvh - 2.5rem);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 18px;
  background: #eef1f4;
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.34);
  transform: translateY(2rem) scale(0.985);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
}
.reader-sheet.is-open { transform: translateY(0) scale(1); opacity: 1; }
.reader-topbar {
  min-height: 3.2rem;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid #dfe3e8;
  background: #fff;
  color: #1c232b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
}
.reader-topbar__label { color: #7c8794; }
.reader-topbar__title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reader-topbar__open { color: #46515e; font-weight: 650; }
.reader-topbar__open:hover { text-decoration: none; color: #000; }
.reader-viewport { position: relative; flex: 1; min-height: 0; background: #fff; }
.reader-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.reader-progress { position: absolute; z-index: 3; top: 0; left: 0; width: 0; height: 3px; background: #168cf3; opacity: 0; }
.reader-sheet.is-loading .reader-progress { width: 82%; opacity: 1; transition: width 7s cubic-bezier(0.1, 0.7, 0.1, 1); }
.reader-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 0.8rem; background: #fff; color: #687481; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 0.86rem; }
.reader-loading span { width: 24px; height: 24px; border: 2px solid #dfe3e8; border-top-color: #168cf3; border-radius: 50%; animation: reader-spin 0.8s linear infinite; }
.reader-loading.is-done { display: none; }
.reader-toolbar {
  min-height: 4.5rem;
  padding: 0.65rem 0.9rem max(0.65rem, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 18rem) 2.9rem;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  background: rgb(246 248 250 / 0.96);
  border-top: 1px solid #dce1e6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  backdrop-filter: blur(18px);
}
.reader-control { width: 2.9rem; height: 2.9rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: #fff; color: #101418; box-shadow: 0 1px 4px rgb(0 0 0 / 0.08); cursor: pointer; }
.reader-control svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a.reader-control:hover { text-decoration: none; }
.reader-address { height: 2.9rem; padding: 0 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-width: 0; border-radius: 999px; background: #fff; color: #101418; box-shadow: 0 1px 4px rgb(0 0 0 / 0.08); font-size: 0.9rem; font-weight: 650; }
.reader-address__dot { width: 0.44rem; height: 0.44rem; border-radius: 50%; background: #26b85a; box-shadow: 0 0 0 3px rgb(38 184 90 / 0.12); }
.reader-address span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.reader-locked { overflow: hidden; }

@keyframes reader-spin { to { transform: rotate(360deg); } }
@keyframes pub-cursor-blink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap, .site-nav__inner { width: min(100% - 2rem, var(--measure)); }
  .wrap { padding-top: 2rem; }
  .site-nav__links { gap: 1rem; }
  .site-nav__links a { font-size: 0.76rem; }
  .site-nav__links a:last-child { display: none; }
  .pub-header { padding-bottom: 1.7rem; }
  .pub-credit { align-items: flex-end; }
  .pub-byline { max-width: 12rem; }
  .rss-btn { font-size: 0; }
  .rss-btn svg { width: 18px; height: 18px; }
  .post-section { margin-top: 0.8rem; }
  .post-card::before { display: none; }
  .post-card h2 { font-size: 1.18rem; }
  .post-card .excerpt { font-size: 0.94rem; }
  .reader-sheet { inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; transform: translateY(100%); }
  .reader-sheet.is-open { transform: translateY(0); }
  .reader-topbar { display: none; }
  .reader-toolbar { min-height: 4.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pub-cursor { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
