/* =========================================================================
   lhelge.se — Colors & Type
   A dark, crafted, maker-blog system.
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;600;700;800;900&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  --ink-0:  #0b0b0d;
  --ink-1:  #111114;
  --ink-2:  #18181d;
  --ink-3:  #23232b;
  --ink-4:  #2e2e38;

  --fg-0:   #f4f1ea;
  --fg-1:   #c8c4bb;
  --fg-2:   #8a857a;
  --fg-3:   #5a564d;

  --accent:        #ff2d6f;
  --accent-hot:    #ff5286;
  --accent-deep:   #c41a55;
  --accent-soft:   #ff2d6f1a;

  --amber:         #f0a040;
  --amber-soft:    #f0a04022;

  --ok:      #7dd6a8;
  --warn:    #f0c050;
  --err:     #ff6b6b;
  --info:    #6ec1ff;

  --tag-bg:        #1a1a20;
  --tag-border:    #2a2a33;
  --tag-fg:        #b8b4ab;

  --font-display: "Orbitron", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body:    "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-md:   18px;
  --fs-lg:   20px;
  --fs-xl:   24px;
  --fs-2xl:  32px;
  --fs-3xl:  44px;
  --fs-4xl:  64px;

  --lh-tight: 1.15;
  --lh-snug:  1.35;
  --lh-body:  1.65;
  --lh-loose: 1.8;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;
  --tracking-caps:   0.12em;

  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-7:  48px;
  --sp-8:  64px;
  --sp-9:  96px;

  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-4: 10px;
  --r-full: 999px;

  --bd-1: 1px solid var(--ink-3);
  --bd-2: 1px solid var(--ink-4);
  --bd-accent: 1px solid var(--accent);

  --sh-1: 0 1px 0 rgba(0,0,0,0.4);
  --sh-2: 0 4px 16px rgba(0,0,0,0.5);
  --sh-3: 0 12px 40px rgba(0,0,0,0.6);
  --glow-accent: 0 0 24px rgba(255, 45, 111, 0.45);
  --glow-amber:  0 0 20px rgba(240, 160, 64, 0.35);

  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);

  --content-width: 720px;
  --page-width:    1200px;
  --grid-gutter:   24px;
}

/* =========================================================================
   Base element styles
   ========================================================================= */

html, body {
  background: var(--ink-0);
  color: var(--fg-0);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  margin: 0;
  padding: 0;
}

::selection { background: var(--accent-soft); color: var(--fg-0); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--fg-0);
  letter-spacing: 0;
  line-height: var(--lh-tight);
  font-weight: 700;
  margin: 0;
}

h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.005em; }
h2 { font-size: var(--fs-2xl); font-weight: 700; }
h3 { font-size: var(--fs-xl); font-weight: 600; }
h4 { font-size: var(--fs-lg); font-weight: 600; }
h5 { font-size: var(--fs-md); font-weight: 600; }
h6 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--fg-2); font-family: var(--font-mono); }

p { margin: 0; line-height: var(--lh-body); color: var(--fg-0); }
small, .meta { font-size: var(--fs-sm); color: var(--fg-2); }

a {
  color: var(--fg-0);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
a:hover { color: var(--accent); border-bottom-color: var(--accent-hot); }
a:active { color: var(--accent-deep); }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  padding: 0.1em 0.4em;
  border-radius: var(--r-2);
  color: var(--fg-0);
}

pre {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-3);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  line-height: var(--lh-snug);
}
pre code { background: none; border: 0; padding: 0; }

kbd {
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-bottom-width: 2px;
  border-radius: var(--r-2);
  padding: 0.1em 0.5em;
  font-size: 0.85em;
  color: var(--fg-1);
}

blockquote {
  margin: 0;
  padding: var(--sp-3) var(--sp-5);
  border-left: 2px solid var(--accent);
  color: var(--fg-1);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--ink-3);
  margin: var(--sp-7) 0;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

