:root {
  color-scheme: light;
  --page: #f3f1e8;
  --ink: #18211d;
  --muted: #66716a;
  --line: #d6d8ce;
  --surface: #fffdf6;
  --accent: #db543d;
  --secondary: #d8ee70;
  --display: "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Segoe UI", sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
  --radius: 22px;
  --shadow: 0 18px 48px #17221a12;
}

html[data-theme="tinkerlab"] {
  --page: #e9eee3;
  --ink: #173c35;
  --muted: #59756c;
  --line: #b8c9b9;
  --surface: #f8fbf3;
  --accent: #d25235;
  --secondary: #bddc9a;
  --display: "Cascadia Code", Consolas, monospace;
  --body: "Cascadia Code", Consolas, monospace;
  --radius: 2px;
  --shadow: 3px 3px 0 #173c351f;
}

html[data-theme="zakelijk"] {
  --page: #f5f6f4;
  --ink: #172925;
  --muted: #667570;
  --line: #d9dfdc;
  --surface: #fff;
  --accent: #17745e;
  --secondary: #cfe5dc;
  --display: Georgia, "Times New Roman", serif;
  --body: "Segoe UI", sans-serif;
  --radius: 8px;
  --shadow: 0 5px 18px #142a2110;
}

html[data-theme="nacht"] {
  color-scheme: dark;
  --page: #101820;
  --ink: #e4e7e8;
  --muted: #a3adb3;
  --line: #39434a;
  --surface: #19232b;
  --accent: #d9b96e;
  --secondary: #929da6;
  --display: Georgia, "Times New Roman", serif;
  --body: "Segoe UI", sans-serif;
  --radius: 2px;
  --shadow: 0 14px 32px #0003;
}

html[data-theme="bubblegum"] {
  --page: #ffdeeb;
  --ink: #411c34;
  --muted: #94627f;
  --line: #f3a8ca;
  --surface: #fff4f9;
  --accent: #e72f8b;
  --secondary: #8ce7da;
  --display: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --body: "Trebuchet MS", "Segoe UI", sans-serif;
  --radius: 22px;
  --shadow: 0 8px 0 #e72f8b20;
}

html[data-theme="pixel"] {
  color-scheme: dark;
  --page: #171a1c;
  --ink: #ebffb0;
  --muted: #a8b586;
  --line: #556144;
  --surface: #222824;
  --accent: #c8ff00;
  --secondary: #45e0c5;
  --display: "Cascadia Code", Consolas, monospace;
  --body: "Cascadia Code", Consolas, monospace;
  --radius: 0;
  --shadow: 4px 4px 0 #080a08;
}

html[data-theme="zine"] {
  --page: #f8f2e8;
  --ink: #1d1d1d;
  --muted: #58534b;
  --line: #1d1d1d;
  --surface: #fffdf8;
  --accent: #e8452f;
  --secondary: #f3c94b;
  --display: Georgia, "Times New Roman", serif;
  --body: "Segoe UI", sans-serif;
  --radius: 0;
  --shadow: 5px 5px 0 #1d1d1d;
}

html[data-theme="botanisch"] {
  --page: #e8eee5;
  --ink: #264237;
  --muted: #617768;
  --line: #bdcdbd;
  --surface: #f8faf5;
  --accent: #ac5a3d;
  --secondary: #d3dfb1;
  --display: "Palatino Linotype", "Book Antiqua", serif;
  --body: "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 10px 28px #26423712;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--body);
  transition: background-color 220ms ease, color 220ms ease;
}

a { color: inherit; }

a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 4px;
  background: var(--ink);
  color: var(--page);
}

.skip-link:focus { transform: translateY(0); }

.blog-page { width: min(100% - 48px, 1040px); margin: 0 auto; }

.blog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
}

.blog-header-actions { display: flex; align-items: center; gap: 10px; }

.blog-brand {
  color: var(--ink);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.blog-brand span { color: var(--accent); }
.back-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--accent); }

