:root {
  color-scheme: light dark;
  --text: #1f2328;
  --muted: #6b7280;
  --bg: #ffffff;
  --border: #e5e7eb;
  --accent: #2563eb;
  --code-bg: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6e6e6;
    --muted: #9ca3af;
    --bg: #16181d;
    --border: #2b2f36;
    --accent: #60a5fa;
    --code-bg: #1f2329;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.65;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.site-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.digest-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 720px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}

.digest-nav-bottom {
  margin: 2.5rem auto 2rem;
}

.nav-link {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--code-bg);
}

.nav-disabled {
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.nav-index {
  color: var(--muted);
  border: none;
}

.digest-content,
.index-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 2rem;
}

.digest-date {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0;
}

.digest-content h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.digest-content h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.digest-content h3 {
  font-size: 1.05rem;
}

.digest-content a {
  color: var(--accent);
}

.digest-content code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.digest-content pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

.digest-content pre code {
  background: none;
  padding: 0;
}

.digest-content blockquote {
  border-left: 3px solid var(--border);
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: var(--muted);
}

.digest-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.digest-content img {
  max-width: 100%;
}

.story-index {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 1rem;
}

.story-index summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.9rem 0;
  list-style: none;
}

.story-index summary::-webkit-details-marker {
  display: none;
}

.story-index summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.6rem;
  font-size: 0.75em;
  transition: transform 0.15s ease;
}

.story-index[open] summary::before {
  transform: rotate(90deg);
}

.story-index summary:hover {
  color: var(--accent);
}

.story-index > *:last-child {
  padding-bottom: 1rem;
}

.digest-list {
  list-style: none;
  padding: 0;
}

.digest-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.digest-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.digest-list a:hover {
  color: var(--accent);
}

.index-date {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
