/* Static Site Template - Responsive Styles */

:root {
  --color-bg: #ffffff;
  --color-surface: #f8f9fd;
  --color-border: #e5e7eb;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-brand: #3b82f6;
  --color-brand-dark: #2563eb;
  --color-header-bg: #1a1a2e;
  --color-header-text: #ffffff;
  --color-hero-bg: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  --sidebar-width: 320px;
  --content-max-width: 980px;
  --header-height: var(--vexy-menu-height, 64px);
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Dark theme */
[data-theme="dark"] {
  --color-bg: #111827;
  --color-surface: #1f2937;
  --color-border: #374151;
  --color-text: #f9fafb;
  --color-text-muted: #9ca3af;
  --color-brand: #60a5fa;
  --color-brand-dark: #3b82f6;
  --color-header-bg: #0f0f1a;
  --color-hero-bg: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* Reserve CSI chrome space before the CDN custom elements upgrade. */
vexy-menu,
fontlab-menu {
  display: block;
  min-height: var(--vexy-menu-height, 64px);
  background: #1a1a1a;
}

fontlab-menu { min-height: var(--fl-menu-height, 56px); }
.sidebar-nav[data-navigation-pending] { visibility: hidden; }

vexy-footer,
fontlab-footer {
  display: block;
  min-height: 220px;
  background: #1a1a1a;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-brand-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* HEADER */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-header-bg);
  color: var(--color-header-text);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.header-logo:hover {
  opacity: 0.85;
}

.header-logo svg {
  width: 48px;
  height: 48px;
}

.header-logo-img {
  height: 48px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
}

.header-link {
  color: var(--color-header-text);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
  transition: opacity var(--transition-fast);
}

.header-link:hover {
  opacity: 1;
  color: var(--color-header-text);
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-brand);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  transition: background var(--transition-fast);
}

.header-btn:hover {
  background: var(--color-brand-dark);
  color: white;
}

.article-mobile-header {
  display: none;
}

/* HERO SECTION */
.hero {
  background: var(--color-hero-bg);
  padding: 4rem 1.5rem;
  text-align: center;
  color: white;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1rem;
  opacity: 0.85;
  max-width: 800px;
  margin: 0 auto 2rem;
}

.hero-subtitle--columns { text-align: left; }
@media (min-width: 768px) {
  .hero-subtitle--columns {
    column-count: 2;
    column-gap: 2rem;
    column-fill: balance;
  }
}

.hero-search {
  max-width: 580px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.search-icon {
  position: absolute;
  left: 1rem;
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--color-text);
  outline: none;
}

.search-input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 20%, transparent);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-shortcut {
  position: absolute;
  right: 1rem;
  padding: 0.25rem 0.5rem;
  background: var(--color-surface);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* FEATURED TILES */
.tiles-section {
  padding: 3rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

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

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tile:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-md);
  color: inherit;
}

.tile-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand);
}

.tile-icon svg {
  width: 56px;
  height: 56px;
}

.tile-icon .material-symbols-outlined {
  font-size: 56px;
}

.tile-content {
  flex: 1;
  min-width: 0;
}

