/* ── Variables ────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  --bg:           #0d1117;
  --bg-2:         #161b22;
  --bg-3:         #21262d;
  --text:         #e6edf3;
  --text-2:       #8b949e;
  --text-3:       #484f58;
  --border:       rgba(66, 174, 176, 0.14);
  --border-2:     rgba(66, 174, 176, 0.35);
  --petrol:       #008f89;
  --petrol-light: #42aeb0;
  --petrol-dim:   rgba(0, 143, 137, 0.12);
  --link:         #42aeb0;
  --link-hover:   #72cdd0;
  --code-bg:      #0d1117;
  --code-border:  rgba(66, 174, 176, 0.18);
  --tag-bg:       rgba(0, 143, 137, 0.14);
  --tag-border:   rgba(66, 174, 176, 0.3);
  --tag-text:     #42aeb0;
  --admon-bg:     rgba(255, 255, 255, 0.03);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg:           #ffffff;
  --bg-2:         #f6f8fa;
  --bg-3:         #eaeef2;
  --text:         #1f2328;
  --text-2:       #656d76;
  --text-3:       #9ba3ad;
  --border:       rgba(0, 143, 137, 0.14);
  --border-2:     rgba(0, 143, 137, 0.3);
  --petrol:       #008f89;
  --petrol-light: #006d69;
  --petrol-dim:   rgba(0, 143, 137, 0.07);
  --link:         #007b76;
  --link-hover:   #005753;
  --code-bg:      #f6f8fa;
  --code-border:  rgba(0, 143, 137, 0.15);
  --tag-bg:       rgba(0, 143, 137, 0.09);
  --tag-border:   rgba(0, 143, 137, 0.22);
  --tag-text:     #006d69;
  --admon-bg:     rgba(0, 0, 0, 0.02);
  color-scheme: light;
}

/* ── Reset & Base ─────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { max-width: 100%; height: auto; }

/* ── Progress bar ─────────────────────────────────────────── */

#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--petrol-light);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ── Layout ───────────────────────────────────────────────── */

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

.site-main {
  flex: 1;
  padding: 3rem 0 5rem;
}

/* ── Header ───────────────────────────────────────────────── */

.site-header {
  background: var(--petrol);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 3.25rem;
}

.logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo:hover { color: #fff; text-decoration: none; opacity: 0.85; }

.logo-prompt {
  color: rgba(255, 255, 255, 0.55);
}

/* NOLAI triangle mark — rendered white to sit on the petrol header */
.logo-mark {
  height: 20px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); text-decoration: none; }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.15); }

.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.75);
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: #fff; color: #fff; }

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  background: var(--bg-2);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
}
.footer-brand:hover { text-decoration: none; opacity: 0.85; }

.footer-logo {
  height: 40px;
  width: auto;
  display: block;
}

.logo-prompt { color: var(--petrol-light); }

.footer-links { display: flex; gap: 1.25rem; }

.footer-link {
  font-size: 0.82rem;
  color: var(--text-2);
  transition: color 0.15s;
}
.footer-link:hover { color: var(--petrol-light); text-decoration: none; }

/* ── Page / Regular content ───────────────────────────────── */

