:root {
  --font-ui: "IBM Plex Sans", sans-serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-mono: "Fira Code", "Fira Mono", monospace;
  --font-family: var(--font-ui);
  --font-size: 17px;
  --line-height: 1.6rem;
  --content-width: 76rem;
  --article-width: 46rem;
  --outline-width: 16rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.9rem;
  --radius-lg: 1.4rem;
  --shadow-sm: 0 10px 30px rgba(28, 23, 18, 0.06);
  --shadow-md: 0 24px 60px rgba(28, 23, 18, 0.1);

  --bg: #f5efe6;
  --bg-alt: #fbf8f3;
  --surface: rgba(255, 252, 247, 0.8);
  --surface-strong: #fffdfa;
  --header-bg: rgba(245, 239, 230, 0.88);
  --text: #171411;
  --text-muted: #675f56;
  --accent: #b37422;
  --accent-hover: #935d14;
  --accent-subtle: rgba(179, 116, 34, 0.12);
  --border: rgba(92, 74, 55, 0.16);
  --border-strong: rgba(92, 74, 55, 0.26);
  --callout-warning: #a66d1a;
  --callout-tip: #2d7d53;
  --callout-important: #a84343;
  --risk-high: #a84343;
  --risk-medium: #b17a18;
  --risk-low: #2d7d53;
  --info: #3a6f9f;
}

:root[data-theme="dark"] {
  --bg: #11100e;
  --bg-alt: #181613;
  --surface: rgba(24, 22, 19, 0.82);
  --surface-strong: #1d1a17;
  --header-bg: rgba(17, 16, 14, 0.88);
  --text: #f3ede5;
  --text-muted: #bbb1a6;
  --accent: #d0a25c;
  --accent-hover: #e3bb81;
  --accent-subtle: rgba(208, 162, 92, 0.14);
  --border: rgba(227, 214, 196, 0.12);
  --border-strong: rgba(227, 214, 196, 0.22);
  --callout-warning: #cf9a47;
  --callout-tip: #63b287;
  --callout-important: #d77272;
  --risk-high: #d77272;
  --risk-medium: #cf9a47;
  --risk-low: #63b287;
  --info: #84add4;
  --shadow-sm: 0 20px 40px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 28px 72px rgba(0, 0, 0, 0.35);
}

html {
  font-size: var(--font-size);
  background: var(--bg);
  color: var(--text);
  scroll-padding-top: 6rem;
}

body {
  max-width: none;
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(179, 116, 34, 0.08), transparent 32rem),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent 10rem),
    var(--bg);
  color: var(--text);
}

.site-header,
.content,
.site-footer {
  width: min(var(--content-width), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: 0;
  padding: 1rem 0 0.85rem;
  border-top: none;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  background: var(--header-bg);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.logo-mark {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.header-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-descriptor,
.header-tagline {
  line-height: 1.1;
}

.header-descriptor {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.header-tagline {
  font-family: var(--font-ui);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.site-nav {
  gap: 0.5rem;
}

.site-nav a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  height: 2.25rem;
  padding: 0 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.site-nav a:hover,
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  padding-inline: 1rem;
  min-width: 7rem;
  justify-content: center;
}

.site-nav:hover a:not(:hover),
.site-nav:hover .theme-toggle:not(:hover) {
  color: var(--text-muted);
}

.content {
  padding: 2.4rem 0 4rem;
}

.content > * + * {
  margin-top: 0;
}

.skip-link {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-strong);
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 90;
}

.reading-progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, white));
  transform: scaleX(0);
  transform-origin: left center;
}

.hero--editorial {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.5rem) 0 2rem;
  margin-bottom: 2.5rem;
}

.hero-kicker,
.section-kicker,
.article-outline-label,
.feature-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-tagline,
.page-header h1,
.section-heading h2,
.listing-card h2,
.story-card h3,
.feature-card h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.hero-tagline {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 0.96;
}