.tile-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.tile-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* FOOTER */
.footer {
  margin-top: auto;
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.footer-viewer {
  align-items: stretch;
  text-align: left;
}

.footer-viewer-inner {
  width: min(var(--content-max-width), calc(100% - var(--sidebar-width) - 4rem));
  margin-left: calc(var(--sidebar-width) + 2rem);
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-viewer .footer-links,
.footer-viewer .footer-social {
  justify-content: flex-start;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer-link:hover {
  color: var(--color-text);
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text-muted);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.footer-social a:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.article-copyright {
  margin-left: var(--sidebar-width);
  padding: 0 2rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
  opacity: 0.65;
}

.article-copyright > div {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.article-bottom-nav {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 1.75rem auto 0;
  padding: 0 0 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(2rem, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.article-bottom-nav-link {
  min-width: 0;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 12px;
  transition: color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.article-bottom-nav-link:not(.article-bottom-nav-empty) {
  padding: 0.5rem 0.25rem;
}

.article-bottom-nav-link:hover,
.article-bottom-nav-link:focus-visible {
  color: var(--color-text);
}

.article-bottom-nav-link:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 4px;
}

.article-bottom-nav-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.625rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
}

.article-bottom-nav-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 600;
}

.article-bottom-nav-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.article-bottom-nav-arrow {
  flex: 0 0 auto;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 400;
  color: var(--color-text);
  opacity: 0.8;
}

.article-bottom-nav-prev {
  justify-self: start;
  width: 100%;
}

.article-bottom-nav-next {
  justify-self: end;
  width: 100%;
  text-align: right;
}

.article-bottom-nav-next .article-bottom-nav-row {
  justify-content: flex-end;
}

.article-bottom-nav-spacer {
  min-width: 0;
}

.article-bottom-nav-empty {
  pointer-events: none;
}

/* VIEWER LAYOUT */
.viewer-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  padding-top: var(--header-height);
}

.csi-chrome .viewer-shell {
  padding-top: 0;
}

.sidebar {
  position: fixed;
  top: var(--vexy-menu-height, 64px);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transform: translateX(0);
  transition: transform var(--transition-normal);
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}
.sidebar-header > .sidebar-search { flex: 1; min-width: 0; }
.sidebar-collapse-button, .sidebar-expand-rail {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.sidebar-collapse-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 4px;
  border-radius: 6px;
}
.sidebar-collapse-button:hover, .sidebar-expand-rail:hover {
  color: var(--color-text);
  background: var(--color-border);
}
.sidebar-collapse-button:focus, .sidebar-expand-rail:focus,
.sidebar-collapse-button:focus-visible, .sidebar-expand-rail:focus-visible {
  outline: none;
  box-shadow: none;
}
.sidebar-collapse-button .material-symbols-outlined,
.sidebar-expand-rail .material-symbols-outlined { font-size: 24px; line-height: 1; }
.sidebar-expand-rail { display: none; }


.sidebar-search {
  position: relative;
}

.sidebar-search-input {
  width: 100%;
  padding: 0.375rem 0.5rem 0.375rem 2.25rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast);
}

.sidebar-search-input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 20%, transparent);
}

.sidebar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: calc(100dvh - 8rem);
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.search-results[hidden] {
  display: none;
}

.search-result-item {
  display: block;
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
  text-align: left;
  text-decoration: none;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus,
.search-result-item:focus-visible {
  background: color-mix(in srgb, var(--color-brand) 12%, var(--color-bg));
  outline: none;
  box-shadow: none;
}

.search-result-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.search-result-snippet {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-highlight {
  background: color-mix(in srgb, var(--color-brand) 20%, transparent);
  font-weight: 600;
}

/* Tree Navigation */
.tree-chapter {
  margin-bottom: 0.25rem;
}

.tree-chapter-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
}

.tree-chapter-header:hover {
  background: var(--color-border);
}

.tree-chapter-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.tree-chapter.open .tree-chapter-icon {
  transform: rotate(90deg);
}

.tree-chapter-articles {
  display: none;
  padding-left: 1.5rem;
}

.tree-chapter.open .tree-chapter-articles {
  display: block;
}

.tree-article {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tree-article:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.tree-article.active {
  background: color-mix(in srgb, var(--color-brand) 10%, transparent);
  color: var(--color-brand);
  font-weight: 500;
}

/* Content Area */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: calc(100% - var(--sidebar-width));
}

.content.full-width {
  margin-left: 0;
  max-width: 100%;
}

.article-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--color-header-text);
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.theme-toggle:hover {
  opacity: 1;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* MARKDOWN CONTENT */
.markdown-body {
  font-size: 1rem;
  line-height: 1.7;
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  line-height: 1.3;
}

.markdown-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
}

