:root {
  --max-read: 680px;
  --ink: #1a1a1a;
  --ink-soft: #555;
  --ink-faint: #888;
  --rule: #e6e6e6;
  --bg: #fffefb;
  --accent: #1a1a1a;
  --space: 1.5rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

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

a:hover { text-decoration-thickness: 2px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem var(--space);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  line-height: 1.25;
}

.brand-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex: none;
}

.brand:hover { text-decoration: none; }

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-tagline {
  font-size: 0.9rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* Layout */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--space);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3rem;
  align-items: start;
}

.content {
  width: 100%;
  max-width: var(--max-read);
  padding: 3rem 0;
}

/* Stream list */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-item:first-child { padding-top: 0; }

.post-item h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.post-item h2 a { text-decoration: none; }
.post-item h2 a:hover { text-decoration: underline; }

.post-meta {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-excerpt {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
}

.read-more {
  font-size: 0.95rem;
}

/* Full post */
.post-full .post-meta { margin-bottom: 1.5rem; }

.post-full h1 {
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.post-full h2 {
  font-size: 1.4rem;
  margin: 2.25rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-full h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

.post-full p,
.post-full ul,
.post-full ol { margin: 0 0 1.25rem; }

.post-full ul,
.post-full ol { padding-left: 1.25rem; }

.post-full li { margin-bottom: 0.4rem; }

.post-full blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
  font-style: italic;
}

.post-full img {
  max-width: 100%;
  height: auto;
}

.post-full pre {
  background: #f5f4f0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.post-full code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.post-full :not(pre) > code {
  background: #f0efeb;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post-full hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 2rem;
  padding-top: 3rem;
  font-size: 0.95rem;
}

.widget { margin-bottom: 2rem; }

.widget h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.newsletter {
  border: 1px solid var(--rule);
  background: #faf9f5;
  padding: 1.25rem;
  border-radius: 6px;
}

.newsletter h3 { margin-bottom: 0.75rem; }

.newsletter form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.newsletter input[type="email"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  border: 1px solid #cfcdc6;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.newsletter input[type="email"]:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}

.newsletter button {
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.newsletter button:hover { background: #000; }

.newsletter-note {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

.about-link {
  font-size: 0.95rem;
  font-weight: 600;
}

.follow a {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.95rem;
}

.about-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 0 1.5rem;
}

.rss-link {
  font-size: 0.9rem;
  color: var(--ink-faint);
}

/* Sidebar profile */
.profile { text-align: left; }
.sidebar-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 0 0.85rem;
}
.profile-bio {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Infinite-scroll reveal */
.post-item[hidden] { display: none; }
.scroll-sentinel { height: 1px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem var(--space);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* Responsive: sidebar becomes a header burger menu */
@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .content {
    order: 1;
    max-width: var(--max-read);
    padding: 1.5rem 0;
  }
  .sidebar {
    order: 0;
    display: none;
    position: static;
    padding: 0.5rem 0 1.25rem;
    max-width: var(--max-read);
    border-bottom: 1px solid var(--rule);
  }
  .sidebar.open { display: block; }
  .sidebar .widget:first-child { margin-top: 1rem; }
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  .post-full h1 { font-size: 1.7rem; }
}