.hero-dek {
  max-width: 42rem;
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.28rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  min-height: 2.9rem;
  padding: 0 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 500;
  text-decoration: none;
  background: var(--surface);
}

.hero-action--primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg-alt);
}

.hero-action--primary:hover {
  color: var(--bg-alt);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 0.85fr);
  gap: 2rem;
  align-items: start;
}

.section-heading {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.7rem, 2vw, 2.4rem);
  line-height: 1.05;
}

.story-list,
.listing-grid {
  display: grid;
  gap: 1rem;
}

.story-card,
.listing-card,
.rail-card,
.feature-card,
.related-content,
.prompt-block,
.llm-message,
.callout,
.screenshot-frame,
.tool-dir,
.tool-manifest,
.terminal-block,
.highlight,
.verdict,
.tools-used {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.story-card,
.listing-card,
.feature-card,
.rail-card {
  padding: 1.15rem 1.2rem;
}

.story-meta,
.listing-meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin: 0 0 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.story-card h3,
.listing-card h2,
.feature-card h3 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.18rem, 1rem + 0.5vw, 1.48rem);
  line-height: 1.1;
}

.story-card p,
.listing-card p,
.feature-card p,
.rail-list span,
.rail-link span,
.page-intro,
.dek {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.home-rail {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 5.7rem;
}

.rail-list,
.rail-links {
  display: grid;
  gap: 0.85rem;
}

.rail-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.rail-list li {
  display: grid;
  gap: 0.18rem;
  margin: 0;
  padding: 0.1rem 0;
}

.rail-list a,
.rail-link {
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: none;
}

.rail-link {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.home-secondary {
  margin-top: 3rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.archive-cta {
  margin: 1.1rem 0 0;
  font-family: var(--font-ui);
  font-weight: 500;
}

.page-header {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.6rem;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.55rem);
  line-height: 0.98;
  max-width: 14ch;
}

.page-header--article .dek {
  max-width: 38rem;
}

.article-shell {
  display: block;
}

.article-shell--with-outline {
  display: grid;
  grid-template-columns: minmax(0, var(--article-width)) minmax(12rem, var(--outline-width));
  gap: 2.5rem;
  align-items: start;
}

.article {
  min-width: 0;
}

.article-body {
  display: grid;
  gap: 1.2rem;
}

.article-body,
.page-intro {
  font-family: var(--font-body);
  font-size: 1.18rem;
  line-height: 1.72;
}

.article-body > * {
  margin: 0;
}

.article-body > :is(p, ul, ol, blockquote, details, hr, h2, h3, h4, h5, h6) {
  max-width: var(--article-width);
}

.article-body > :is(figure, .callout, .prompt-block, .llm-session, .screenshot-frame, .tool-dir, .tool-manifest, .verdict, .tools-used, .highlight, pre, table) {
  max-width: min(100%, calc(var(--article-width) + 7rem));
}

.article-body > :is(h2, h3, h4, h5, h6) {
  margin-top: 1.8rem;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  scroll-margin-top: 6rem;
}

.article-body > h2 {
  font-size: 2rem;
}

.article-body > h3 {
  font-size: 1.45rem;
}

.article-body > h4,
.article-body > h5,
.article-body > h6 {
  font-size: 1.18rem;
}

.article-body p code,
.article-body li code,
.article-body pre,
.article-body code,
.prompt-title,
.prompt-target,
.prompt-mode-badge,
.prompt-filename-chip,
.prompt-filename-badge,
.llm-terminal,
.llm-model,
.tools-used,
.tool-dir,
.tool-manifest,
.verdict,
.hero-prompt,
.logo-mark {
  font-family: var(--font-mono);
}

.article-body p code,
.article-body li code {
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--bg-alt) 88%, white);
}

.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}

.article-body li + li {
  margin-top: 0.3rem;
}

.article-body blockquote {
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
}

