:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --text: #111111;
  --muted: #5f5f5f;
  --line: #e5e5e5;
  --accent: #111111;
  --accent-text: #ffffff;
  --code-bg: #111111;
  --code-text: #f3f3f3;
  --syntax-comment: #7d867c;
  --syntax-command: #f6f6f2;
  --syntax-subcmd: #8bd5ff;
  --syntax-path: #b9f3c3;
  --syntax-flag: #ffd27d;
  --syntax-key: #b6b6b6;
  --syntax-number: #ffb3a7;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --text: #111111;
  --muted: #5f5f5f;
  --line: #e5e5e5;
  --accent: #111111;
  --accent-text: #ffffff;
  --code-bg: #111111;
  --code-text: #f3f3f3;
  --syntax-comment: #7d867c;
  --syntax-command: #f6f6f2;
  --syntax-subcmd: #8bd5ff;
  --syntax-path: #b9f3c3;
  --syntax-flag: #ffd27d;
  --syntax-key: #b6b6b6;
  --syntax-number: #ffb3a7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #0f0f0f;
    --surface-soft: #171717;
    --text: #f5f5f5;
    --muted: #aaaaaa;
    --line: #2b2b2b;
    --accent: #f5f5f5;
    --accent-text: #07110c;
    --code-bg: #050505;
    --code-text: #f4f4f4;
    --syntax-comment: #777f76;
    --syntax-command: #f6f6f2;
    --syntax-subcmd: #8bd5ff;
    --syntax-path: #b9f3c3;
    --syntax-flag: #ffd27d;
    --syntax-key: #b6b6b6;
    --syntax-number: #ffb3a7;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #0f0f0f;
  --surface-soft: #171717;
  --text: #f5f5f5;
  --muted: #aaaaaa;
  --line: #2b2b2b;
  --accent: #f5f5f5;
  --accent-text: #07110c;
  --code-bg: #050505;
  --code-text: #f4f4f4;
  --syntax-comment: #777f76;
  --syntax-command: #f6f6f2;
  --syntax-subcmd: #8bd5ff;
  --syntax-path: #b9f3c3;
  --syntax-flag: #ffd27d;
  --syntax-key: #b6b6b6;
  --syntax-number: #ffb3a7;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Söhne", "Sohne", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  width: min(1180px, calc(100% - 48px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 22px 0 10px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.brand,
.header-actions,
.article-link {
  display: flex;
  align-items: center;
}

.brand,
.header-actions a,
.theme-toggle,
.article-link a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 650;
}

.brand {
  letter-spacing: 0;
}

.header-actions {
  gap: 14px;
}

.header-actions a {
  color: var(--text);
}

.theme-toggle {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.case-shell {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 68px);
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 70px;
}

.case-shell > * {
  min-width: 0;
}

.toc {
  position: sticky;
  top: 32px;
  height: max-content;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 150px;
}

.toc a {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  text-decoration: none;
}

.toc a:hover {
  color: var(--text);
}

.case-study {
  max-width: 880px;
  min-width: 0;
}

.hero {
  padding-bottom: 28px;
}

.kicker,
.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(4.4rem, 10vw, 8.4rem);
  line-height: 0.85;
  letter-spacing: 0;
}

.dek {
  max-width: 760px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: clamp(1.12rem, 1.8vw, 1.34rem);
  line-height: 1.55;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.35;
}

p {
  margin-bottom: 12px;
  max-width: 760px;
  color: var(--muted);
}

.hero-visual {
  overflow: hidden;
  max-width: 100%;
  margin: 28px 0 22px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-soft);
  box-shadow: none;
}