.markdown-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.markdown-body p {
  margin: 1rem 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.markdown-body li {
  margin: 0.25rem 0;
}

.markdown-body blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--color-brand);
  background: var(--color-surface);
  border-radius: 0 8px 8px 0;
}

.markdown-body blockquote p {
  margin: 0;
}

.markdown-body blockquote.blockquote--author {
  margin: 2rem 0 1.5rem auto;
  padding: 0 1.5rem 0 0;
  border-left: 0;
  border-right: 1px solid var(--color-border);
  text-align: right;
}

.markdown-body blockquote.blockquote--author p {
  margin: 0;
}

.markdown-body blockquote.blockquote--author p:first-child {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.markdown-body p.blockquote--author {
  margin: 2rem 0 1.5rem auto;
  padding: 0 1.5rem 0 0;
  border-right: 1px solid var(--color-border);
  text-align: right;
  line-height: 1.25;
}

.markdown-body p.blockquote--author strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.markdown-body p.blockquote--author a {
  display: block;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 400;
  text-decoration: none;
}

.markdown-body pre {
  margin: 1rem 0;
  padding: 1rem;
  background: #1a1a2e;
  color: #f8f8f2;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.markdown-body pre::-webkit-scrollbar {
  height: 8px;
}

.markdown-body pre::-webkit-scrollbar-track {
  background: transparent;
}

.markdown-body pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.markdown-body pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.35);
}

.markdown-body code {
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
  font-size: 0.875em;
  background: var(--color-surface);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

/* Default image styles */
.markdown-body img {
  max-width: 100%;
  height: auto;
}

/* Inline vs block images in markdown:
   - If an image is embedded in a text container, keep it inline.
   - If a container contains only an image, keep it as a block with spacing. */
.markdown-body .md-img-inline > img {
  display: inline-block !important;
  vertical-align: middle;
  margin: 0 !important;
}
.markdown-body .md-img-inline > a > img {
  display: inline-block !important;
  vertical-align: middle;
  margin: 0 !important;
}

.markdown-body .md-img-block > img,
.markdown-body .md-img-block > a > img {
  display: block !important;
  margin: 1rem 0 !important;
}

/* Block images: when image is the only content in a paragraph */
.markdown-body p > img:only-child,
.markdown-body p > a:only-child > img {
  display: block;
  border-radius: 8px;
  margin: 1rem 0;
}

/* Inline images: when paragraph has other content alongside the image */
.markdown-body p:not(:has(> img:only-child)):not(:has(> a:only-child)) img {
  display: inline;
  vertical-align: middle;
  margin: 0 0.2em;
  border-radius: 0;
}

/* Images in table cells should also be handled */
.markdown-body td img,
.markdown-body th img {
  display: block;
  border-radius: 8px;
  margin: 0.5rem 0;
}

[data-theme="dark"] .markdown-body img[src*=".svg" i] {
  filter: invert(1) hue-rotate(180deg);
}

[data-theme="dark"] .markdown-body img[src*=".png" i] {
  background: #fff;
  padding: 0;
  border-radius: 0;
  border: none;
}

.markdown-body table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
}

.markdown-body th,
.markdown-body td {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--color-surface);
  font-weight: 600;
  white-space: nowrap;
}

.markdown-body tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

.markdown-body hr {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

.markdown-body a {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body a:hover {
  color: var(--color-brand-dark);
}

.markdown-body kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  font-size: 0.875em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--color-border);
}

.markdown-body .md-samp-path {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.86em;
  font-style: normal;
  line-height: 1.25;
  white-space: nowrap;
  vertical-align: baseline;
}

.markdown-body .md-samp-path-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: inherit;
  font-style: normal;
}

.markdown-body .md-samp-path-item + .md-samp-path-item::before {
  content: "›";
  color: var(--color-text-muted);
  font-size: 0.9em;
}

.markdown-body .md-callout {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.1rem 0;
  color: var(--color-text);
}

