/* Dark blog: black background, white text, clear code blocks */
html {
  font-size: 16px;
}

:root {
  --bg: #0a0a0a;
  --text: #f5f5f5;
  --muted: #a0a0a0;
  --border: #2a2a2a;
  --link: #7eb8ff;
  --code-bg: #1a1a1a;
  --code-border: #333;
}

* { box-sizing: border-box; }

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

/* Content width: comfortable on mobile, wider on large screens (viewport-based, no device detection) */
.wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 992px) {
  .wrapper {
    max-width: 880px;
    padding: 0 2rem;
  }
}

@media (min-width: 1200px) {
  .wrapper {
    max-width: 1000px;
  }
}

@media (min-width: 1400px) {
  .wrapper {
    max-width: 1150px;
  }
}

@media (min-width: 1600px) {
  .wrapper {
    max-width: 1280px;
  }
}

/* Full-bleed pages (e.g. embedded flyer HTML) */
.wrapper.wrapper--full-width {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

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

.site-header .wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--link);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.page-content {
  padding: 2rem 0;
}

.post-header {
  margin-bottom: 1.5rem;
}

.post-title {
  margin: 0 0 0.35rem 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fafafa;
  letter-spacing: -0.02em;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Body vs headings: keep hierarchy obvious (h3 was nearly same size as body before) */
.post-content {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #e8e8e8;
}

.post-content h2 {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2.35rem;
  margin-bottom: 0.75rem;
  color: #fafafa;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.post-content h2:first-child {
  margin-top: 0.5rem;
}

.post-content h3 {
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 1.85rem;
  margin-bottom: 0.5rem;
  color: #f0f4f8;
}

.post-content p {
  margin: 0 0 1rem 0;
}

.post-content ul, .post-content ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--link);
  background: #141414;
  color: #dcdcdc;
  font-size: 0.98rem;
}

.post-content blockquote p {
  margin: 0;
}

/* Images: scale with blog content width, keep aspect ratio */
.post-content img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* SVG diagrams (often wide aspect): do not force 100% width; scale down inside column */
.post-content img[src$=".svg"] {
  width: auto;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Inline SVG diagrams (e.g. heap figures in posts) */
.post-content svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Inline code (10% smaller) */
.post-content code {
  background: var(--code-bg);
  color: #e0e0e0;
  padding: 0.2em 0.4em;
  font-size: 0.81em;
  border-radius: 4px;
  border: 1px solid var(--code-border);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

/* Code blocks: no vertical scroll; long lines wrap */
.post-content pre,
.post-content .highlight {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: visible;
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 120, 0.6) transparent;
  scrollbar-gutter: stable;
}

.post-content pre::-webkit-scrollbar,
.post-content .highlight::-webkit-scrollbar {
  height: 8px;
}

.post-content pre::-webkit-scrollbar-track,
.post-content .highlight::-webkit-scrollbar-track {
  background: transparent;
  margin: 0 4px;
}

.post-content pre::-webkit-scrollbar-thumb,
.post-content .highlight::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 120, 0.5);
  border-radius: 4px;
  min-width: 40px;
}

.post-content pre::-webkit-scrollbar-thumb:hover,
.post-content .highlight::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 140, 140, 0.7);
}

.post-content pre::-webkit-scrollbar-thumb:active,
.post-content .highlight::-webkit-scrollbar-thumb:active {
  background: rgba(160, 160, 160, 0.8);
}

.post-content pre {
  padding: 1rem 1.25rem;
}

.post-content .highlight pre {
  padding: 1rem 1.25rem;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 0;
}

.post-content pre code {
  padding: 0;
  background: none;
  border: none;
  font-size: 0.7875rem;
  line-height: 1.5;
  color: #e0e0e0;
}

/* Table (10% smaller font) */
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.945rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content th {
  font-weight: 600;
  background: #1e1e1e;
}

/* Rouge syntax highlighting (GitHub Pages) - multi-colour dark theme */
.highlight .c  { color: #6a9955; }  /* comment */
.highlight .cm { color: #6a9955; }  /* comment.multiline */
.highlight .cp { color: #6a9955; }  /* comment.preproc */
.highlight .k  { color: #569cd6; }  /* keyword */
.highlight .kc { color: #569cd6; }  /* keyword.constant */
.highlight .kd { color: #569cd6; }  /* keyword.declaration */
.highlight .kn { color: #569cd6; }  /* keyword.namespace */
.highlight .kp { color: #569cd6; }  /* keyword.pseudo */
.highlight .kr { color: #569cd6; }  /* keyword.reserved */
.highlight .kt { color: #4ec9b0; }  /* keyword.type */
.highlight .s  { color: #ce9178; }  /* string */
.highlight .s1 { color: #ce9178; }  /* string.single */
.highlight .s2 { color: #ce9178; }  /* string.double */
.highlight .sb { color: #ce9178; }  /* string.backtick */
.highlight .sc { color: #ce9178; }  /* string.char */
.highlight .sd { color: #6a9955; }  /* string.doc */
.highlight .se { color: #d7ba7d; }  /* string.escape */
.highlight .sh { color: #ce9178; }  /* string.heredoc */
.highlight .si { color: #ce9178; }  /* string.interpol */
.highlight .sx { color: #ce9178; }  /* string.other */
.highlight .sr { color: #d7ba7d; }  /* string.regex */
.highlight .nf { color: #dcdcaa; }  /* function name */
.highlight .na { color: #9cdcfe; }  /* name.attribute */
.highlight .nb { color: #9cdcfe; }  /* builtin */
.highlight .bp { color: #9cdcfe; }  /* name.builtin.pseudo */
.highlight .nc { color: #4ec9b0; }  /* name.class */
.highlight .no { color: #569cd6; }  /* name.constant */
.highlight .nd { color: #dcdcaa; }  /* name.decorator */
.highlight .ni { color: #4ec9b0; }  /* name.entity */
.highlight .ne { color: #569cd6; }  /* name.exception */
.highlight .nn { color: #4ec9b0; }  /* name.namespace */
.highlight .nv { color: #9cdcfe; }  /* name.variable */
.highlight .vc { color: #9cdcfe; }  /* name.variable.class */
.highlight .vg { color: #9cdcfe; }  /* name.variable.global */
.highlight .vi { color: #9cdcfe; }  /* name.variable.instance */
.highlight .m  { color: #b5cea8; }  /* number */
.highlight .mi { color: #b5cea8; }  /* number.integer */
.highlight .mf { color: #b5cea8; }  /* number.float */
.highlight .mh { color: #b5cea8; }  /* number.hex */
.highlight .o  { color: #d4d4d4; }  /* operator */
.highlight .p  { color: #d4d4d4; }  /* punctuation */
.highlight .ow { color: #d4d4d4; }  /* operator.word */
.highlight .n  { color: #d4d4d4; }  /* name (default) */

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

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

.post-list li:last-child {
  border-bottom: none;
}

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

.post-list a:hover {
  color: var(--link);
}

.post-list .post-meta {
  margin-top: 0.25rem;
}

a {
  color: var(--link);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .site-footer-nav {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.site-footer .site-footer-nav a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}

.site-footer .site-footer-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer .site-footer-credit {
  margin: 0;
  color: var(--muted);
}

.site-footer .site-footer-analytics-notice {
  margin: 0.75rem 0 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--link);
}
