/* site.css - dark only. Sizes are fluid between the 390 px and 1280 px designs. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/dm-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/dm-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/dm-mono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/dm-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0E0D0C;
  --glow: #1D1A17;
  --surface: #1A1816;
  --surface-2: #221F1C;
  --surface-3: #2A2622;
  --text: #EDE8E0;
  --text-body: #DDD6CB;
  --text-2: #CFC8BD;
  --muted: #A39D93;
  --accent: #E4533A;
  /* Decorative rules only. */
  --border: #2E2A26;
  /* Interactive boundaries: at least 3:1 against every surface above (WCAG 1.4.11). */
  --border-strong: #7A736B;
  --link-hover: #FFFFFF;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  --pad-x: clamp(1.125rem, calc(1.125rem + 0.0697 * (100vw - 24.375rem)), 5rem);
  --gap-section: clamp(3.5rem, calc(3.5rem + 0.0809 * (100vw - 24.375rem)), 8rem);
  --gap-block: clamp(3.5rem, calc(3.5rem + 0.0629 * (100vw - 24.375rem)), 7rem);

  /* One scale for every page. h1 is a short page name; a sentence-long h1 (about
     heading, article title) steps down to h1-long so it stays readable. */
  --fs-h1: clamp(3.625rem, calc(3.625rem + 0.0517 * (100vw - 24.375rem)), 6.5rem);
  --fs-h1-long: clamp(2.25rem, calc(2.25rem + 0.0315 * (100vw - 24.375rem)), 4rem);
  --fs-h2: clamp(1.875rem, calc(1.875rem + 0.0157 * (100vw - 24.375rem)), 2.75rem);
  --fs-h3: clamp(1.4375rem, calc(1.4375rem + 0.0056 * (100vw - 24.375rem)), 1.75rem);
  --fs-price: clamp(2.75rem, calc(2.75rem + 0.0225 * (100vw - 24.375rem)), 4rem);
  --fs-email: clamp(1.5rem, calc(1.5rem + 0.0180 * (100vw - 24.375rem)), 2.5rem);
  --fs-intro: clamp(1.0625rem, calc(1.0625rem + 0.0034 * (100vw - 24.375rem)), 1.25rem);
  --fs-lead: clamp(1.1875rem, calc(1.1875rem + 0.0034 * (100vw - 24.375rem)), 1.375rem);
  --fs-prose: clamp(1.0625rem, calc(1.0625rem + 0.0022 * (100vw - 24.375rem)), 1.1875rem);
  --fs-prose-h2: clamp(1.6875rem, calc(1.6875rem + 0.0079 * (100vw - 24.375rem)), 2.125rem);
  --fs-brand: clamp(1.1875rem, calc(1.1875rem + 0.0034 * (100vw - 24.375rem)), 1.375rem);
}

/* The page is effectively a CV; browsers drop background colours, so flip tokens instead of restyling. */
@media print {
  :root {
    --bg: #FFFFFF;
    --glow: #FFFFFF;
    --surface: #F4F1EC;
    --surface-2: #EEEAE3;
    --surface-3: #E6E1D8;
    --text: #111111;
    --text-body: #1F1F1F;
    --text-2: #2B2B2B;
    --muted: #555555;
    --accent: #B03A24;
    --border: #CCCCCC;
    --border-strong: #777777;
    --link-hover: #000000;
  }

  .site-nav, .menu-toggle, .skip-link { display: none !important; }
  body { background: #FFFFFF !important; }
}

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

html {
  color-scheme: dark;
  /* Short and long pages keep the same width when a classic scrollbar comes and goes. */
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.has-glow {
  background:
    radial-gradient(ellipse 900px 700px at 78% 340px, var(--glow) 0%, transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}

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

a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--link-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }

[id] { scroll-margin-top: 24px; }

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

main.container { flex: 1 0 auto; }

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--surface-3);
  color: var(--text);
}
.skip-link:focus { top: 8px; }

/* Shared type */

.label,
.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.label { color: var(--muted); }
.eyebrow { color: var(--accent); font-size: 0.8125rem; }
.eyebrow-short { display: none; }

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.section-title-md { margin-bottom: 24px; }

/* Header */

.site-header .header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding-block: clamp(16px, 3vw, 36px);
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-brand);
  text-decoration: none;
  color: var(--text);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-list a { text-decoration: none; }
