/* Substack-like reader styles (intentionally clean + simple). */

:root {
  --reader-bg: #f4f5f7;
  --reader-paper: #ffffff;
  --reader-text: #111827;
  --reader-muted: #5b6472;
  --reader-border: rgba(17, 24, 39, 0.12);
  --reader-link: #0a66c2;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--reader-bg);
  color: var(--reader-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--reader-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--reader-border);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.brand small {
  font-weight: 600;
  color: var(--reader-muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--reader-border);
  background: var(--reader-paper);
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--reader-text) 18%, transparent);
}

.btn.primary {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.container {
  max-width: 820px;
  margin: 28px auto 72px;
  padding: 0 16px;
}

.paper {
  background: var(--reader-paper);
  border: 1px solid var(--reader-border);
  border-radius: 16px;
  padding: 34px 34px 40px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.06);
}

.meta {
  margin-bottom: 24px;
}

.meta h1 {
  margin: 0 0 10px;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.byline {
  color: var(--reader-muted);
  font-size: 15px;
}

.content {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.78;
}

.content p {
  margin: 0 0 1.1em;
}

.content h2,
.content h3,
.content h4 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial;
  letter-spacing: -0.01em;
}

.content h2 {
  margin: 2.2em 0 0.7em;
  font-size: 26px;
  line-height: 1.25;
}

.content h3 {
  margin: 1.8em 0 0.6em;
  font-size: 20px;
  line-height: 1.3;
}

.content ul,
.content ol {
  margin: 0 0 1.1em 1.2em;
  padding: 0;
}

.content li {
  margin: 0.25em 0;
}

.content blockquote {
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1em;
  border-left: 3px solid color-mix(in srgb, var(--reader-text) 18%, transparent);
  color: color-mix(in srgb, var(--reader-text) 82%, transparent);
}

.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 0.92em;
  background: #eef2f7;
  padding: 0.15em 0.35em;
  border-radius: 6px;
}

.content pre {
  margin: 1.2em 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: 12px;
  background: #0b1220;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border-radius: 12px;
  border: 1px solid var(--reader-border);
  background: #ffffff;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2em 0;
  border: 1px solid var(--reader-border);
  border-radius: 12px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial;
  font-size: 14px;
}

.content th,
.content td {
  border-bottom: 1px solid var(--reader-border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.content thead th {
  background: #f8fafc;
  font-weight: 650;
}

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

.status {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 13px;
  color: var(--reader-muted);
  background: color-mix(in srgb, var(--reader-bg) 65%, transparent);
  border: 1px solid var(--reader-border);
  border-radius: 12px;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .paper {
    padding: 22px 18px 26px;
    border-radius: 14px;
  }

  .meta h1 {
    font-size: 34px;
  }

  .content {
    font-size: 17px;
  }

  .topbar-inner {
    padding: 10px 12px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --reader-bg: #0b1020;
    --reader-paper: #0f172a;
    --reader-text: #e5e7eb;
    --reader-muted: #a7b0bf;
    --reader-border: rgba(229, 231, 235, 0.12);
    --reader-link: #7dd3fc;
  }

  .btn.primary {
    background: #e5e7eb;
    border-color: #e5e7eb;
    color: #0b1020;
  }

  .content code {
    background: rgba(255, 255, 255, 0.08);
  }

  .content thead th {
    background: rgba(255, 255, 255, 0.06);
  }
}