.markdown-body .md-callout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-family: "Material Symbols Outlined", "Material Symbols Rounded";
  font-size: 1.35rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

.markdown-body .md-callout-label {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.markdown-body .md-callout-info .md-callout-icon {
  color: #13b8d0;
}

.markdown-body .md-callout-tip .md-callout-icon {
  color: #00b894;
}

.markdown-body .md-callout-question .md-callout-icon {
  color: #58d82f;
}

.markdown-body .md-callout-warning .md-callout-icon {
  color: #f59e0b;
}

/* LOADING & EMPTY STATES */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--color-text-muted);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.5;
}

/* RESPONSIVE BREAKPOINTS */

@media (max-width: 900px) {
  :root {
    --vexy-menu-height: 56px;
    --fl-menu-height: 56px;
    --header-height: 56px;
  }

  vexy-menu,
  fontlab-menu {
    min-height: var(--header-height);
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .tiles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-chrome .header {
    position: static;
  }

  .viewer-shell {
    padding-top: 0;
  }

  .article-mobile-header {
    position: sticky;
    top: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--header-height);
    padding: 0 1rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
  }

  .article-title-toggle {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border: 0;
    background: transparent;
    color: var(--color-text);
    text-align: left;
    transition: opacity var(--transition-fast), flex-basis var(--transition-normal);
  }

  .article-title-toggle:hover,
  .article-title-toggle:focus-visible {
    color: var(--color-brand);
  }

  .article-title-toggle:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: -4px;
  }

  .article-title-toggle .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 1.4rem;
    line-height: 1;
  }

  .article-title-toggle span:last-child {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
  }

  .article-mobile-header .sidebar-search {
    flex: 0 0 min(36vw, 9.5rem);
    min-width: 7.25rem;
    position: relative;
    transition: flex-basis var(--transition-normal), min-width var(--transition-normal);
  }

  #article-header-search {
    height: 36px;
    padding: 0 2.5rem 0 0.875rem;
    border-radius: 999px;
    font-size: 0.875rem;
    background: var(--color-bg);
  }

  .article-mobile-header .sidebar-search > button {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--color-brand);
    color: #fff;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
  }

  .article-mobile-header .sidebar-search > button:hover,
  .article-mobile-header .sidebar-search > button:focus-visible {
    background: var(--color-brand-dark);
  }

  .article-mobile-header .sidebar-search > button:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
  }

  .article-mobile-header .sidebar-search > button .material-symbols-outlined {
    font-size: 1.15rem;
    line-height: 1;
  }

  .article-mobile-header[data-search-expanded="true"] .article-title-toggle {
    flex: 0 1 0;
    opacity: 0;
    pointer-events: none;
  }

  .article-mobile-header[data-search-expanded="true"] .sidebar-search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .article-mobile-header .search-results {
    top: calc(100% + 0.5rem);
    max-height: min(60vh, 420px);
    border-radius: 10px;
  }
  
  .sidebar {
    transform: translateX(-100%);
    z-index: 80;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header { display: flex; }

  .sidebar-nav {
    padding-top: 0.75rem;
  }
  
  .content {
    margin-left: 0;
    max-width: 100%;
  }

  .article-copyright {
    margin-left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .footer-viewer-inner {
    width: min(var(--content-max-width), calc(100% - 4rem));
    margin-left: 2rem;
  }
}

/* Mobile */
@media (max-width: 640px) {
  :root {
    --header-height: var(--vexy-menu-height, 64px);
  }
  
  .hero {
    padding: calc(var(--header-height) + 2rem) 1rem 2rem;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 0.875rem;
  }
  
  .search-input {
    padding: 0.875rem 0.875rem 0.875rem 2.75rem;
    font-size: 0.9375rem;
  }
  
  .tiles-section {
    padding: 2rem 1rem;
  }
  
  .tiles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .tile {
    padding: 1.25rem;
  }
  
  .header {
    padding: 0 1rem;
  }

  .header-nav {
    gap: 0.5rem;
  }
  
  .header-link {
    display: none;
  }

  .header-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .header-logo svg {
    width: 36px;
    height: 36px;
  }

  .header-logo-img {
    height: 36px;
  }

  .article-mobile-header {
    gap: 0.625rem;
    padding: 0 0.75rem;
  }

  .article-title-toggle span:last-child {
    font-size: 1rem;
  }

  .article-mobile-header .sidebar-search {
    flex-basis: min(38vw, 8.5rem);
    min-width: 6.75rem;
  }

  #article-header-search {
    height: 34px;
    padding-left: 0.75rem;
    padding-right: 2.35rem;
    font-size: 0.8125rem;
  }

  .article-mobile-header .sidebar-search > button {
    width: 28px;
    height: 28px;
  }
  
  .footer {
    padding: 1rem;
  }

  .footer-viewer-inner {
    width: calc(100% - 2rem);
    margin-left: 1rem;
  }
  
  .content {
    padding: 1.5rem 1rem;
  }

  .article-copyright {
    padding: 0 1rem 0.75rem;
  }

  .article-bottom-nav {
    margin-top: 1.5rem;
    grid-template-columns: minmax(0, 1fr) 1rem minmax(0, 1fr);
    gap: 0.5rem;
  }

  .article-bottom-nav-link:not(.article-bottom-nav-empty) {
    padding: 0.375rem 0;
  }

  .article-bottom-nav-label {
    font-size: 0.5625rem;
  }

  .article-bottom-nav-row {
    gap: 0.375rem;
    font-size: 0.875rem;
  }

  .article-bottom-nav-arrow {
    font-size: 1.25rem;
  }
  
  .markdown-body h1 {
    font-size: 1.5rem;
  }
  
  .markdown-body h2 {
    font-size: 1.25rem;
  }
  
  .markdown-body pre {
    font-size: 0.8125rem;
    padding: 0.75rem;
  }
}

