/* ============================================================
   Spamboy — complete stylesheet
   ============================================================ */

/* ---------- Custom properties ---------- */
:root {
  --sb-bg: #f5f5f2;
  --sb-surface: #fafaf8;
  --sb-text: #1a1917;
  --sb-muted: #706e69;
  --sb-border: rgba(30, 28, 25, 0.1);
  --sb-divider: rgba(30, 28, 25, 0.07);
  --sb-accent: #4a4845;
  --sb-tag-bg: #e8e7e3;
  --sb-tag-text: #3d3b38;
  --sb-link: #3d6b8f;
  --sb-link-hover: #2a4f6e;
  --sb-code-bg: #eeede9;

  --sb-serif: 'EB Garamond', Georgia, serif;
  --sb-display: 'Fraunces', Georgia, serif;
  --sb-sans: 'DM Sans', system-ui, sans-serif;
  --sb-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
}

[data-theme="dark"] {
  --sb-bg: #3e4858;
  --sb-surface: rgba(50, 61, 77, 0.7);
  --sb-text: #f0f2f5;
  --sb-muted: #c2c8d4;
  --sb-border: rgba(200, 210, 225, 0.14);
  --sb-divider: rgba(200, 210, 225, 0.1);
  --sb-accent: #d0d6e0;
  --sb-tag-bg: #323d4d;
  --sb-tag-text: #c2c8d4;
  --sb-link: #7fb3d3;
  --sb-link-hover: #a8cde3;
  --sb-code-bg: #2e3a4a;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--sb-bg);
  color: var(--sb-text);
  font-family: var(--sb-serif);
  font-size: 18px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.2s ease, color 0.2s ease;
}

img { max-width: 100%; }

a { color: inherit; }

/* ============================================================
   Header
   ============================================================ */
.sb-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--sb-surface);
  border-bottom: 0.5px solid var(--sb-border);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.sb-wordmark {
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--sb-text);
  text-decoration: none;
  line-height: 1;
}

/* (nav links now live inside the hamburger menu) */