.article-body figure {
  display: grid;
  gap: 0.65rem;
}

.article-body img,
.article-body video {
  border-radius: var(--radius-md);
}

figcaption {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
}

table,
th,
td {
  border-color: var(--border);
}

table {
  border-radius: var(--radius-md);
  background: var(--surface);
}

th {
  font-family: var(--font-ui);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
}

pre,
.highlight {
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.article-outline {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.article-outline--desktop {
  position: sticky;
  top: 5.8rem;
  padding: 1rem;
}

.article-outline--mobile {
  display: none;
  margin: 0 0 1.4rem;
  padding: 0;
}

.article-outline--mobile summary {
  padding: 0.95rem 1rem;
  font-family: var(--font-ui);
}

.article-outline-body > nav,
.article-outline-body {
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.article-outline-body ul {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}

.article-outline-body li {
  margin: 0;
}

.article-outline-body a {
  display: block;
  padding: 0.38rem 0;
  color: var(--text-muted);
  text-decoration: none;
}

.article-outline-body a:hover,
.article-outline-body a.is-active {
  color: var(--text);
}

.tag-list {
  gap: 0.55rem;
  padding-top: 1.4rem;
  margin-top: 1.6rem;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  opacity: 1;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.86rem;
}

.related-content {
  margin-top: 2.2rem;
  padding: 1.15rem 1.2rem;
}

.related-content h3 {
  margin: 0 0 0.8rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}

.related-content li {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.55rem 0;
}

.related-content li::before {
  content: "→";
  color: var(--accent);
}

.related-content .content-type {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.listing-card {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 1.15rem 1.2rem;
}

.listing-card h2 {
  min-height: 2.3em;
  margin-bottom: 0;
  max-width: 22ch;
}

.listing-card p {
  min-height: 3.2em;
  max-width: 48rem;
}

.pagination {
  margin-top: 1.3rem;
  gap: 0.75rem;
}

.pagination a,
.pagination .muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
}

.pagination .muted {
  opacity: 0.45;
}

.prompt-block {
  overflow: hidden;
  margin: 1.4rem 0;
  border-width: 1px;
  border-left-width: 1px;
  background: var(--surface-strong);
}

.prompt-block[data-mode="try"] {
  box-shadow: inset 3px 0 0 var(--callout-tip), var(--shadow-sm);
}

.prompt-block[data-mode="engineer"] {
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
}

.prompt-block[data-mode="deploy"] {
  box-shadow: inset 3px 0 0 var(--info), var(--shadow-sm);
}

.prompt-block[data-mode="workflow"] {
  box-shadow: inset 3px 0 0 var(--callout-warning), var(--shadow-sm);
}

.prompt-header,
.prompt-meta-row,
.prompt-actions {
  padding-inline: 1rem;
  background: transparent;
}

.prompt-header {
  padding-top: 0.95rem;
  padding-bottom: 0.7rem;
}

.prompt-meta-row {
  padding-top: 0;
  padding-bottom: 0.8rem;
  border-bottom-color: var(--border);
}

.prompt-mode-badge,
.prompt-target,
.prompt-filename-badge,
.prompt-filename-chip {
  border-radius: 999px;
}

.prompt-title {
  font-size: 0.96rem;
  white-space: normal;
}

.prompt-token-count {
  top: 0.8rem;
  right: 1rem;
  opacity: 0.7;
}

.prompt-content {
  max-height: 19rem;
  padding: 0.35rem 1rem 0.95rem;
}

.prompt-content code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt-expander {
  padding-inline: 1rem;
  border-top-color: var(--border);
  color: var(--accent);
}

.prompt-actions {
  padding-top: 0.8rem;
  padding-bottom: 0.95rem;
  border-top-color: var(--border);
}

.prompt-copy-btn,
.prompt-run-link {
  min-height: 2.4rem;
  padding-inline: 0.9rem;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.88rem;
}

.prompt-copy-btn {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg-alt);
}

.prompt-copy-btn:hover {
  color: var(--bg-alt);
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.prompt-run-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  color: var(--text);
}

.prompt-run-link:hover {
  border-color: var(--border-strong);
}

.prompt-ln {
  grid-template-columns: 2.4rem 1fr;
}

.prompt-ln-num {
  opacity: 0.55;
}

.llm-session {
  display: grid;
  gap: 0.9rem;
  margin: 1.4rem 0;
}

.llm-message {
  padding: 1rem 1rem 1.05rem;
}

.llm-message-user {
  background: color-mix(in srgb, var(--accent-subtle) 55%, var(--surface-strong));
}

.llm-message-model {
  background: var(--surface-strong);
}

.llm-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.llm-terminal,
.llm-model {
  font-family: var(--font-mono);
  color: var(--text);
}

.llm-role {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--bg-alt);
}

.llm-message-body,
.llm-message-body p,
.llm-message-body li {
  font-family: var(--font-body);
  font-size: 1.04rem;
  line-height: 1.62;
}

.llm-message-body > *:first-child {
  margin-top: 0;
}

.llm-message-body > *:last-child {
  margin-bottom: 0;
}

.callout {
  padding: 1rem 1rem 1.05rem;
  border-left-width: 1px;
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
}

.callout-warning {
  box-shadow: inset 3px 0 0 var(--callout-warning), var(--shadow-sm);
}

.callout-tip {
  box-shadow: inset 3px 0 0 var(--callout-tip), var(--shadow-sm);
}

.callout-important {
  box-shadow: inset 3px 0 0 var(--callout-important), var(--shadow-sm);
}

.callout-title {
  margin-bottom: 0.7rem;
  font-family: var(--font-ui);
}

.screenshot-frame,
.tool-dir,
.tool-manifest,
.terminal-block,
.verdict,
.tools-used {
  padding: 1rem;
}

.screenshot-titlebar,
.tool-manifest-header,
.tools-used-section,
.verdict-label,
.shell-badge {
  font-family: var(--font-ui);
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top-color: var(--border);
}

.footer-main {
  gap: 1rem 2rem;
}

.footer-nav a,
.footer-links,
.footer-links a,
.footer-tagline {
  font-family: var(--font-ui);
}

.footer-tagline {
  font-style: normal;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .home-grid,
  .article-shell--with-outline {
    grid-template-columns: 1fr;
  }

  .home-rail {
    position: static;
  }

  .article-outline--desktop {
    display: none;
  }

  .article-outline--mobile {
    display: block;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 16px;
  }

  .site-header,
  .content,
  .site-footer {
    width: min(var(--content-width), calc(100% - 1rem));
  }

  .site-header {
    padding-top: 0.7rem;
  }

  .header-top {
    align-items: flex-start;
  }

  .header-copy {
    gap: 0.15rem;
  }

  .header-tagline {
    display: none;
  }

  .site-nav {
    width: 100%;
    gap: 0.4rem;
  }

  .site-nav a,
  .theme-toggle {
    height: 2.1rem;
    padding-inline: 0.72rem;
    font-size: 0.86rem;
  }

  .content {
    padding-top: 1.5rem;
  }

  .hero-tagline,
  .page-header h1 {
    max-width: none;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .article-body,
  .page-intro,
  .story-card p,
  .listing-card p,
  .feature-card p,
  .rail-list span,
  .rail-link span,
  .dek {
    font-size: 1.02rem;
  }

  .article-body > :is(figure, .callout, .prompt-block, .llm-session, .screenshot-frame, .tool-dir, .tool-manifest, .verdict, .tools-used, .highlight, pre, table) {
    max-width: 100%;
  }

  .prompt-content {
    max-height: 16.5rem;
  }

  .prompt-actions-right {
    width: 100%;
  }

  .prompt-run-link {
    width: 100%;
    justify-content: center;
  }
}