.visual-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.terminal-flow {
  min-height: 250px;
  padding: 18px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.cli-line {
  overflow-wrap: anywhere;
  min-height: 1.55em;
  opacity: 1;
  transform: none;
  animation: none;
}

.term-comment {
  color: var(--syntax-comment);
}

.term-prompt {
  color: var(--syntax-flag);
  font-weight: 700;
}

.term-cmd {
  color: var(--syntax-command);
  font-weight: 700;
}

.term-subcmd {
  color: var(--syntax-subcmd);
}

.term-path {
  color: var(--syntax-path);
}

.term-flag {
  color: var(--syntax-flag);
}

.term-key {
  color: var(--syntax-key);
}

.term-value {
  color: var(--syntax-subcmd);
}

.term-number {
  color: var(--syntax-number);
}

.term-muted {
  color: var(--syntax-comment);
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.project-meta div {
  padding: 12px 18px 12px 0;
  background: transparent;
}

.project-meta span,
.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.project-meta strong,
.metric-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
}

.overview {
  max-width: 800px;
  font-size: 1.08rem;
}

.pull-quote {
  max-width: 820px;
  color: var(--text);
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.15;
}

.case-section {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}

.flow-diagram,
.three-col,
.metric-grid,
.detail-grid,
.snippet-pair,
.example-grid,
.walkthrough {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.flow-diagram {
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  overflow-x: auto;
}

.flow-diagram span,
.three-col div,
.metric-grid div,
.detail-grid div,
.wide-table div {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.flow-diagram span {
  min-height: 74px;
  display: flex;
  align-items: center;
  padding: 14px 0;
  color: var(--text);
  font-weight: 650;
}

.three-col,
.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid,
.snippet-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.example-grid,
.walkthrough {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.walkthrough {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col div,
.metric-grid div,
.detail-grid div,
.example-grid > div,
.walkthrough > div {
  padding: 12px 0 0;
}

.three-col p,
.detail-grid p {
  margin-bottom: 0;
}

.technical-list,
.wide-table {
  display: grid;
  gap: 6px;
  margin: 16px 0;
}

.technical-list div {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.technical-list strong,
.wide-table strong {
  color: var(--text);
}

.technical-list span,
.wide-table span {
  color: var(--muted);
}

.wide-table div {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  padding: 12px 0;
}

.metric-grid strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

pre {
  position: relative;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 16px 0;
  padding: 44px 16px 16px;
  border: 1px solid #252525;
  border-radius: 0;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.82rem;
  line-height: 1.45;
}

pre::before {
  content: attr(data-file) " · " attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: block;
  padding: 8px 14px;
  border-bottom: 1px solid #252525;
  background: #181818;
  color: #a8a8a8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.2;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: inherit;
}

p code,
span code,
li code {
  color: var(--text);
  font-size: 0.92em;
}

.example-grid pre,
.compact-examples pre,
.walkthrough pre {
  margin: 10px 0 0;
  padding: 40px 14px 14px;
  font-size: 0.78rem;
}

.tok-comment {
  color: var(--syntax-comment);
}

.tok-command {
  color: var(--syntax-command);
  font-weight: 700;
}

.tok-keyword {
  color: var(--syntax-subcmd);
}

.tok-path {
  color: var(--syntax-path);
}

.tok-flag {
  color: var(--syntax-flag);
}

.tok-key {
  color: var(--syntax-key);
}

.tok-string {
  color: var(--syntax-path);
}

.tok-number {
  color: var(--syntax-number);
}

.tok-type {
  color: var(--syntax-flag);
}

.performance-table {
  margin-top: 22px;
}

.article-link {
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 0;
}

.article-link a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cli-line {
    opacity: 1;
    transform: none;
    animation: none;
  }

}

@media (max-width: 980px) {
  .case-shell {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    display: none;
  }

  .project-meta,
  .three-col,
  .metric-grid,
  .detail-grid,
  .snippet-pair,
  .example-grid,
  .walkthrough,
  .technical-list div,
  .wide-table div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    width: calc(100% - 40px);
    padding-block: 14px;
  }

  .header-actions {
    gap: 10px;
  }

  h1 {
    font-size: clamp(4rem, 18vw, 5.5rem);
  }

  .visual-top {
    flex-direction: column;
    gap: 4px;
  }
}