/* Theme toggle */
.sb-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0.5px solid var(--sb-border);
  border-radius: 6px;
  background: none;
  color: var(--sb-muted);
  font-family: var(--sb-sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sb-theme-toggle:hover { color: var(--sb-text); border-color: var(--sb-accent); }
.sb-theme-toggle svg { width: 13px; height: 13px; display: block; }
.sb-theme-toggle .sb-icon-sun { display: none; }
.sb-theme-toggle .sb-icon-moon { display: block; }
[data-theme="dark"] .sb-theme-toggle .sb-icon-sun { display: block; }
[data-theme="dark"] .sb-theme-toggle .sb-icon-moon { display: none; }

/* Hamburger (always visible, right-aligned) */
.sb-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  border: 0.5px solid var(--sb-border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.sb-hamburger span {
  display: block;
  height: 1.5px;
  width: 16px;
  margin: 0 auto;
  background: var(--sb-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.sb-header.is-open .sb-hamburger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.sb-header.is-open .sb-hamburger span:nth-child(2) { opacity: 0; }
.sb-header.is-open .sb-hamburger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Dropdown menu (right-aligned card, all viewports) */
.sb-mobile-menu {
  display: none;
  position: absolute;
  top: 58px;
  right: 1.5rem;
  min-width: 190px;
  background: var(--sb-surface);
  border: 0.5px solid var(--sb-border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(20, 18, 15, 0.16);
  padding: 0.4rem;
  z-index: 20;
}
/* Dropdown has no backdrop blur, so use a solid surface in dark mode
   (the shared --sb-surface is translucent for the blurred header bar). */
[data-theme="dark"] .sb-mobile-menu { background: #323d4d; }
.sb-header.is-open .sb-mobile-menu { display: block; }
.sb-mobile-menu a {
  display: block;
  position: relative;
  font-family: var(--sb-sans);
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--sb-text);
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}
.sb-mobile-menu a:hover { background: var(--sb-tag-bg); color: var(--sb-text); }
.sb-mobile-menu a.is-active {
  font-weight: 500;
}
.sb-mobile-menu a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--sb-accent);
}
.sb-mobile-menu .sb-mobile-theme {
  margin-top: 0.3rem;
  padding-top: 0.35rem;
  border-top: 0.5px solid var(--sb-divider);
}
.sb-mobile-menu .sb-theme-toggle {
  width: 100%;
  justify-content: flex-start;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  font-size: 13px;
  color: var(--sb-text);
}
.sb-mobile-menu .sb-theme-toggle:hover { background: var(--sb-tag-bg); border-color: transparent; color: var(--sb-text); }
.sb-mobile-menu .sb-theme-toggle svg { width: 15px; height: 15px; }

/* ============================================================
   Footer
   ============================================================ */
.sb-footer {
  background: var(--sb-surface);
  border-top: 0.5px solid var(--sb-border);
  text-align: center;
  padding: 1.5rem;
  margin-top: 4rem;
  font-family: var(--sb-sans);
  font-size: 12.5px;
  color: var(--sb-muted);
}

/* ============================================================
   Centered column (home / blog / static)
   ============================================================ */
.sb-column {
  max-width: 640px;
  margin: 0 auto;
  padding: 3.5rem 2rem 4rem;
}

/* ---------- Home intro ---------- */
.sb-eyebrow {
  font-family: var(--sb-display);
  font-style: italic;
  font-size: 17px;
  color: var(--sb-muted);
  margin: 0 0 1rem;
}
.sb-intro {
  font-size: 19px;
  line-height: 1.85;
  color: var(--sb-muted);
  margin: 0 0 2.75rem;
}

/* ---------- Home entry list ---------- */
.sb-entries { margin-top: 1rem; }
.sb-entry {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--sb-border);
}
.sb-entry-year {
  font-family: var(--sb-sans);
  font-size: 12px;
  color: var(--sb-muted);
  letter-spacing: 0.02em;
}
.sb-entry-main {
  display: block;
  min-width: 0;
}
.sb-entry .sb-tag {
  margin-left: 0.5rem;
  vertical-align: middle;
  position: relative;
  top: -0.29em;
}
.sb-entry-title {
  font-family: var(--sb-serif);
  font-size: 18px;
  color: var(--sb-text);
  text-decoration: none;
  transition: color 0.15s ease;
}
.sb-entry:hover .sb-entry-title { color: var(--sb-muted); }
.sb-entry-date {
  font-family: var(--sb-sans);
  font-size: 13px;
  color: var(--sb-muted);
  white-space: nowrap;
  text-align: right;
}

/* ============================================================
   Blog archive
   ============================================================ */
.sb-page-heading {
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0 0 0.3rem;
  letter-spacing: -0.01em;
}
.sb-subhead {
  font-family: var(--sb-serif);
  font-size: 16px;
  color: var(--sb-muted);
  margin: 0 0 2.5rem;
}

.sb-card {
  padding: 1.6rem 0;
  border-bottom: 0.5px solid var(--sb-divider);
}
.sb-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--sb-sans);
  font-size: 12.5px;
  color: var(--sb-muted);
  margin-bottom: 0.5rem;
}
.sb-card-meta .sb-dot { opacity: 0.5; }
.sb-card-title {
  display: inline-block;
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.25;
  color: var(--sb-text);
  text-decoration: none;
  margin: 0 0 0.4rem;
  transition: color 0.15s ease;
}
.sb-card-title:hover { color: var(--sb-muted); }
.sb-card-excerpt {
  font-family: var(--sb-serif);
  font-size: 17px;
  line-height: 1.8;
  color: var(--sb-muted);
  margin: 0;
}

