:root {
  --bg: #ffffff;
  --ink: #161616;
  --muted: #6f6f6f;
  --rule: rgba(22, 22, 22, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Times New Roman", Times, Georgia, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.65;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar a {
  display: inline-flex;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.3s var(--ease);
  opacity: 0.9;
}
.topbar a:hover { opacity: 1; }
.topbar img { height: 22px; width: auto; display: block; user-select: none; -webkit-user-drag: none; }

/* ---- Reading column (shared by feed + article page) ---- */
.feed,
.article-page {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(44px, 8vw, 92px) clamp(20px, 5vw, 24px) 0;
}

/* ---- Post ---- */
.post { animation: rise 0.8s var(--ease) both; }
/* lazily appended posts fade in on scroll */
.post--lazy { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); animation: none; }
.post--lazy.is-in { opacity: 1; transform: none; }

.post__date {
  font-size: 0.8rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}
.post__title {
  font-size: clamp(29px, 5.4vw, 45px);
  line-height: 1.07;
  letter-spacing: -0.012em;
  font-weight: 700;
  margin-bottom: 16px;
  text-wrap: balance;
}
/* when the feed links a title to its permalink */
.post__title a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s var(--ease);
}
.post__title a:hover { opacity: 0.62; }

.post__byline {
  font-style: italic;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: clamp(30px, 5vw, 40px);
}
.post__body > p {
  font-size: clamp(18px, 2.35vw, 20px);
  margin-bottom: 1.15em;
}
.post__body > p:first-of-type { font-size: clamp(19px, 2.55vw, 21.5px); }
.post__bio {
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  margin-top: 30px;
}
/* inline links within article prose */
.post__body a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 0.3s var(--ease);
}
.post__body a:hover { text-decoration-color: var(--ink); }
.post__bio a { color: inherit; text-underline-offset: 3px; }

.post__sep {
  width: 56px;
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: clamp(52px, 9vw, 82px) auto;
}

/* ---- Feed end cap ---- */
#sentinel { height: 1px; }
.end {
  text-align: center;
  padding: 8px 0 clamp(64px, 13vw, 128px);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.end.show { opacity: 1; }
.end__bars { display: inline-flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.end__bars span { display: block; width: 34px; height: 5px; background: var(--ink); }
.end p { font-size: 0.82rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* ---- Article (permalink) page ---- */
.backlink {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(30px, 6vw, 46px) clamp(20px, 5vw, 24px) clamp(64px, 12vw, 110px);
}
.backlink a {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}
.backlink a:hover { color: var(--ink); }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .feed, .article-page { padding-top: 40px; }
  .topbar { padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .post, .post--lazy { animation: none; transition: none; opacity: 1; transform: none; }
  .topbar a, .end, .backlink a, .post__title a { transition: none; }
}