/* =========================================================================
   Page-level layout and components
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }

/* ---------- Page shell ---------- */
.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site main { flex: 1; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink-1);
  border-bottom: 1px solid var(--ink-3);
}
.site-header-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  color: var(--fg-0);
}
.site-brand:hover { color: var(--fg-0); border: 0; }
.site-brand .wordmark { font-size: 16px; }
.site-nav {
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--fg-1);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.site-nav a:hover { color: var(--fg-0); border-bottom-color: var(--ink-4); }
.site-nav a.active { color: var(--fg-0); border-bottom-color: var(--accent); }
.site-nav svg { display: inline; vertical-align: middle; }

@media (max-width: 640px) {
  .site-header-inner { padding: 12px 16px; gap: 16px; }
  .site-nav { gap: 14px; font-size: 11px; }
  .site-brand .wordmark { font-size: 14px; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--ink-3);
  margin-top: 96px;
  padding: 28px 24px;
}
.site-footer-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
}
.site-footer a {
  color: var(--fg-2);
  border: 0;
}
.site-footer a:hover { color: var(--accent); }
.site-footer .links { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Page widths ---------- */
.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 48px 24px 32px;
}
.page--narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 24px 32px;
}

@media (max-width: 640px) {
  .page, .page--narrow { padding: 32px 16px 24px; }
}

/* ---------- Page headings ---------- */
.page-kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
}
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 44px;
  letter-spacing: -0.005em;
  line-height: 1.1;
  margin-top: 8px;
  text-transform: uppercase;
}
.page-title--lg { font-size: 56px; }
.page-subtitle {
  margin-top: 14px;
  color: var(--fg-1);
  font-size: 18px;
  max-width: 640px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .page-title { font-size: 32px; }
  .page-title--lg { font-size: 40px; }
  .page-subtitle { font-size: 16px; }
}

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tag-fg);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  padding: 3px 9px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
a.tag { border-bottom: 1px solid var(--tag-border); }
a.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Post card ---------- */
.post-card {
  padding: 22px 0;
  border-bottom: 1px solid var(--ink-3);
  position: relative;
}
.post-card:last-child { border-bottom: 0; }
.post-card .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
}
.post-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.005em;
  margin-top: 8px;
  text-transform: uppercase;
  line-height: 1.2;
}
.post-card h2 a {
  color: var(--fg-0);
  border: 0;
}
.post-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.post-card:hover h2 a { color: var(--accent); }
.post-card .tag-row { position: relative; z-index: 1; }
.post-card .summary {
  margin-top: 8px;
  color: var(--fg-1);
  font-size: 16px;
  line-height: 1.6;
  max-width: 640px;
}
.post-card .tag-row { margin-top: 12px; }

.post-card--with-image {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}
.post-card--with-image > a {
  border: 0;
  border-radius: var(--r-3);
  overflow: hidden;
  display: block;
  width: 200px;
  height: 130px;
}
.post-card--with-image > a:hover { border: 0; }
.post-card--with-image .hero-thumb {
  width: 200px;
  height: 130px;
  object-fit: cover;
  border-radius: var(--r-3);
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
  transition: transform var(--dur-3) var(--ease-out);
}
.post-card--with-image:hover .hero-thumb {
  transform: scale(1.05);
}
@media (max-width: 640px) {
  .post-card--with-image {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .post-card--with-image .hero-thumb {
    width: 100%;
    height: 180px;
  }
}

/* ---------- View-all link ---------- */
.view-all {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}
.view-all a { color: var(--fg-1); border-bottom: 1px solid var(--ink-4); }
.view-all a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Single post meta ---------- */
.post-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.post-meta .sep { color: var(--ink-4); }
.post-meta .updated { color: var(--amber); }

.post-hero {
  margin: 32px 0 0;
  border-radius: var(--r-3);
  border: 1px solid var(--ink-3);
  overflow: hidden;
  background: var(--ink-2);
}
.post-hero img { width: 100%; display: block; }

/* ---------- Left-drift TOC layout (blog post) ---------- */
.post-layout-left {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  grid-template-columns: 180px minmax(0, var(--content-width));
  gap: 56px;
  align-items: start;
}
.post-layout-left > article { min-width: 0; }

.toc--left {
  position: sticky;
  top: 84px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  border-right: 1px solid var(--ink-3);
  padding-right: 18px;
  text-align: right;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.toc--left h6 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin: 0 0 12px;
  text-align: right;
}
.toc--left ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toc--left a {
  color: var(--fg-1);
  border: 0;
  display: block;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease-out);
}
.toc--left a:hover { color: var(--accent); }
.toc--left .lvl-3 { padding-right: 12px; font-size: 12px; color: var(--fg-2); }
.toc--left .lvl-4 { padding-right: 24px; font-size: 12px; color: var(--fg-2); }