.nav-list a.is-current { text-decoration: underline; text-underline-offset: 0.3em; }
.nav-list a.lang-link {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
}
.nav-list a.lang-link:hover { color: var(--link-hover); }

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
}
.menu-icon-close { display: none; }
.menu-open .menu-icon-open { display: none; }
.menu-open .menu-icon-close { display: inline; }

/* Hero */

.hero {
  margin-top: clamp(32px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5.6vw, 72px);
  align-items: center;
}

.hero-text { display: flex; flex-direction: column; gap: clamp(20px, 2.2vw, 28px); }

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: 0.92;
  letter-spacing: -0.03em;
}
.hero-title-about { font-size: var(--fs-h1-long); line-height: 1.02; text-wrap: balance; }

.hero-intro,
.hero-lead {
  margin: 0;
  max-width: 620px;
  font-size: var(--fs-intro);
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}
.hero-intro > p { margin: 0 0 1em; }
.hero-intro > p:last-child { margin-bottom: 0; }
.hero-lead { font-size: var(--fs-lead); line-height: 1.55; }

.hero-single { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(20px, 2.2vw, 28px); margin-top: clamp(32px, 5.6vw, 72px); max-width: 880px; }
.hero-single .hero-lead { max-width: none; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.hero-link { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; }
.hero-link:hover { color: var(--link-hover); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--accent);
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  text-align: center;
}
.button:hover { background: var(--accent); color: var(--bg); }

/* Featured card */

.featured-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(16px, 1.9vw, 24px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
}
.featured-card:hover { background: var(--surface-2); color: var(--text); }
.featured-card .label { color: var(--accent); }
.featured-image {
  width: 100%;
  height: clamp(190px, 19.5vw, 250px);
  object-fit: cover;
  object-position: top;
  background: var(--surface-3);
}
.featured-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.featured-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: 1.15;
}
.featured-text { color: var(--text-2); line-height: 1.55; }
.featured-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.featured-link { color: var(--accent); }

/* Notes list */

.notes { margin-top: var(--gap-section); }

.notes-head,
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-bottom: 8px;
}
.page-head { margin-top: clamp(32px, 5.6vw, 72px); align-items: flex-end; padding-bottom: 20px; }
.page-head .eyebrow { margin-bottom: 12px; }

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: 0.92;
  letter-spacing: -0.03em;
}
/* Tag names are data of any length; at h1 size "webassembly" overflows a phone. */
.page-title-term { font-size: var(--fs-h1-long); line-height: 1.02; }
.page-lead { margin: 0 0 24px; max-width: 620px; color: var(--text-2); font-size: var(--fs-intro); }

.notes-links {
  display: flex;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.notes-links a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.notes-links a:hover { color: var(--link-hover); }

.note-list { border-bottom: 1px solid var(--border); }

.note-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 240px;
  gap: 40px;
  align-items: start;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.note-row:hover .note-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }

.note-number { font-family: var(--font-mono); font-size: 0.875rem; color: var(--accent); }
.note-number-inline { display: none; color: var(--accent); }
.note-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.note-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.note-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: 1.15;
}
.note-description { font-size: 1.0625rem; line-height: 1.55; color: var(--text-2); }
.note-tags { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
/* Meta line (0.75rem × 1.6) + body gap: the image starts level with the title. */
.note-thumb {
  display: block;
  width: 240px;
  height: auto;
  aspect-ratio: 3 / 2;
  margin-top: calc(0.75rem * 1.6 + 10px);
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.article-author {
  margin: 48px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-2);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.pagination a { display: inline-flex; align-items: center; min-height: 44px; }
.pagination-status { color: var(--muted); }

/* Tags */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.tag-list-large { margin-top: 8px; gap: 10px; font-size: 0.875rem; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  text-decoration: none;
}
.tag-list-large .tag-chip { padding: 10px 14px; }
.tag-chip:hover { border-color: var(--accent); color: var(--link-hover); }
.tag-count { color: var(--muted); }

/* Article */

.article-layout {
  margin-top: clamp(16px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 760px);
  gap: clamp(32px, 6.25vw, 80px);
  align-items: start;
}

.article-aside {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--link-hover); text-decoration: underline; }
.article-aside .back-link { margin-bottom: 16px; }
.back-link-mobile { display: none; }

.toc ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 0;
  padding: 0 0 0 16px;
  border-left: 1px solid var(--border);
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--link-hover); text-decoration: underline; }

