/* Standalone article reading view. Loaded only by /writing/<slug>.html
   pages — not by the desktop SPA. Keep it lean. */

:root {
  --bg: #f7f5f0;
  --ink: #1d1d1f;
  --ink-soft: #555;
  --ink-muted: #8a8784;
  --rule: rgba(0, 0, 0, 0.08);
  --link: #5b8def;
  --accent: #a47bd6;
  --max: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.writing-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 14px 24px;
  background: rgba(247, 245, 240, 0.85);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  border-bottom: 1px solid var(--rule);
}
.writing-bar .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: color 120ms ease;
}
.writing-bar .back:hover { color: var(--ink); }
.writing-bar .glyph { font-size: 18px; line-height: 1; margin-top: -1px; }

/* Iframed inside the SPA's Reader window (html.in-frame set by the inline
   head script): hide the back-to-homepage bar — it would load the whole
   desktop site inside the Reader iframe. Direct visits keep it. */
.in-frame .writing-bar { display: none; }

/* Answer-first summary box (frontmatter `tldr:`) — the extractable direct
   answer that AI answer engines lift; readers get the gist before the essay. */
.writing-tldr {
  margin: 20px 0 4px;
  padding: 14px 18px;
  background: rgba(31, 37, 82, 0.05);
  border-left: 3px solid rgba(31, 37, 82, 0.35);
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

.writing-article {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.writing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.writing-tags .tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(164, 123, 214, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.writing-article h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--ink);
}

.writing-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 40px;
}
.writing-meta .dot { opacity: 0.4; }

.writing-body {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
}
.writing-body p { margin: 0 0 22px; }
.writing-body h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.2;
  margin: 48px 0 16px;
  letter-spacing: -0.005em;
}
.writing-body h3 {
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
  margin: 36px 0 12px;
}
.writing-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.writing-body a:hover { text-decoration-thickness: 2px; }
.writing-body strong { font-weight: 600; }
.writing-body em { font-style: italic; }
.writing-body ul, .writing-body ol {
  margin: 0 0 22px;
  padding-left: 26px;
}
.writing-body li { margin-bottom: 8px; }
.writing-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
.writing-body code {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}
.writing-body pre {
  background: #1d1d1f;
  color: #f7f5f0;
  padding: 18px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
  margin: 24px 0;
}
.writing-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.writing-body hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 40px 0;
}
.writing-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 24px 0;
}

.writing-foot {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-soft);
}
.writing-foot a { color: var(--link); text-decoration: none; }
.writing-foot a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .writing-article { padding: 32px 18px 64px; }
  .writing-body { font-size: 17px; }
}