@media (max-width: 1000px) {
  .post-layout-left {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .toc--left {
    position: static;
    border-right: 0;
    padding-right: 0;
    text-align: left;
    border: 1px solid var(--ink-3);
    border-radius: var(--r-3);
    padding: 16px 18px;
    background: var(--ink-1);
    margin-bottom: 24px;
  }
  .toc--left h6 { text-align: left; }
  .toc--left .lvl-3 { padding-right: 0; padding-left: 12px; }
  .toc--left .lvl-4 { padding-right: 0; padding-left: 24px; }
}

/* ---------- Right-side sticky TOC (wiki) ---------- */
.toc {
  position: sticky;
  top: 84px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  border-left: 1px solid var(--ink-3);
  padding-left: 18px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.toc h6 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin: 0 0 12px;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toc a {
  color: var(--fg-1);
  border: 0;
  display: block;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease-out);
}
.toc a:hover { color: var(--accent); }
.toc .lvl-3 { padding-left: 12px; font-size: 13px; color: var(--fg-2); }
.toc .lvl-4 { padding-left: 24px; font-size: 13px; color: var(--fg-2); }

@media (max-width: 1000px) {
  .toc {
    position: static;
    border-left: 0;
    padding-left: 0;
    border: 1px solid var(--ink-3);
    border-radius: var(--r-3);
    padding: 16px 18px;
    background: var(--ink-1);
    margin-bottom: 24px;
  }
}

/* ---------- Inline TOC (wiki pages) ---------- */
.toc-inline {
  border: 1px solid var(--ink-3);
  border-radius: var(--r-3);
  padding: 16px 20px;
  background: var(--ink-1);
  margin: 24px 0;
}
.toc-inline summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::before {
  content: '\25B8';
  display: inline-block;
  transition: transform var(--dur-2) var(--ease-out);
  color: var(--fg-3);
}
.toc-inline[open] summary::before { transform: rotate(90deg); }
.toc-inline ul {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.toc-inline a { color: var(--fg-1); border: 0; }
.toc-inline a:hover { color: var(--accent); }
.toc-inline .lvl-3 { padding-left: 14px; font-size: 13px; color: var(--fg-2); }
.toc-inline .lvl-4 { padding-left: 28px; font-size: 13px; color: var(--fg-2); }

/* ---------- Wiki layout ---------- */
.wiki-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
  align-items: start;
}
.wiki-layout > article { min-width: 0; max-width: var(--content-width); }
@media (max-width: 880px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 24px; }
}

.wiki-nav {
  position: sticky;
  top: 84px;
  font-size: 14px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.wiki-nav-section { margin-bottom: 22px; }
.wiki-nav h6 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin: 0 0 10px;
}
.wiki-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiki-nav a {
  color: var(--fg-1);
  border: 0;
  display: block;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--r-2);
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.wiki-nav a:hover { color: var(--fg-0); background: var(--ink-2); }
.wiki-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 880px) {
  .wiki-nav { position: static; max-height: none; }
}