.article { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.article-header { display: flex; flex-direction: column; gap: 18px; }
.article-meta { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.article-number { color: var(--accent); }
.article-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1-long);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.toc-mobile {
  display: none;
  padding: 12px 0;
  border-block: 1px solid var(--border);
  font-size: 0.9375rem;
}
.toc-mobile summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
}
/* display:flex drops the native marker, so draw one. */
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::before { content: "+"; width: 1ch; color: var(--accent); }
.toc-mobile[open] summary::before { content: "−"; }
.toc-mobile ul { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.toc-mobile li a { display: block; padding: 6px 0; color: var(--text-2); }

/* Markdown body */

.prose {
  font-size: var(--fs-prose);
  line-height: 1.7;
  color: var(--text-body);
  min-width: 0;
}
.prose > * { margin-block: 0 22px; }
.prose > *:last-child { margin-bottom: 0; }
.prose > p:first-child {
  margin-top: 8px;
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text);
  text-wrap: pretty;
}
.prose strong { color: var(--text); font-weight: 500; }
.prose a { color: var(--text); text-decoration: underline; }
.prose a:hover { color: var(--accent); }

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-wrap: balance;
}
.prose h2 { margin-top: 40px; font-size: var(--fs-prose-h2); }
.prose h3 { margin-top: 32px; font-size: calc(var(--fs-prose-h2) * 0.75); }
.prose h4 { margin-top: 28px; font-size: calc(var(--fs-prose-h2) * 0.6); }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.35em; }
.prose li::marker { color: var(--muted); }
.prose blockquote {
  margin-inline: 0;
  padding-left: 20px;
  border-left: 2px solid var(--accent);
  color: var(--text-2);
}
.prose hr { border: 0; border-top: 1px solid var(--border); }
.prose img { display: block; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.prose pre {
  padding: 24px 28px;
  background: var(--surface) !important; /* Zola inlines the highlight theme's background */
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: clamp(0.8125rem, 0.78rem + 0.15vw, 0.9375rem);
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 2;
}
.prose pre code { font-size: inherit; color: inherit; overflow-wrap: normal; }

/* Tables scroll inside their own box. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border-top: 1px solid var(--text);
  font-size: 1rem;
  line-height: 1.5;
}
.prose th,
.prose td {
  padding: 12px 20px 12px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose th { font-family: var(--font-mono); font-weight: 400; font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.prose td:first-child { font-family: var(--font-mono); font-size: 0.875rem; color: var(--accent); }

.post-figure { margin-block: 12px 22px; }
.post-figure img { display: block; width: 100%; border: 1px solid var(--border); }
.post-figure figcaption { margin-top: 10px; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }

/* Inline SVG diagrams in posts; colours come from tokens so print flips them too. */
.post-diagram svg { display: block; width: 100%; height: auto; max-width: 620px; }
.post-diagram .box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.post-diagram .title { fill: var(--text); font-family: var(--font-body); font-size: 15px; font-weight: 600; }
.post-diagram .sub { fill: var(--muted); font-family: var(--font-body); font-size: 13px; }
.post-diagram .label { fill: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.post-diagram .wire { fill: none; stroke: var(--text-body); stroke-width: 1.5; }
.post-diagram .power { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.post-diagram .head { fill: var(--text-body); }
.post-diagram .head-power { fill: var(--accent); }

/* Prev / next */

.note-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(48px, 7vw, 88px);
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.note-nav-link { display: flex; flex-direction: column; gap: 6px; max-width: 48%; text-decoration: none; }
.note-nav-next { margin-left: auto; text-align: right; }
.note-nav-label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.note-nav-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3125rem, 1.15rem + 0.5vw, 1.375rem); line-height: 1.2; color: var(--accent); }
.note-nav-link:hover .note-nav-title { text-decoration: underline; }

/* Blocks (spolupráce, o mně) */

.block { margin-top: var(--gap-block); }

.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(20px, 2.8vw, 36px);
  background: var(--surface);
  border: 1px solid var(--border);
}
.card p { margin: 0; line-height: 1.6; color: var(--text-2); font-size: 1.0625rem; }
.card-number { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--accent); }
.card-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); line-height: 1.15; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; border-top: 2px solid var(--accent); }
.step p { margin: 0; font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem); line-height: 1.5; }
.step-label { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }

.rows { border-bottom: 1px solid var(--border); }
.row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 220px;
  gap: 32px;
  align-items: baseline;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}