.page-content {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.content-body { min-width: 0; flex: 1; }


.post-body h1:first-child {
  display: none;
}
/* ── TOC sidebar ──────────────────────────────────────────── */

.toc {
  flex-shrink: 0;
  width: 220px;
  position: sticky;
  top: 5rem;
  order: 2;
}

.toc-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--petrol-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.toc-link {
  display: block;
  font-size: 0.8rem;
  color: var(--text-2);
  padding: 0.15rem 0;
  border-left: 2px solid var(--border);
  padding-left: 0.75rem;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.toc-link:hover { color: var(--petrol-light); border-color: var(--petrol-light); text-decoration: none; }
.toc-l2 { padding-left: 0.75rem; }
.toc-l3 { padding-left: 1.5rem; font-size: 0.76rem; }

/* ── Markdown content styles ──────────────────────────────── */

.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4,
.md-content h5,
.md-content h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 2em 0 0.6em;
}

.md-content h1 { font-size: 2rem;   color: var(--petrol-light); letter-spacing: -0.02em; margin-top: 0; }
.md-content h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.md-content h3 { font-size: 1.15rem; }
.md-content h4 { font-size: 1rem; }

/* Heading permalinks — hide the ¶ symbol everywhere, show # on hover */
.headerlink { display: none !important; }

/* Anchored headings are deep-link targets — keep them clear of the sticky header */
h2[id], h3[id], h4[id] { cursor: pointer; scroll-margin-top: 4.75rem; }

h2[id]:hover::after,
h3[id]:hover::after,
h4[id]:hover::after {
  content: ' #';
  color: var(--petrol-light);
  font-weight: 400;
  font-size: 0.65em;
  opacity: 0.55;
  vertical-align: middle;
}

.md-content p { margin: 1em 0; }
.md-content p:first-child { margin-top: 0; }

.md-content ul,
.md-content ol { padding-left: 1.75em; margin: 1em 0; }
.md-content li { margin: 0.35em 0; }
.md-content li > ul,
.md-content li > ol { margin: 0.25em 0; }

.md-content blockquote {
  border-left: 3px solid var(--petrol);
  margin: 1.5em 0;
  padding: 0.5em 1.25em;
  color: var(--text-2);
  background: var(--petrol-dim);
  border-radius: 0 4px 4px 0;
}
.md-content blockquote p { margin: 0; }

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

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9em;
  overflow-x: auto;
  display: block;
}
.md-content th,
.md-content td {
  border: 1px solid var(--border);
  padding: 0.5em 0.85em;
  text-align: left;
}
.md-content th {
  background: var(--bg-2);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}
.md-content tr:nth-child(even) td { background: var(--bg-2); }

/* Inline code */
.md-content code:not(.highlight code):not(pre code) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--petrol-dim);
  color: var(--petrol-light);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.1em 0.38em;
}

/* Code blocks */
.md-content pre,
.highlight {
  margin: 1.5em 0;
  border-radius: 6px;
  overflow-x: auto;
  background: var(--bg-2) !important;
  border: 1px solid var(--code-border);
}

.md-content pre code,
.highlight code {
  display: block;
  padding: 1.1rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  border: none;
}

/* Code block with language label */
.highlight [class^="language-"] { background: transparent; }

/* Line numbers */
.highlight .linenodiv pre {
  color: var(--text-3);
  border-right: 1px solid var(--border);
  padding-right: 0.75em;
  user-select: none;
}

/* ── Pygments — dark ──────────────────────────────────────── */