/* ---------- Backlinks ---------- */
.backlinks {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-3);
}
.backlinks h6 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin: 0 0 14px;
}
.backlinks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.backlinks li { font-size: 14px; }
.backlinks li::before {
  content: '\21B3';
  color: var(--fg-3);
  margin-right: 10px;
  font-family: var(--font-mono);
}
.backlinks a { color: var(--fg-1); border: 0; }
.backlinks a:hover { color: var(--accent); }

/* ---------- Prev/Next nav ---------- */
.prev-next {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.prev-next a {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-3);
  background: var(--ink-1);
  color: var(--fg-0);
  transition: border-color var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out);
}
.prev-next a:hover {
  border-color: var(--ink-4);
  background: var(--ink-2);
  color: var(--fg-0);
}
.prev-next .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
  margin-bottom: 6px;
}
.prev-next .arrow { color: var(--accent); }
.prev-next .post-title-link {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  text-transform: uppercase;
}
.prev-next .post-date {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-3);
}
.prev-next .next { text-align: right; align-items: flex-end; }
@media (max-width: 640px) {
  .prev-next { grid-template-columns: 1fr; }
  .prev-next .next { text-align: left; align-items: flex-start; }
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 56px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-2);
  color: var(--fg-1);
  background: var(--ink-1);
  text-transform: uppercase;
}
.pagination a:hover {
  color: var(--fg-0);
  border-color: var(--ink-4);
  background: var(--ink-2);
}
.pagination .current {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Tags index ---------- */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.tags-cloud .tag {
  font-size: 13px;
  padding: 6px 14px;
}
.tags-cloud .count {
  color: var(--fg-3);
  margin-left: 6px;
}

/* ---------- Wiki/Tags categorical lists ---------- */
.cat-group { margin-top: 40px; }
.cat-group:first-of-type { margin-top: 24px; }
.cat-group h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--fg-0);
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.cat-group h2 .count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-left: 12px;
}
.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 24px;
}
.cat-list li { font-size: 15px; padding: 4px 0; }
.cat-list a { color: var(--fg-1); border: 0; }
.cat-list a:hover { color: var(--accent); }

/* ---------- Prose / article body ---------- */
.prose {
  max-width: var(--content-width);
  font-size: 18px;
  line-height: 1.7;
  color: var(--fg-0);
}
.prose > * + * { margin-top: 24px; }
.prose h2 {
  margin-top: 48px;
  font-size: 28px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  scroll-margin-top: 84px;
}
.prose h3 {
  margin-top: 32px;
  font-size: 22px;
  scroll-margin-top: 84px;
}
.prose h4 {
  margin-top: 24px;
  font-size: 18px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg-1);
  scroll-margin-top: 84px;
}
.prose ul, .prose ol {
  padding-left: 24px;
  color: var(--fg-0);
}
.prose li { margin-top: 8px; line-height: 1.65; }
.prose li::marker { color: var(--fg-3); }
.prose blockquote {
  margin: 0;
  padding: 4px 24px;
  border-left: 2px solid var(--accent);
  color: var(--fg-1);
  font-style: italic;
}
.prose img {
  border-radius: var(--r-3);
  border: 1px solid var(--ink-3);
}
.prose figure { margin: 0; }
.prose figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-top: 8px;
  text-align: center;
}
.prose a { color: var(--fg-0); border-bottom: 1px solid var(--accent); }
.prose a:hover { color: var(--accent); border-bottom-color: var(--accent-hot); }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.prose th, .prose td {
  padding: 10px 14px;
  border: 1px solid var(--ink-3);
  text-align: left;
}
.prose th {
  background: var(--ink-1);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-2);
  font-family: var(--font-mono);
}
.prose td { color: var(--fg-1); }