.blog-style-picker { position: relative; }
.blog-style-trigger {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  opacity: 0.72;
  transition: color 160ms ease, opacity 160ms ease;
}
.blog-style-trigger span { filter: grayscale(1); }
.blog-style-trigger:hover { color: var(--ink); opacity: 1; }
.blog-style-trigger:focus-visible, .blog-theme-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.blog-theme-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 36px);
  width: max-content;
  max-width: calc(100vw - 32px);
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.blog-theme-menu[hidden] { display: none; }
.blog-theme-menu-label { grid-column: 1 / -1; padding: 3px 3px 5px; color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.blog-theme-option { display: grid; width: 36px; height: 36px; place-items: center; padding: 2px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
.blog-theme-option:hover { border-color: var(--line); }
.blog-theme-option[aria-pressed="true"] { border-color: var(--accent); background: var(--page); }
.blog-theme-swatch { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border: 1px solid var(--swatch-line); border-radius: 3px; background: var(--swatch-page); }
.blog-theme-swatch::before { position: absolute; top: 0; right: 0; width: 68%; height: 68%; background: var(--swatch-accent); clip-path: polygon(100% 0, 100% 100%, 0 0); content: ""; }
.blog-theme-swatch::after { position: absolute; right: 0; bottom: 0; left: 0; height: 28%; border-top: 2px solid var(--swatch-line); background: var(--swatch-surface); content: ""; }
.blog-theme-option--pixel .blog-theme-swatch { background-image: linear-gradient(var(--swatch-line) 1px, transparent 1px), linear-gradient(90deg, var(--swatch-line) 1px, transparent 1px); background-size: 7px 7px; }
.blog-theme-option--bubblegum .blog-theme-swatch { border-radius: 7px; }

.blog-main { padding: 54px 0 90px; }

.blog-intro { max-width: 680px; margin-bottom: 34px; }

.eyebrow, .post-date {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.blog-intro h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 54px;
  font-weight: 800;
  line-height: 1.05;
}

.blog-intro > p:last-child { max-width: 590px; margin: 16px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }

.blog-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 0.55fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-control, .filter-control { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.search-control input, .filter-control select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
}
.search-control input::placeholder { color: var(--muted); opacity: 0.8; }
.search-control input:focus-visible, .filter-control select:focus-visible, .empty-state button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.result-count { grid-column: 1 / -1; margin: 0; color: var(--muted); font-family: var(--mono); font-size: 11px; }

.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.post-card[hidden] { display: none; }

.post-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

.post-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.post-card > img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line); }
.post-card--featured { grid-column: 1 / -1; flex-direction: row; min-height: 330px; }
.post-card--featured > img { width: 52%; min-height: 100%; aspect-ratio: auto; object-fit: contain; }
.post-card--featured .post-card-body { justify-content: center; padding: clamp(24px, 4vw, 48px); }
.post-card--featured .post-title { font-size: 30px; }
.post-card--featured .post-excerpt { font-size: 15px; }
.post-card-body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 20px; }
.post-date { margin-bottom: 9px; }
.post-title { font-family: var(--display); font-size: 22px; font-weight: 750; line-height: 1.25; }
.post-tags, .article-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tags { margin-top: 12px; }
.post-tag { padding: 4px 7px; border-radius: 3px; background: var(--page); color: var(--muted); font-family: var(--mono); font-size: 9px; }
.post-excerpt { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.read-more { display: flex; justify-content: space-between; width: 100%; margin-top: auto; padding-top: 20px; color: var(--accent); font-size: 13px; font-weight: 700; }
.empty-state { padding: 30px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.empty-state button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

.reading-progress { position: fixed; z-index: 5; inset: 0 0 auto; height: 3px; transform: scaleX(0); transform-origin: left; background: var(--accent); }
.article-main { width: min(100% - 48px, 1040px); margin: 0 auto; padding: 40px 0 100px; }
.back-link { display: inline-block; margin-bottom: 28px; }
.article-header { max-width: 780px; margin: 0 auto 28px; }
.article-header .post-date { margin-bottom: 12px; }
.article-header h1 { margin: 0; font-family: var(--display); font-size: 48px; font-weight: 800; line-height: 1.12; }
.article-description { margin: 16px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.article-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.article-tag { padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.article-cover { max-width: 780px; margin: 28px auto 40px; }
.article-cover img { display: block; width: 100%; max-height: 560px; border-radius: var(--radius); object-fit: cover; }

.article-reading-layout { display: grid; grid-template-columns: 220px minmax(0, 780px); justify-content: center; align-items: start; gap: 38px; }
.article-reading-layout:not(:has(.article-toc)) { display: block; }
.article-content { min-width: 0; max-width: 780px; margin: 0 auto; font-size: 17px; line-height: 1.78; overflow-wrap: anywhere; }
.article-content > * { max-width: 100%; }
.article-content p { margin: 0 0 1.25em; }
.article-content h2, .article-content h3, .article-content h4 { scroll-margin-top: 24px; margin: 2.1em 0 0.6em; font-family: var(--display); line-height: 1.25; }
.article-content h2 { font-size: 30px; }
.article-content h3 { font-size: 23px; }
.article-content h4 { font-size: 19px; }
.article-content a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-content ul, .article-content ol { margin: 0 0 1.4em; padding-left: 1.5em; }
.article-content li { margin: 0.35em 0; }
.article-content blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.article-content hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--line); }
.article-content pre { max-width: 100%; overflow-x: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 13px; line-height: 1.55; }
.article-content code { font-family: var(--mono); font-size: 0.88em; }
.article-content :not(pre) > code { padding: 2px 5px; border-radius: 3px; background: var(--surface); }
.article-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.article-content th, .article-content td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-content th { background: var(--surface); }
.article-content figure.blog-shot { margin: 2em 0; }
.article-content figure.blog-shot a { display: block; }
.article-content figure.blog-shot img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.article-content figcaption { margin-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.article-content details.blog-lay-summary { margin: 1.5em 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.article-content details summary { color: var(--accent); cursor: pointer; font-weight: 700; }
.article-content details > :last-child { margin-bottom: 0; }

.article-toc { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.article-toc h2 { margin: 0 0 10px; font-family: var(--display); font-size: 15px; }
.article-toc ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.article-toc li + li { margin-top: 7px; }
.article-toc a { color: inherit; text-decoration: none; }
.article-toc a:hover, .article-toc a:focus-visible { color: var(--accent); }
.article-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 780px; margin: 56px auto 0; padding-top: 20px; border-top: 1px solid var(--line); }
.article-pagination-link { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.article-pagination-link--older { text-align: right; }
.article-pagination-link span { color: var(--accent); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.article-pagination-link strong { font-family: var(--display); font-size: 14px; line-height: 1.35; }
.article-pagination-link:hover { border-color: var(--accent); }

.blog-footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; }
.blog-footer a { color: inherit; text-decoration: none; }

@media (max-width: 680px) {
  .blog-page { width: min(100% - 32px, 1040px); }
  .blog-header { gap: 12px; }
  .blog-header-actions { gap: 6px; }
  .blog-main { padding-top: 38px; }
  .blog-intro h1 { font-size: 42px; }
  .blog-controls { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .result-count { grid-column: auto; }
  .post-grid { grid-template-columns: 1fr; }
  .post-card--featured { grid-column: auto; flex-direction: column; min-height: 0; }
  .post-card--featured > img { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
  .post-card--featured .post-card-body { padding: 20px; }
  .post-card--featured .post-title { font-size: 24px; }
  .article-main { width: min(100% - 32px, 1040px); padding-top: 28px; }
  .article-header h1 { font-size: 36px; }
  .article-description { font-size: 16px; }
  .article-content { font-size: 16px; }
  .article-content h2 { font-size: 26px; }
  .article-content h3 { font-size: 21px; }
  .article-content figure.blog-shot { margin-right: -4px; margin-left: -4px; }
  .article-reading-layout { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .article-toc { position: static; max-height: none; }
  .article-pagination { grid-template-columns: 1fr; margin-top: 38px; }
  .article-pagination-link--older { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