.highlight .hll { background: rgba(66,174,176,0.1); }
.highlight .c,  .highlight .c1, .highlight .cm, .highlight .cs  { color: #6b7280; font-style: italic; }
.highlight .k,  .highlight .kd, .highlight .kn, .highlight .kr  { color: #42aeb0; font-weight: 500; }
.highlight .kt                                                    { color: #42aeb0; }
.highlight .kp                                                    { color: #42aeb0; }
.highlight .nf, .highlight .fm                                   { color: #79c0ff; }
.highlight .nc                                                    { color: #d2a8ff; }
.highlight .nn                                                    { color: #d2a8ff; }
.highlight .nb, .highlight .bp                                   { color: #42aeb0; }
.highlight .s,  .highlight .s1, .highlight .s2, .highlight .sb,
.highlight .sc, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .ss                                   { color: #a5d6ff; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo  { color: #e6cc7a; }
.highlight .o,  .highlight .ow                                   { color: #ffa657; }
.highlight .p                                                     { color: #c9d1d9; }
.highlight .nv, .highlight .vi, .highlight .vm                   { color: #c9d1d9; }
.highlight .na                                                    { color: #79c0ff; }
.highlight .nd                                                    { color: #d2a8ff; }
.highlight .ni                                                    { color: #c9d1d9; }
.highlight .ne                                                    { color: #ff7b72; }
.highlight .nt                                                    { color: #7ee787; }
.highlight .err  { color: #ff7b72; background: none; }
.highlight .gd   { color: #ff7b72; background: rgba(255,123,114,0.08); }
.highlight .gi   { color: #3fb950; background: rgba(63,185,80,0.08); }
.highlight .gh   { color: #79c0ff; font-weight: 600; }
.highlight .gu   { color: #79c0ff; }
.highlight .gr   { color: #ff7b72; }

[data-theme="light"] .highlight .c,
[data-theme="light"] .highlight .c1,
[data-theme="light"] .highlight .cm  { color: #6e7781; }
[data-theme="light"] .highlight .k,
[data-theme="light"] .highlight .kd,
[data-theme="light"] .highlight .kn  { color: #008f89; }
[data-theme="light"] .highlight .nf  { color: #0550ae; }
[data-theme="light"] .highlight .nc  { color: #953800; }
[data-theme="light"] .highlight .s,
[data-theme="light"] .highlight .s1,
[data-theme="light"] .highlight .s2  { color: #0a3069; }
[data-theme="light"] .highlight .mi,
[data-theme="light"] .highlight .mf  { color: #0550ae; }
[data-theme="light"] .highlight .nb  { color: #008f89; }
[data-theme="light"] .highlight .o   { color: #c72020; }

/* ── Admonitions ──────────────────────────────────────────── */

.md-content .admonition,
.md-content details {
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--admon-bg);
  padding: 1rem 1.25rem;
  margin: 1.5em 0;
}

.md-content .admonition-title,
.md-content summary {
  font-weight: 700;
  font-size: 0.9em;
  color: var(--petrol-light);
  margin-bottom: 0.5em;
  cursor: default;
  font-family: 'JetBrains Mono', monospace;
}
.md-content summary { cursor: pointer; }

.md-content .note   { border-color: rgba(66,174,176,0.4); }
.md-content .warning { border-color: rgba(255,166,87,0.5); }
.md-content .warning .admonition-title { color: #ffa657; }
.md-content .danger { border-color: rgba(255,123,114,0.5); }
.md-content .danger .admonition-title  { color: #ff7b72; }
.md-content .tip    { border-color: rgba(63,185,80,0.4); }
.md-content .tip .admonition-title    { color: #3fb950; }

/* ── Blog index ───────────────────────────────────────────── */

.blog-index-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.blog-index-header h1 {
  font-size: 2rem;
  color: var(--petrol-light);
  margin-bottom: 0.5rem;
}

.post-list { display: flex; flex-direction: column; gap: 0; }

.post-card {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}
.post-card:first-child { padding-top: 0; }

.post-card--has-image {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.post-card-body { flex: 1; min-width: 0; }

.post-card-content { display: flex; flex-direction: row; gap: 1.5rem; justify-content: space-between}
.post-card-thumb {
  flex-shrink: 0;
  display: block;
  width: 140px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
  align-self: center;
}
.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.post-card-thumb:hover img { opacity: 0.85; }

@media (max-width: 480px) {
  .post-card-thumb { width: 90px; height: 70px; }
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.post-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-2);
}

.post-sep { color: var(--text-3); font-size: 0.78rem; }

.post-readtime {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-2);
}

.post-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.post-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  padding: 0.1em 0.5em;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.post-tag:hover { background: var(--petrol-dim); border-color: var(--petrol); color: var(--petrol-light); text-decoration: none; }

.toclink {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.65rem;
}
.toclink {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}
.toclink:hover { color: var(--petrol-light); text-decoration: none; }

.post-card-title {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin: 0 0 0.65rem;
  line-height: 1.3;
  transition: color 0.15s;
}
.post-card-title:hover { color: var(--petrol-light); text-decoration: none; }

.post-excerpt {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 1rem;
}
.post-excerpt p { margin: 0; }

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.post-authors {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
}

.author-name-sm {
  font-size: 0.82rem;
  color: var(--text-2);
}

.read-more {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--petrol-light);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
  margin-left: auto;
}
.read-more:hover { color: var(--link-hover); text-decoration: none; }

.no-posts {
  color: var(--text-2);
  font-style: italic;
  padding: 2rem 0;
}

/* ── Pagination ───────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.pagination-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--petrol-light);
  text-decoration: none;
}
.pagination-link.disabled { color: var(--text-3); cursor: default; }
.pagination-link:not(.disabled):hover { color: var(--link-hover); text-decoration: none; }

/* ── Blog post ────────────────────────────────────────────── */

.post-back {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}
.post-back:hover { color: var(--petrol-light); text-decoration: none; }

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

.post-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--petrol-light);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 0.85rem;
}

.post-author { color: var(--text-2); }

.post-body { margin-top: 0; }

/* Post hero image */
.post-hero {
  margin-bottom: 2.5rem;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  border: 1px solid var(--border);
}
.post-hero img {
  width: 100%;
  height: 300px;
  display: block;
  object-fit: none;
}

/* Author card at post bottom */
.post-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.author-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  flex-shrink: 0;
}

.author-info { display: flex; flex-direction: column; gap: 0.2rem; }
.author-name { font-weight: 600; font-size: 0.9rem; }
.author-desc { font-size: 0.82rem; color: var(--text-2); }

/* Prev/next navigation */
.post-nav {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 45%;
  text-decoration: none;
}

.post-nav-next { align-items: flex-end; text-align: right; }

.post-nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-3);
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--petrol-light);
  transition: color 0.15s;
}
.post-nav-link:hover .post-nav-title { color: var(--link-hover); }

/* ── Home page ────────────────────────────────────────────── */

.page-content .content-body h1:first-child {
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  color: var(--petrol-light);
}

/* Button links (via attr_list) */
.md-content a.md-button {
  display: inline-block;
  padding: 0.55em 1.2em;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  border: 2px solid var(--petrol);
  color: var(--petrol-light);
  margin-right: 0.5em;
  margin-top: 0.5em;
}
.md-content a.md-button:hover { background: var(--petrol); color: #fff; text-decoration: none; }
.md-content a.md-button--primary { background: var(--petrol); color: #fff; }
.md-content a.md-button--primary:hover { background: var(--petrol-light); border-color: var(--petrol-light); }

/* ── 404 page ─────────────────────────────────────────────── */

.error-page {
  padding: 5rem 0;
  text-align: center;
}

.error-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 6rem;
  font-weight: 700;
  color: var(--border-2);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 2rem;
}
.error-path { color: var(--petrol-light); }

.error-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--petrol-light);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 900px) {
  .page-content { flex-direction: column; }
  .toc { width: 100%; position: static; order: -1; display: none; }
}

@media (max-width: 640px) {
  .site-header .logo-name { display: none; }
  .post-title { font-size: 1.6rem; }
  .post-nav-inner { flex-direction: column; }
  .post-nav-link { max-width: 100%; }
  .post-nav-next { align-items: flex-start; text-align: left; }
  .footer-inner { flex-direction: column; gap: 0.75rem; }
}

/* ── Archive page ─────────────────────────────────────────── */

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.archive-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--petrol-light);
  margin: 0;
}

.archive-search-wrap {
  flex-shrink: 0;
}

.archive-search {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 0.45em 0.85em;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.archive-search::placeholder { color: var(--text-3); }
.archive-search:focus { border-color: var(--petrol-light); }

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.archive-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-2);
  transition: border-color 0.15s, transform 0.15s;
}
.archive-card:hover {
  border-color: var(--petrol-light);
  transform: translateY(-2px);
  text-decoration: none;
}

.archive-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-3);
  overflow: hidden;
  line-height: 0;
}
.archive-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.archive-card:hover .archive-card-img img { opacity: 0.85; }

.archive-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 0.75rem 0.75rem;
  line-height: 1.4;
  transition: color 0.15s;
}
.archive-card:hover .archive-card-title { color: var(--petrol-light); }

.archive-no-results {
  color: var(--text-2);
  font-style: italic;
  padding: 2rem 0;
}

/* ── Newsletter (weekly techies edition) ──────────────────── */

/* Editions often use a square/portrait hero (e.g. the team photo); crop to
   frame it rather than the default object-fit:none center-band slice. */
.newsletter .post-hero img {
  height: 400px;
  object-fit: cover;
  object-position: center 30%;
}

/* Match the source Word document: title and every section heading in NOLAI
   teal (#008F89, the brand accent). Use the lighter tuned teal in dark mode so
   the headings keep enough contrast against the dark background. */
.newsletter .post-title,
.newsletter-body h1,
.newsletter-body h2,
.newsletter-body h3 {
  color: var(--petrol);
  font-weight: 800;
}
.newsletter .post-title { font-size: 2.9rem; }
.newsletter-body h2 { font-size: 2.05rem; }
.newsletter-body h3 { font-size: 1.6rem; }
[data-theme="dark"] .newsletter .post-title,
[data-theme="dark"] .newsletter-body h1,
[data-theme="dark"] .newsletter-body h2,
[data-theme="dark"] .newsletter-body h3 {
  color: var(--petrol-light);
}

/* Half-width images that text wraps around, mirroring the Word/ODF layout
   where a picture sits inside a column of text. Tag an image `{ .float-right }`
   or `{ .float-left }` (via attr_list). Section headings clear the float so a
   picture never bleeds into the next section. */
.newsletter-body img.float-right,
.newsletter-body img.float-left {
  width: 48%;
  max-width: 360px;
  height: auto;
  margin: 0.5rem 0 1rem;
}
.newsletter-body img.float-right { float: right; margin-left: 1.75rem; }
.newsletter-body img.float-left  { float: left;  margin-right: 1.75rem; }
.newsletter-body h2,
.newsletter-body h3 { clear: both; }

@media (max-width: 640px) {
  .newsletter-body img.float-right,
  .newsletter-body img.float-left {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 1em 0;
  }
}

.edition-toc {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--petrol);
  border-radius: 0 6px 6px 0;
  padding: 1.1rem 1.5rem 1.25rem;
  margin: 0 0 2.5rem;
}

.edition-toc-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--petrol-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.65rem;
}

.edition-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: edition;
  columns: 2;
  column-gap: 2rem;
}

@media (max-width: 640px) {
  .edition-toc-list { columns: 1; }
}

.edition-toc-list li {
  counter-increment: edition;
  break-inside: avoid;
  margin: 0.15em 0;
}

.edition-toc-list a {
  display: block;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  padding: 0.15rem 0;
  transition: color 0.15s;
}
.edition-toc-list a::before {
  content: counter(edition, decimal-leading-zero) ' ';
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  color: var(--text-3);
  margin-right: 0.4em;
}
.edition-toc-list a:hover { color: var(--petrol-light); text-decoration: none; }

/* Per-heading "copy link" button — replaces the hover-# on newsletter headings */
.newsletter-body h2[id]:hover::after,
.newsletter-body h3[id]:hover::after { content: none; }

.heading-anchor-copy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6em;
  vertical-align: middle;
  margin-left: 0.6em;
  padding: 0.15em 0.5em;
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.newsletter-body h2:hover .heading-anchor-copy,
.newsletter-body h3:hover .heading-anchor-copy,
.heading-anchor-copy:focus-visible { opacity: 1; }
.heading-anchor-copy:hover { color: var(--petrol-light); border-color: var(--petrol-light); }
.heading-anchor-copy.copied { color: #3fb950; border-color: rgba(63,185,80,0.5); opacity: 1; }

@media (hover: none) {
  .heading-anchor-copy { opacity: 1; }
}

/* ── Scrollbar ────────────────────────────────────────────── */

[data-theme="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--petrol); border-radius: 3px; }
