/* Nemo Visual Design System & Prose Styling */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg-main: #F5F0E6;
  --bg-secondary: #EEE6D8;
  --card-surface: #FFFCF5;
  --text-main: #29251F;
  --text-secondary: #756D60;
  --accent-primary: #78805A;
  --accent-dark: #424B32;
  --border-subtle: #DDD3C3;
  --code-bg: #262820;
  --code-fg: #F3ECDD;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

h1, h2, .font-editorial, .font-serif {
  font-family: 'DM Serif Display', Georgia, serif;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #EEE6D8;
}
::-webkit-scrollbar-thumb {
  background: #DDD3C3;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #78805A;
}

/* Prose for rendered Markdown */
.nemo-prose h1,
.nemo-prose h2,
.nemo-prose h3,
.nemo-prose h4,
.nemo-prose h1 a,
.nemo-prose h2 a,
.nemo-prose h3 a,
.nemo-prose h4 a {
  text-decoration: none !important;
}

.nemo-prose h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 2.25rem;
  line-height: 2.5rem;
  color: #29251F;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.nemo-prose h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.75rem;
  line-height: 2rem;
  color: #29251F;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #DDD3C3;
}

.nemo-prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #29251F;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.nemo-prose h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #424B32;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.nemo-prose p {
  color: #4A443A;
  line-height: 1.75;
  margin-bottom: 1rem;
}

.nemo-prose ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: #4A443A;
}

.nemo-prose ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: #4A443A;
}

.nemo-prose li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

.nemo-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.925rem;
  background-color: #FFFCF5;
  border: 1px solid #DDD3C3;
  border-radius: 0.5rem;
  overflow: hidden;
}

.nemo-prose th {
  background-color: #EEE6D8;
  color: #29251F;
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid #DDD3C3;
}

.nemo-prose td {
  padding: 0.65rem 1rem;
  border: 1px solid #DDD3C3;
  color: #4A443A;
}

.nemo-prose tr:nth-child(even) {
  background-color: #FAF6ED;
}

.nemo-prose hr {
  border: 0;
  border-top: 1px solid #DDD3C3;
  margin: 2rem 0;
}

.nemo-prose blockquote {
  border-left: 3px solid #78805A;
  padding-left: 1rem;
  font-style: italic;
  color: #756D60;
  margin: 1rem 0;
}

.nemo-prose a {
  color: #424B32;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.nemo-prose a:hover {
  color: #78805A;
}

.nemo-prose pre {
  background-color: #262820;
  color: #F3ECDD;
  padding: 1rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  border: 1px solid #36382E;
  position: relative;
}

pre {
  position: relative;
}

pre[data-code-language] {
  padding-top: 2.5rem;
}

pre[data-code-language]::before {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  color: #A6A896;
  content: attr(data-language-label);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

pre[data-code-language="python"] {
  background-color: #202B3A;
  border-color: #35465A;
}

pre[data-code-language="json"] {
  background-color: #2A2438;
  border-color: #46395E;
}

pre[data-code-language="bash"] {
  background-color: #202C27;
  border-color: #35483F;
}

pre[data-code-language="powershell"] {
  background-color: #1D2C3B;
  border-color: #354C63;
}

pre[data-code-language="sql"] {
  background-color: #292A26;
  border-color: #4B4B3D;
}

pre[data-code-language="cpp"] {
  background-color: #292638;
  border-color: #45405D;
}

pre[data-code-language="terminal"] {
  background-color: #242622;
  border-color: #41443A;
}

.syntax-keyword {
  color: #C792EA;
}

.syntax-string {
  color: #C3E88D;
}

.syntax-number,
.syntax-constant {
  color: #F78C6C;
}

.syntax-comment {
  color: #87917F;
  font-style: italic;
}

.syntax-function {
  color: #82AAFF;
}

.syntax-builtin {
  color: #89DDFF;
}

.syntax-variable {
  color: #F07178;
}

.syntax-flag,
.syntax-operator {
  color: #89DDFF;
}

.syntax-flag {
  color: #FFCB6B;
}

.terminal-prompt {
  color: #C3E88D;
  font-weight: 700;
}

.terminal-output {
  color: #A6A896;
}

pre[data-code-language="python"] .syntax-keyword {
  color: #82AAFF;
}

pre[data-code-language="json"] .syntax-json-key {
  color: #C792EA;
}

pre[data-code-language="bash"] .syntax-command {
  color: #89DDFF;
  font-weight: 700;
}

pre[data-code-language="powershell"] .syntax-command {
  color: #4FC1FF;
  font-weight: 700;
}

pre[data-code-language="powershell"] .syntax-function {
  color: #82AAFF;
}

pre[data-code-language="powershell"] .syntax-keyword {
  color: #C792EA;
}

.code-copy-btn,
.copy-cmd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0.375rem;
  border: 1px solid #4A4D42;
  background: #2D3027;
  color: #F3ECDD;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.code-copy-btn {
  position: absolute;
  z-index: 1;
  top: 0.5rem;
  right: 0.5rem;
}

