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

:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f7f7f5;
  --text: #1f1f1f;
  --text-secondary: #5b5b5b;
  --text-muted: #8a8a8a;
  --border: #e6e6e3;
  --accent: #5f9b65;
  --accent-hover: #4b8551;
  --code-bg: #f3f3f0;
  --shadow: 0 1px 2px rgba(0,0,0,0.05);
  --font-title: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: Palatino, "Palatino Linotype", "Book Antiqua", Charter, "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #1c1c1c;
  --bg-elevated: #232323;
  --bg-hover: #262626;
  --text: #e2e2df;
  --text-secondary: #b0b0ab;
  --text-muted: #7d7d78;
  --border: #303030;
  --accent: #7fb884;
  --accent-hover: #98c99c;
  --code-bg: #2a2a2a;
  --shadow: 0 1px 2px rgba(0,0,0,0.4);
}

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text);
}
.site-title:hover { color: var(--text); opacity: 0.75; }

.theme-toggle {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle svg { width: 20px; height: 20px; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hero posts: the image runs to the very top and the site title is knocked
   out of a solid bar so the image shows through the letters. In light mode a
   white bar with black text under screen blending keeps the bar white and
   turns the black letters into windows; dark mode inverts both. */
body.has-hero .site-header { display: none; }

.hero {
  position: relative;
  height: min(62vh, 560px);
  min-height: 260px;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-hover);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0 1.5rem;
  height: 88px;
  display: flex;
  align-items: center;
  background: #fff;
  mix-blend-mode: screen;
}
.hero-bar .site-title {
  font-size: 2.6rem;
  color: #000;
}
.hero-bar .site-title:hover { color: #000; opacity: 1; }

[data-theme="dark"] .hero-bar { background: #000; mix-blend-mode: multiply; }
[data-theme="dark"] .hero-bar .site-title { color: #fff; }
[data-theme="dark"] .hero-bar .site-title:hover { color: #fff; }

.hero-toggle {
  position: absolute;
  top: 26px;
  right: 1.5rem;
  color: var(--text-secondary);
}

body.has-hero .container { padding-top: 2.5rem; }

/* Layout */
main { flex: 1; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.section-title {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.empty {
  font-family: var(--font-ui);
  color: var(--text-muted);
  padding: 3rem 0;
}

/* Post list */
.post-list { list-style: none; }

.post-list li { border-bottom: 1px solid var(--border); }

.post-list a {
  display: block;
  padding: 1.1rem 0.75rem;
  margin: 0 -0.75rem;
  border-radius: 6px;
  color: inherit;
}
.post-list a:hover { background: var(--bg-hover); color: inherit; }

.post-list h2 {
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

.post-list .meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.post-list p {
  font-size: 1rem;
  line-height: 1.43;
  color: var(--text-secondary);
  margin-top: 0.45rem;
}

/* Post page */
.post-header { margin-bottom: 1.5rem; }

.post-header h1 {
  font-family: var(--font-ui);
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text);
}

.post-header .meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.post-header .meta .sep { opacity: 0.6; }

.post-deck {
  font-size: 1.1375rem;
  line-height: 1.43;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.post-body {
  font-size: 1.1375rem;
  line-height: 1.43;
}

.post-body h1, .post-body h2, .post-body h3,
.post-body h4, .post-body h5, .post-body h6 {
  font-family: var(--font-ui);
  font-weight: 600;
  line-height: 1.2;
  margin: 1.4em 0 0.6em;
  letter-spacing: -0.01em;
}
.post-body h1 { font-size: 1.7rem; }
.post-body h2 { font-size: 1.45rem; }
.post-body h3 { font-size: 1.2rem; }
.post-body h4 { font-size: 1.05rem; }
.post-body > *:first-child { margin-top: 0; }

.post-body p { margin-bottom: 1em; }

.post-body ul, .post-body ol { margin: 0 0 1em 1.5rem; }
.post-body li { margin-bottom: 0.35em; }

.post-body blockquote {
  margin: 0 0 1em 0.75rem;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.post-body pre {
  margin: 0 0 1em;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}
.post-body pre code { background: none; padding: 0; font-size: inherit; }

.post-body img { max-width: 100%; height: auto; border-radius: 4px; }

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem auto;
  width: 40%;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1em;
  font-size: 0.95rem;
}
.post-body th, .post-body td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.post-body th { font-family: var(--font-ui); font-weight: 600; }

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
.site-footer a { font-family: var(--font-title); text-transform: lowercase; color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

@media (max-width: 600px) {
  .container { padding: 1.75rem 1.25rem 4rem; }
  .hero { height: 42vh; }
  .hero-bar { height: 60px; padding: 0 1.25rem; }
  .hero-bar .site-title { font-size: 1.5rem; }
  .hero-toggle { top: 12px; right: 1.25rem; }
  .post-list a { padding: 1rem 0.5rem; margin: 0 -0.5rem; }
  .post-body { font-size: 1.0625rem; }
}

.preview-badge {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c90;
}