/* Pagination */
.sb-pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
}
.sb-pagination a {
  font-family: var(--sb-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.sb-pagination a:hover { color: var(--sb-text); }
.sb-pagination a.is-hidden { visibility: hidden; }

/* ============================================================
   Individual post layout
   ============================================================ */
.sb-post {
  display: grid;
  grid-template-columns: 200px 1fr 80px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ToC sidebar */
.sb-toc {
  grid-column: 1;
  position: sticky;
  top: 76px;
  align-self: start;
  padding: 0 0 0 1.5rem;
}
.sb-toc ul { list-style: none; margin: 0; padding: 0; }
.sb-toc a {
  display: block;
  font-family: var(--sb-sans);
  font-size: 12px;
  line-height: 1.4;
  color: var(--sb-muted);
  text-decoration: none;
  padding: 0.28rem 0 0.28rem 0.7rem;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sb-toc a:hover { color: var(--sb-text); }
.sb-toc a.is-active {
  color: var(--sb-text);
  border-left-color: var(--sb-accent);
  font-weight: 500;
}
.sb-toc a.lvl-3 {
  padding-left: 1.5rem;
  font-size: 11px;
}

/* Article column */
.sb-article {
  /* Pin to the centre track so a hidden/absent ToC (heading-less posts,
     where toc.js sets display:none) can't reflow the article into the
     narrow 200px first column. */
  grid-column: 2;
  padding: 2.5rem 3rem 4rem;
  min-width: 0;
}
.sb-gutter { grid-column: 3; }
.sb-backlink {
  display: inline-block;
  font-family: var(--sb-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color 0.15s ease;
}
.sb-backlink:hover { color: var(--sb-text); }
.sb-article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--sb-sans);
  font-size: 12.5px;
  color: var(--sb-muted);
  margin-bottom: 0.75rem;
}
.sb-article-meta .sb-dot { opacity: 0.5; }
.sb-article-title {
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin: 0 0 2rem;
}

.sb-gutter { /* 80px breathing room — intentionally empty */ }

/* ============================================================
   Markdown / body styles
   ============================================================ */
.sb-body { font-family: var(--sb-serif); }
.sb-body > *:first-child { margin-top: 0; }

.sb-body p {
  font-size: 18px;
  line-height: 1.85;
  margin: 0 0 1.4em;
}
.sb-body a {
  color: var(--sb-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}
.sb-body a:hover { color: var(--sb-link-hover); }

.sb-body h2 {
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.3;
  margin: 2em 0 0.5em;
}
.sb-body h3 {
  font-family: var(--sb-display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.3;
  margin: 1.6em 0 0.4em;
}
.sb-body strong { font-weight: 600; }
.sb-body em { font-style: italic; }

.sb-body blockquote {
  border-left: 2px solid var(--sb-border);
  padding-left: 1.25em;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--sb-muted);
}
.sb-body blockquote p:last-child { margin-bottom: 0; }

.sb-body ul,
.sb-body ol {
  margin: 0 0 1.4em 1.4em;
  padding: 0;
}
.sb-body ul { list-style: disc; }
.sb-body ol { list-style: decimal; }
.sb-body li { margin-bottom: 0.3em; }
.sb-body li > ul,
.sb-body li > ol {
  margin: 0.3em 0 0.3em 1.25em;
}

.sb-body code {
  font-family: var(--sb-mono);
  font-size: 14px;
  background: var(--sb-code-bg);
  border: 0.5px solid var(--sb-border);
  border-radius: 3px;
  padding: 1px 5px;
}
.sb-body pre {
  background: var(--sb-code-bg);
  border: 0.5px solid var(--sb-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5em 0;
}
.sb-body pre code {
  font-size: 13.5px;
  background: none;
  border: none;
  padding: 0;
  line-height: 1.6;
}

.sb-body hr {
  border: 0;
  border-top: 1px solid var(--sb-border);
  margin: 2em 0;
}

.sb-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sb-sans);
  font-size: 14px;
  margin: 1.5em 0;
}
.sb-body th {
  text-align: left;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--sb-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--sb-border);
  padding: 0.5em 0.75em 0.5em 0;
}
.sb-body td {
  border-bottom: 0.5px solid var(--sb-divider);
  padding: 0.55em 0.75em 0.55em 0;
}

.sb-body sup {
  color: var(--sb-link);
  font-size: 11px;
}
.sb-body sup a { text-decoration: none; }

/* Footnotes block (markdown-it-footnote) */
.sb-body .footnotes {
  font-family: var(--sb-sans);
  font-size: 14px;
  color: var(--sb-muted);
  border-top: 1px solid var(--sb-border);
  margin-top: 2.5rem;
  padding-top: 1rem;
}
.sb-body .footnotes ol { margin-left: 1.2em; }
.sb-body .footnotes hr { display: none; }
/* The plugin emits the rule as a sibling <hr class="footnotes-sep"> and uses
   .footnotes-list / .footnote-item / .footnote-backref for the list + back-links. */
.sb-body .footnotes-sep { display: none; }
.sb-body .footnotes-list { margin-left: 1.2em; }
.sb-body .footnote-item p { margin: 0.35em 0; }
.sb-body .footnote-backref {
  text-decoration: none;
  margin-left: 0.35em;
  color: var(--sb-accent, var(--sb-muted));
}

/* ---------- Figures / images ---------- */
.sb-figure { margin: 2em 0; }
.sb-img-wrap {
  overflow: hidden;
  border-radius: 6px;
  cursor: zoom-in;
}
.sb-img-wrap img {
  width: 100%;
  display: block;
  transition: transform 0.3s ease;
}
.sb-img-wrap:hover img { transform: scale(1.025); }
.sb-figure figcaption {
  font-family: var(--sb-sans);
  font-size: 13px;
  font-style: italic;
  color: var(--sb-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ---------- Lightbox ---------- */
.sb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
}
.sb-lightbox.is-open { display: flex; }
.sb-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.sb-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sb-lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

/* ============================================================
   Tags
   ============================================================ */
.sb-tag {
  font-size: 10.5px;
  background: var(--sb-tag-bg);
  color: var(--sb-tag-text);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--sb-sans);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: inline-block;
  transition: background 0.12s, color 0.12s;
}
.sb-tag:hover {
  background: var(--sb-accent);
  color: var(--sb-bg);
}

/* ---------- Tags page cloud ---------- */
.sb-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.sb-cloud-tag {
  background: var(--sb-tag-bg);
  color: var(--sb-tag-text);
  font-family: var(--sb-sans);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  padding: 4px 11px;
  border-radius: 5px;
  line-height: 1.3;
  transition: background 0.12s, color 0.12s;
}
.sb-cloud-tag:hover { background: var(--sb-accent); color: var(--sb-bg); }
.sb-cloud-tag.is-selected { background: var(--sb-text); color: var(--sb-bg); }
.sb-cloud-tag .sb-count {
  font-size: 0.85em;
  opacity: 0.65;
  margin-left: 0.25em;
}
.sb-cloud-tag.sz-xl { font-size: 16px; }
.sb-cloud-tag.sz-lg { font-size: 14px; }
.sb-cloud-tag.sz-md { font-size: 13px; }
.sb-cloud-tag.sz-sm { font-size: 12px; }
.sb-cloud-tag.sz-xs { font-size: 11px; }

/* Filtered results */
.sb-tag-results { margin-top: 2.25rem; }
.sb-tag-results[hidden] { display: none; }
.sb-results-label {
  font-family: var(--sb-sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sb-muted);
  margin: 0 0 0.6rem;
}
/* On the individual tag page the label sits under the big heading. */
.sb-column > .sb-results-label { margin-top: 1.1rem; }
.sb-results-divider {
  border: 0;
  border-top: 1px solid var(--sb-border);
  margin: 0 0 0.5rem;
}
.sb-tag-results .sb-entry,
.sb-entries--compact .sb-entry {
  grid-template-columns: 1fr auto;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sb-post {
    grid-template-columns: 1fr;
    max-width: 680px;
  }
  .sb-toc { display: none; }
  .sb-gutter { display: none; }
  .sb-article { grid-column: 1; padding: 2rem 1.5rem 3rem; }
}

/* ---- Mobile typography ----
   Desktop px sizes read well but are too small on phones, so bump the
   text ~1.5x at narrow widths. Desktop (>768px) is left untouched.
   Unitless line-heights scale with these automatically. */
@media (max-width: 768px) {
  body { font-size: 27px; }

  .sb-wordmark { font-size: 26px; }
  .sb-mobile-menu a { font-size: 19px; }
  .sb-theme-toggle { font-size: 19px; }

  /* Home + list pages */
  .sb-eyebrow { font-size: 25px; }
  .sb-intro { font-size: 28px; }
  .sb-entry-year { font-size: 17px; }
  .sb-entry-title { font-size: 26px; }
  .sb-entry-date { font-size: 18px; }
  .sb-page-title { font-size: 38px; }
  .sb-subhead { font-size: 23px; }
  .sb-card-meta { font-size: 18px; }
  .sb-card-title { font-size: 29px; }
  .sb-card-excerpt { font-size: 25px; }
  .sb-pagination a { font-size: 17px; }

  /* Article */
  .sb-backlink { font-size: 17px; }
  .sb-article-meta { font-size: 18px; }
  .sb-article-title { font-size: 42px; }
  .sb-body p { font-size: 26px; }
  .sb-body h2 { font-size: 32px; }
  .sb-body h3 { font-size: 26px; }
  .sb-body code { font-size: 20px; }
  .sb-body pre code { font-size: 19px; }
  .sb-body table { font-size: 20px; }
  .sb-body th { font-size: 16px; }
  .sb-body .footnotes { font-size: 20px; }
  .sb-figure figcaption { font-size: 19px; }

  /* Tags + footer */
  .sb-tag { font-size: 15px; }
  .sb-results-label { font-size: 16px; }
  .sb-cloud-tag.sz-xl { font-size: 24px; }
  .sb-cloud-tag.sz-lg { font-size: 21px; }
  .sb-cloud-tag.sz-md { font-size: 19px; }
  .sb-cloud-tag.sz-sm { font-size: 18px; }
  .sb-cloud-tag.sz-xs { font-size: 16px; }
  .sb-footer { font-size: 18px; }
}

@media (max-width: 640px) {
  .sb-mobile-menu { left: 1rem; right: 1rem; min-width: 0; }
  .sb-column { padding: 2.5rem 1.5rem 3rem; }
}

@media (max-width: 400px) {
  .sb-article-title { font-size: 34px; }
}