.code-copy-btn svg,
.copy-cmd-btn svg {
  width: 1rem;
  height: 1rem;
}

.code-copy-btn:hover,
.copy-cmd-btn:hover {
  background: #3D4034;
}

.code-copy-btn:focus-visible,
.copy-cmd-btn:focus-visible {
  outline: 2px solid #A9B182;
  outline-offset: 2px;
}

.code-copy-btn.is-copied,
.copy-cmd-btn.is-copied {
  color: #C6D19B;
}

.code-copy-btn.is-copy-error,
.copy-cmd-btn.is-copy-error {
  color: #F3A59D;
}

.nemo-prose code:not(pre code) {
  background-color: #EEE6D8;
  color: #424B32;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid #DDD3C3;
}

.docs-page ::-webkit-scrollbar-thumb {
  border-radius: 0;
}

body.docs-site * {
  border-radius: 0 !important;
}

body.examples-site * {
  border-radius: 0 !important;
}

.examples-readme {
  min-width: 0;
  overflow-x: auto;
}

.examples-readme table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.examples-browser {
  min-width: 0;
}

.example-source {
  border: 1px solid var(--border-subtle);
  background: var(--card-surface);
}

.example-source summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 1.25rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  list-style: none;
}

.example-source summary::-webkit-details-marker {
  display: none;
}

.example-source summary::before {
  content: '+';
  grid-column: 4;
  grid-row: 1;
  color: var(--accent-dark);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  text-align: right;
}

.example-source[open] summary::before {
  content: '−';
}

.example-source summary > span:first-child {
  grid-column: 1;
}

.example-description {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-main);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.example-expand-label {
  grid-column: 3;
  color: var(--accent-dark);
  font-size: 0.75rem;
  white-space: nowrap;
}

.example-source-content {
  padding: 0 1rem 1rem;
}

.example-source-content pre {
  overflow-x: auto;
  margin: 0;
  padding: 2.5rem 1rem 1rem;
  border: 1px solid #35465A;
  background: #202B3A;
  color: #F3ECDD;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.example-source-status {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.example-github-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--accent-dark);
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.example-source-content pre + .example-github-link {
  margin-top: 0.5rem;
}

.docs-layout {
  min-height: calc(100vh - 12rem);
}

.docs-nav {
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  padding-right: 1.25rem;
  border-right: 1px solid var(--border-subtle);
}

.docs-nav-link {
  border-left: 2px solid transparent;
}

.docs-nav-link.is-active {
  background: var(--bg-secondary);
  color: var(--accent-dark);
  border-left-color: var(--accent-primary);
  font-weight: 700;
}

.docs-article {
  min-width: 0;
}

.docs-article .nemo-prose h2,
.docs-article .nemo-prose h3 {
  scroll-margin-top: 6rem;
}

.docs-toc {
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  padding-left: 1rem;
  border-left: 1px solid var(--border-subtle);
}

.docs-toc-link {
  border-left: 2px solid transparent;
  text-decoration: none;
}

.docs-toc-link.is-active {
  color: var(--accent-dark);
  border-left-color: var(--accent-primary);
  font-weight: 700;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

.docs-mobile-nav {
  grid-column: 1 / -1;
  padding: 0.75rem 1rem;
  background: var(--card-surface);
  border: 1px solid var(--border-subtle);
  color: var(--accent-dark);
}

.docs-mobile-nav summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.docs-index-card {
  min-height: 13rem;
}

.readme-content img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

.site-header-inner {
  width: 100%;
}

@media (max-width: 1279px) {
  .docs-article {
    grid-row: 2;
  }

  .docs-mobile-nav {
    grid-row: 1;
  }
}

@media (max-width: 639px) {
  .site-header-inner {
    height: 3.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .site-header-inner > a:first-child {
    gap: 0.625rem;
  }

  .site-header-inner > a:first-child > div {
    width: 2rem;
    height: 2rem;
  }

  .site-header-inner > a:first-child > span {
    font-size: 1.375rem;
    line-height: 1.75rem;
  }

  .site-header-inner > div:last-child {
    gap: 0.5rem;
  }

  .site-header-inner > div:last-child > a[aria-label] {
    padding: 0.5rem;
  }

  .site-header-inner > div:last-child > a[href="/docs"],
  .site-header-inner > div:last-child > .examples-nav-button {
    min-width: 3.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }

  .example-source summary {
    grid-template-columns: auto minmax(0, 1fr) 1.25rem;
    gap: 0.5rem;
  }

  .example-source summary::before {
    grid-column: 3;
  }

  .example-expand-label {
    display: none;
  }

  .docs-article {
    padding: 1.25rem;
  }
}

@media (max-width: 359px) {
  .site-header-inner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .site-header-inner > a:first-child > span {
    font-size: 1.25rem;
  }
}
