:root {
  --paper: #f7f5ef;
  --ink: #1d1d1b;
  --muted: #74716a;
  --line: rgba(29, 29, 27, 0.13);
  --panel: rgba(255, 255, 255, 0.72);
  --accent: #2855d9;
  --danger: #a43b31;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-header {
  background: var(--paper);
}
.site-nav {
  width: min(100% - 40px, 760px);
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-name {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
}
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--sans);
  font-size: 14px;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links .social-link {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  transition: color 160ms ease, background 160ms ease, transform 120ms ease;
}
.nav-links .social-link:hover {
  color: var(--ink);
  background: rgba(29, 29, 27, .07);
}
.nav-links .social-link:active { transform: scale(.92); }
.social-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.shell {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: clamp(56px, 10vw, 104px) 0 88px;
}
.shell.narrow { max-width: 680px; }

.prose { font-size: clamp(18px, 2.2vw, 21px); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 {
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 500;
  margin: 2em 0 0.65em;
}
.prose h1 { font-size: clamp(42px, 8vw, 72px); margin-bottom: 0.7em; }
.prose h2 { font-size: clamp(28px, 5vw, 40px); }
.prose h3 { font-size: 24px; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 1.35em; }
.prose a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent);
  text-underline-offset: 0.18em;
  transition: text-decoration-color 160ms ease, color 160ms ease;
}
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.prose img { max-width: 100%; height: auto; border-radius: 12px; }
.prose blockquote {
  border-left: 2px solid var(--line);
  padding-left: 1.2em;
  color: var(--muted);
  font-style: italic;
}
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.84em; }
.prose :not(pre) > code { background: rgba(29,29,27,.06); border-radius: 4px; padding: .12em .35em; }
.prose pre {
  overflow-x: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.52);
  font-size: 14px;
  line-height: 1.55;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }

.page-heading { margin-bottom: 52px; }
.page-heading h1, .post-header h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 500;
}
.page-heading p, .post-header p { margin: 10px 0 0; color: var(--muted); }
.post-header { margin-bottom: 52px; }
.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--muted);
  font: 14px var(--sans);
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  position: relative;
  border-top: 1px solid var(--line);
}
.post-list li:last-child { border-bottom: 1px solid var(--line); }
.post-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 20px 0;
  color: var(--ink);
  text-decoration: none;
  transition: padding 180ms cubic-bezier(.2,.8,.2,1), color 160ms ease;
}
.post-list a:hover { color: var(--accent); padding-left: 8px; }
.post-list-title { font-size: 22px; line-height: 1.3; }
.post-list-date { color: var(--muted); font: 13px var(--sans); white-space: nowrap; }
.draft-label {
  display: inline-block;
  color: #805b00;
  background: #f3df9b;
  border-radius: 999px;
  padding: 2px 8px;
  font: 11px var(--sans);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.post-list .draft-label { position: absolute; right: 0; bottom: 3px; }
.empty-state { color: var(--muted); font-style: italic; }

.quiet-button, .primary-button, .danger-button, .mode-button {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font: 13px var(--sans);
  transition: transform 120ms ease, background 160ms ease, color 160ms ease;
}
.quiet-button, .mode-button { color: var(--muted); background: rgba(29,29,27,.06); }
.quiet-button:hover, .mode-button:hover, .mode-button.active { color: var(--ink); background: rgba(29,29,27,.11); }
.primary-button { color: white; background: var(--ink); }
.primary-button:hover { background: #000; }
.danger-button { color: var(--danger); background: transparent; }
.danger-button:hover { background: rgba(164,59,49,.08); }
button:active { transform: scale(.96); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.writer {
  margin: -28px -36px 0;
  padding: 28px 36px 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(43, 39, 28, .08);
}
.writer-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  font-family: var(--sans);
}
.mode-switch { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(29,29,27,.04); }
.mode-button { background: transparent; padding: 5px 10px; }
.writer-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.save-status { color: var(--muted); font-size: 12px; margin-right: 4px; }
.publish-control { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.markdown-input, .title-input {
  display: block;
  width: 100%;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}
.markdown-input {
  min-height: 360px;
  padding: 0;
  resize: none;
  overflow: hidden;
  font: 16px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.title-input {
  margin-bottom: 22px;
  font: 500 clamp(34px, 6vw, 54px)/1.1 var(--serif);
  letter-spacing: -.04em;
}
.editor-preview { min-height: 360px; }
.editor-note { margin: 24px 0 0; color: var(--muted); font: 12px var(--sans); }

/* Custom HTML inside Markdown can opt into these presentation hooks. */
[data-animate] { will-change: opacity, transform; }
.callout {
  margin: 2em 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}
.full-bleed { width: min(100vw - 40px, 1040px); margin-left: 50%; transform: translateX(-50%); }

@media (max-width: 640px) {
  .site-nav { width: min(100% - 28px, 760px); min-height: 64px; }
  .nav-links { gap: 13px; }
  .site-name { max-width: 38vw; }
  .shell { width: min(100% - 32px, 760px); padding-top: 48px; }
  .writer { margin: -16px -8px 0; padding: 20px 16px 28px; border-radius: 12px; }
  .writer-topbar { align-items: flex-start; flex-wrap: wrap; }
  .writer-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .post-list a { grid-template-columns: 1fr; gap: 3px; }
  .post-list-date { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  [data-animate] { opacity: 1 !important; transform: none !important; }
}