/* Print styles */
@media print {
  .header,
  .sidebar,
  .footer,
  .theme-toggle,
  .article-bottom-nav,
  vexy-menu,
  vexy-footer,
  fontlab-menu,
  fontlab-footer,
  .article-mobile-header {
    display: none !important;
  }
  
  .content {
    margin-left: 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  
  .viewer-shell {
    padding-top: 0 !important;
  }
}/* Optional top-level Sections navigation. */
.has-sections {
  --sections-height: 0px;
  --site-header-height: var(--fl-menu-height, var(--vexy-menu-height, var(--header-height)));
}
.has-sections.csi-chrome #csi-header { position: sticky; top: 0; z-index: 100; }
/* Once upgraded, use the imported menu’s real height rather than its loading placeholder. */
.has-sections.csi-chrome #csi-header:defined { min-height: 0; }
.has-sections.custom-chrome .viewer-shell { padding-top: calc(var(--site-header-height) + var(--sections-height)); }
.has-sections.csi-chrome .viewer-shell { padding-top: var(--sections-height); }
.has-sections .sidebar { top: calc(var(--site-header-height) + var(--sections-height)); }
.has-sections.landing-page.custom-chrome .hero { margin-top: calc(var(--site-header-height) + var(--sections-height)); }
.has-sections.landing-page.csi-chrome .hero { margin-top: var(--sections-height); }
.has-sections .markdown-body [id] { scroll-margin-top: calc(var(--site-header-height) + var(--sections-height) + 1rem); }
.landing-introduction {
  width: min(100%, var(--content-max-width));
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  scroll-margin-top: calc(var(--site-header-height) + var(--sections-height) + 1rem);
}
@media (max-width: 1024px) {
  .has-sections.custom-chrome .header { position: fixed; }
  .has-sections.custom-chrome .article-mobile-header { margin-top: calc(var(--site-header-height) + var(--sections-height)); }
  .has-sections.csi-chrome .article-mobile-header { margin-top: var(--sections-height); }
  .has-sections .article-mobile-header { top: calc(var(--site-header-height) + var(--sections-height)); }
  .has-sections .viewer-shell, .has-sections.custom-chrome .viewer-shell, .has-sections.csi-chrome .viewer-shell { padding-top: 0; }
  .has-sections .markdown-body [id] { scroll-margin-top: calc(var(--site-header-height) + var(--sections-height) + var(--header-height) + 1rem); }
}


@media print {
  .has-sections .viewer-shell, .has-sections.custom-chrome .viewer-shell, .has-sections.csi-chrome .viewer-shell { padding-top: 0; }
  .has-sections.landing-page .hero { margin-top: 0; }
}

/* Article panes scroll below the fixed chrome, just like the admin editor. */
.article-page {
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  --site-header-height: var(--header-height);
  --visible-site-header-height: max(0px, calc(var(--site-header-height) - var(--header-scroll-offset, 0px)));
}
.article-page.custom-chrome .header { position: fixed; }
.article-page #csi-header:defined { min-height: 0; }
.article-page .viewer-shell {
  position: fixed;
  top: calc(var(--visible-site-header-height, var(--site-header-height)) + var(--sections-height, 0px) + var(--article-toolbar-height, 0px));
  right: 0;
  bottom: 0;
  left: 0;
  padding-top: 0 !important;
}
.article-page .content {
  height: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
}
.article-page .sidebar, .article-page .sidebar-overlay {
  top: calc(var(--visible-site-header-height, var(--site-header-height)) + var(--sections-height, 0px) + var(--article-toolbar-height, 0px));
}
.article-page .article-mobile-header {
  position: fixed;
  top: calc(var(--visible-site-header-height, var(--site-header-height)) + var(--sections-height, 0px));
  left: 0;
  right: 0;
}
.article-page.has-sections .article-mobile-header { margin-top: 0; }
.article-page .article-copyright { margin: 1rem 0 0; padding: 0; }
.article-page .footer-viewer-inner { width: 100%; margin: 0 auto; }
.article-page .markdown-body [id] { scroll-margin-top: 1rem; }
.sidebar-nav, .article-page .content, .search-results {
  scrollbar-width: auto;
  scrollbar-color: var(--color-border) transparent;
  scrollbar-gutter: auto;
}
.sidebar-nav::-webkit-scrollbar, .article-page .content::-webkit-scrollbar, .search-results::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-track, .sidebar-nav::-webkit-scrollbar-track-piece,
.article-page .content::-webkit-scrollbar-track, .article-page .content::-webkit-scrollbar-track-piece,
.search-results::-webkit-scrollbar-track, .search-results::-webkit-scrollbar-track-piece {
  background: transparent;
  border: none;
}
.sidebar-nav::-webkit-scrollbar-thumb, .article-page .content::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
  border: none;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover, .article-page .content::-webkit-scrollbar-thumb:hover, .search-results::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
@media print {
  .article-page { height: auto; min-height: 0; overflow: visible; }
  .article-page .viewer-shell { position: static; display: block; }
  .article-page .content { height: auto; overflow: visible; }
}

.header-site-name { margin-left: 0.75rem; font-size: 0.875rem; font-weight: 600; }
.landing-page.has-sections .tiles-section { padding-bottom: 1.5rem; }
.landing-introduction { padding-top: 1rem; }
.landing-introduction > :first-child { margin-top: 0; }

.sidebar-nav.has-section-groups { padding: 0; overflow-anchor: none; }
.tree-section { position: relative; }
.tree-section-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.625rem;
  --section-surface: color-mix(in srgb, var(--color-brand) 3%, var(--color-surface));
  background: color-mix(in srgb, var(--section-surface) 72%, transparent);
  color: var(--color-text);
  font-family: var(--section-font-family, inherit);
  font-size: var(--section-font-size, 13px);
  font-weight: var(--section-font-weight, 500);
  letter-spacing: var(--section-letter-spacing, 0.04em);
  text-transform: uppercase;
}
.tree-section.active > .tree-section-header {
  --section-surface: color-mix(in srgb, var(--color-brand) 6%, var(--color-surface));
}
.tree-section-title { flex: 1; min-width: 0; color: inherit; overflow-wrap: anywhere; }
.tree-section.active > .tree-section-header .tree-section-title { color: var(--color-brand); }
.tree-section-toggle, .tree-section-start {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 24px; width: 24px; height: 24px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.tree-section-start[hidden] { display: flex; visibility: hidden; pointer-events: none; }
.tree-section-chevron { width: 14px; height: 14px; }
.tree-section.open > .tree-section-header .tree-section-chevron { transform: rotate(90deg); }
.tree-section-chapters { display: none; padding: 0.25rem 0.5rem; }
.tree-section.open > .tree-section-chapters { display: block; }
.tree-section-header a:focus-visible, .tree-section-header button:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* Quiet section surfaces become frosted only while pinned over scrolling rows. */
.tree-section.is-pinned > .tree-section-header {
  background: color-mix(in srgb, var(--section-surface) 88%, transparent);
  -webkit-backdrop-filter: blur(2px) saturate(120%);
  backdrop-filter: blur(2px) saturate(120%);
}
[data-theme="dark"] {
  --color-nav-active: color-mix(in srgb, var(--color-brand) 45%, white);
  --color-article-heading: color-mix(in srgb, var(--color-text) 30%, white);
}
[data-theme="dark"] .tree-article.active {
  color: var(--color-nav-active);
  background: color-mix(in srgb, var(--color-nav-active) 12%, transparent);
}
[data-theme="dark"] .tree-section.active > .tree-section-header .tree-section-title {
  color: var(--color-nav-active);
}
[data-theme="dark"] .tree-chapter-header,
[data-theme="dark"] .markdown-body :is(h1, h2, h3, h4, h5, h6) {
  color: var(--color-article-heading);
}
[data-theme="dark"] .markdown-body :is(h1, h2, h3, h4, h5, h6) a {
  color: var(--color-nav-active);
}


.flum-site-identity { display: inline-flex; align-items: center; gap: 0; min-width: 0; flex: 0 1 auto; white-space: nowrap; }
.flum-site-identity > :first-child { min-width: 0; flex: 0 1 auto; }
.flum-site-identity > a.header-site-name { color: inherit; text-decoration: none; }
.flum-site-identity > a { overflow: hidden; text-overflow: ellipsis; display: block; }
.flum-section-colon { flex: 0 0 auto; white-space: pre; }
.flum-section-picker { min-width: 0; flex: 0 1 auto; line-height: 1.3; }
/* Reserve space for the underline inside the ellipsis clip without increasing header height. */
.flum-section-trigger { cursor: pointer; list-style: none; padding: 0 0 4px; margin-bottom: -4px; max-width: min(30vw, 22rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.flum-section-trigger::-webkit-details-marker { display: none; }
.flum-section-trigger:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.flum-section-options { position: fixed; top: var(--flum-panel-top, 56px); left: 16px; width: max-content; max-width: calc(100vw - 32px); max-height: calc(100dvh - var(--flum-panel-top, 56px) - 12px); overflow-y: auto; padding: 0.5rem; border: 1px solid rgba(127,127,127,0.25); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 1001; font-size: inherit; font-weight: inherit; line-height: 1.4; text-transform: uppercase; letter-spacing: inherit; box-sizing: border-box; }
.flum-section-options a { display: block; padding: 0.625rem 0.75rem; color: inherit; white-space: normal; overflow-wrap: anywhere; text-decoration: none; border-radius: 8px; }
.flum-section-options a:hover, .flum-section-options a:focus-visible { color: inherit; background: rgba(127,127,127,0.2); text-decoration: underline; }
.flum-section-options a[aria-current="page"] { background: rgba(127,127,127,0.15); font-weight: inherit; }
@media (max-width: 899px) { .flum-site-identity { flex: 1 1 auto; } .flum-site-identity .fl-site-label, .flum-site-identity .vx-site-label { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; } }

[data-theme="dark"] .tree-section-title:hover,
[data-theme="dark"] .tree-section-title:focus-visible,
[data-theme="dark"] .tree-article:hover,
[data-theme="dark"] .tree-article:focus-visible { color: var(--color-nav-active); }

/* One fixed layer: avoid combining sticky positioning with a scrolling transform. */
.article-page.csi-chrome > #csi-header { position: fixed; top: 0; left: 0; right: 0; }
.article-page > .header, .article-page > #csi-header {
  transform: translate3d(0, calc(-1 * var(--header-scroll-offset, 0px)), 0);
  will-change: transform;
}
@property --sidebar-scroll-thumb {
  syntax: '<color>';
  inherits: true;
  initial-value: transparent;
}
@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
  .article-page .sidebar {
    --sidebar-content-opacity: 0.3;
    --sidebar-scroll-thumb: transparent;
    background-color: transparent;
    border-right-color: transparent;
    transition: background-color 160ms ease-out, border-color 160ms ease-out, --sidebar-scroll-thumb 160ms ease-out, transform var(--transition-normal);
  }
  .article-page .sidebar:is(:hover, :has(:focus-visible)) {
    --sidebar-content-opacity: 1;
    --sidebar-scroll-thumb: var(--color-border);
    background-color: var(--color-surface);
    border-right-color: var(--color-border);
  }
  /* Fade leaf rows, never a parent of the active article or the search header. */
  .article-page .sidebar .tree-section-header,
  .article-page .sidebar .tree-chapter-header,
  .article-page .sidebar .tree-article:not(.active) {
    opacity: var(--sidebar-content-opacity);
    transition: opacity 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out;
  }
  .article-page .sidebar .tree-section-header,
  .article-page .sidebar .tree-article.active,
  .article-page .sidebar .sidebar-search-input {
    transition: background-color 160ms ease-out, border-color 160ms ease-out, backdrop-filter 160ms ease-out;
  }
  .article-page .sidebar:not(:hover):not(:has(:focus-visible)) .tree-section-header {
    background: var(--color-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .article-page .sidebar .sidebar-nav { scrollbar-color: var(--sidebar-scroll-thumb) transparent; }
  .article-page .sidebar .sidebar-nav::-webkit-scrollbar-thumb { background-color: var(--sidebar-scroll-thumb); }
  .article-page .sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-muted); }
}
/* Collapsing preserves a full-height, keyboard-accessible expand target. */
body.sidebar-collapsed { --sidebar-width: 48px; }
.sidebar.collapsed {
  width: 48px;
  transform: translateX(0);
  background: var(--color-surface);
  border-right-color: var(--color-border);
}
.sidebar.collapsed .sidebar-header, .sidebar.collapsed .sidebar-nav { display: none; }
.sidebar.collapsed .sidebar-expand-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  flex: 1;
  width: 100%;
  padding: 1rem 0;
}
body.sidebar-collapsed .content { margin-left: 48px; max-width: calc(100% - 48px); }
@media (prefers-reduced-motion: reduce) {
  .article-page .sidebar, .article-page .sidebar * { transition-duration: 0ms !important; }
}
@media print {
  .article-page { --header-scroll-offset: 0px; }
}


/* Custom CSS */
.markdown-body h1 {
  margin-top:0;
font-size: 3rem; font-weight: 400;
line-height: 1.1111111;
margin-bottom: 0.75em;
}

.markdown-body h2 {
  font-size: 2rem; 
font-weight: 300;
line-height: 1.2em; margin-top: 1.8rem; margin-bottom: 0.8rem;
}


/* Custom light theme - global */
:root {
  --color-brand: #0041a3;
  --color-brand-dark: #00378b;
}

/* Custom dark theme - global */
[data-theme="dark"] {
  --color-text: #f5f7f9;
}