/* ---------- Code blocks + syntax highlighting ---------- */
.prose pre {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-3);
  padding: 18px 22px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 14px;
  position: relative;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg-0);
  font-size: 14px;
}
.prose code {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  padding: 0.1em 0.4em;
  border-radius: var(--r-2);
  color: var(--fg-0);
  font-size: 0.92em;
}

pre.code-block {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-3);
  padding: 18px 22px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-0);
}
pre.code-block code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg-0);
  font-size: 14px;
}

.hl-keyword     { color: #c792ea; }
.hl-string      { color: #c3e88d; }
.hl-comment     { color: #5a564d; font-style: italic; }
.hl-type        { color: #82d9ff; }
.hl-function    { color: #ffcb6b; }
.hl-number      { color: #f78c6c; }
.hl-operator    { color: #89ddff; }
.hl-punctuation { color: #8a857a; }
.hl-variable    { color: #f4f1ea; }
.hl-attribute   { color: #ffcb6b; }
.hl-tag         { color: #ff8b9c; }
.hl-entity      { color: #c792ea; }

/* Mermaid diagrams */
pre.mermaid {
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
  overflow: visible;
  font-family: inherit;
}

/* ---------- Home intro ---------- */
.home-intro {
  max-width: 720px;
  font-size: 19px;
  line-height: 1.7;
  color: var(--fg-1);
  margin-top: 16px;
}
.home-intro a { color: var(--fg-0); }
.home-intro p + p { margin-top: 14px; }

/* ---------- Section divider ---------- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 56px 0 24px;
}
.section-divider h6 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-2);
}
.section-divider .rule {
  flex: 1;
  height: 1px;
  background: var(--ink-3);
}

/* ---------- 404 / empty state ---------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}
.empty-state .glyph {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 96px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.empty-state h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 16px;
}
.empty-state p {
  color: var(--fg-1);
  font-size: 17px;
  max-width: 480px;
  margin: 14px auto 0;
}
.empty-state .cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 12px 22px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-0);
  background: var(--ink-1);
}
.empty-state .cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--ink-2);
}

/* ---------- Wiki links ---------- */
.wikilink { font-weight: 500; }
.wikilink.broken {
  color: var(--err);
  border-bottom: 1px dashed var(--err);
  cursor: help;
}

/* ---------- Markdown alerts ---------- */
.markdown-alert {
  border-left: 4px solid;
  border-radius: var(--r-3);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.markdown-alert > :last-child { margin-bottom: 0; }
.markdown-alert-title { font-weight: 600; margin: 0 0 0.25rem; }
.markdown-alert-note      { border-color: var(--info);    background: rgba(110, 193, 255, 0.08); }
.markdown-alert-note      .markdown-alert-title { color: var(--info); }
.markdown-alert-tip       { border-color: var(--ok);      background: rgba(125, 214, 168, 0.08); }
.markdown-alert-tip       .markdown-alert-title { color: var(--ok); }
.markdown-alert-important { border-color: #c792ea;        background: rgba(199, 146, 234, 0.08); }
.markdown-alert-important .markdown-alert-title { color: #c792ea; }
.markdown-alert-warning   { border-color: var(--warn);    background: rgba(240, 192, 80, 0.08); }
.markdown-alert-warning   .markdown-alert-title { color: var(--warn); }
.markdown-alert-caution   { border-color: var(--err);     background: rgba(255, 107, 107, 0.08); }
.markdown-alert-caution   .markdown-alert-title { color: var(--err); }

/* ---------- Task lists ---------- */
.prose ul:has(> li > input[type="checkbox"]) {
  list-style: none;
  padding-left: 4px;
}
.prose input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--accent);
}

/* ---------- Footnotes ---------- */
.prose .footnote-ref { font-size: 0.8em; vertical-align: super; }
.prose .footnotes { font-size: 14px; color: var(--fg-1); margin-top: 48px; border-top: 1px solid var(--ink-3); padding-top: 24px; }

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