.row-experience { grid-template-columns: 220px minmax(0, 1fr); }
.row-key { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--accent); }
.row-period { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.row-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.row-main p { margin: 0; font-size: 1.0625rem; line-height: 1.6; color: var(--text-2); }
.row-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); line-height: 1.2; }
.row-meta { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.row-meta a { color: var(--accent); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
}
.contact-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.price {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-price);
  line-height: 1;
  letter-spacing: -0.02em;
}
.price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  align-items: start;
}
.terms { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 1.0625rem; color: var(--text-2); }
.terms li { padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.contact-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
.form-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
button.button { align-self: flex-start; background: none; font-family: inherit; cursor: pointer; }

.article-stack { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.row-title a { color: inherit; text-decoration: none; }
.row-title a:hover { text-decoration: underline; }

.contact-note { margin: 0; font-size: 1.0625rem; color: var(--text-2); }
.contact-note a { color: var(--text); }
.contact-email {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-email);
  line-height: 1.1;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.contact-email:hover { color: var(--link-hover); }

/* About */

.portrait { margin: 0; display: flex; justify-content: center; }
.portrait img {
  display: block;
  width: min(100%, 420px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
}
.about-hero { align-items: start; margin-top: clamp(24px, 4.4vw, 56px); }

.stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 32px;
  margin: 0;
}
.stack-item { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 2px solid var(--accent); }
.stack dt { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.stack dd { margin: 0; font-size: 1.125rem; line-height: 1.55; }


/* 404 */

.not-found { margin-top: clamp(32px, 5.6vw, 72px); display: flex; flex-direction: column; gap: 32px; }
.not-found-code {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.not-found-lang { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.not-found-lang h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); }
.not-found-lang p { margin: 0; color: var(--text-2); }

/* Footer */

.site-footer { margin-top: var(--gap-section); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-block: 24px 48px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer { border-top: 1px solid var(--border); }
.footer-legal { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; list-style: none; }
.footer-links a, .site-footer a { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a:hover, .site-footer a:hover { color: var(--link-hover); }

/* Narrow layouts */

@media (max-width: 900px) {
  body.has-glow { background: var(--bg); }

  .eyebrow-full { display: none; }
  .eyebrow-short { display: inline; }
  .featured-kind { display: none; }

  .site-header { position: relative; }
  .has-menu-js .menu-toggle { display: flex; }
  .has-menu-js .site-nav { display: none; width: 100%; }
  .has-menu-js.menu-open .site-nav { display: block; }
  .site-nav { width: 100%; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 8px; }
  .nav-list li { border-top: 1px solid var(--border); }
  .nav-list a { display: flex; align-items: center; min-height: 44px; }

  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-actions .button { flex: 1 1 100%; }

  .notes-head { align-items: center; }
  .notes-head .notes-links li:not(:first-child),
  .notes .notes-links li:not(:first-child) { display: none; }

  .note-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 24px 0;
  }
  .note-number { display: none; }
  .note-number-inline { display: inline; }
  .note-body { gap: 8px; }
  .note-description { font-size: 1rem; }
  /* Thumbnails squeeze the title on a phone: only the first row keeps its image, full width on top. */
  .note-thumb { display: none; }
  .note-row:first-child .note-thumb { display: block; order: -1; width: 100%; margin-top: 0; }

  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .article-aside { display: none; }
  .back-link-mobile { display: inline-flex; margin-bottom: -4px; }
  .toc-mobile { display: block; }
  .article { gap: 18px; }
  .article-header { gap: 14px; }
  .prose > p:first-child { margin-top: 6px; }
  .prose h2 { margin-top: 24px; }
  .prose pre { margin-inline: calc(var(--pad-x) * -1); padding: 18px var(--pad-x); border-inline: 0; }
  .post-figure { margin-inline: calc(var(--pad-x) * -1); }
  .post-figure figcaption { margin-inline: var(--pad-x); }
  .post-figure img { border-inline: 0; }

  .note-nav { flex-direction: column; padding-block: 20px; margin-top: 48px; border-bottom: 1px solid var(--border); }
  .note-nav-link, .note-nav-next { max-width: none; margin-left: 0; text-align: left; }

  .services { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .row, .row-experience { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 24px 0; }
  .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .price-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  button.button { align-self: stretch; }
  .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
  .portrait { justify-content: flex-start; }
  .portrait img { width: 240px; }

  .footer-inner { flex-direction: column-reverse; align-items: flex-start; gap: 4px; padding-block: 12px 32px; }
}

@media (max-width: 560px) {
  .stack { grid-template-columns: minmax(0, 1fr); }
  .footer-links { gap: 0 20px; }
}

@media (prefers-reduced-motion: no-preference) {
  a, .button, .tag-chip, .featured-card { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
}
