@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Condensed:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --canvas: #f3eee6;
  --paper: #fffdf9;
  --paper-2: #f6f1e9;
  --paper-3: #ebe4da;
  --shell: #fffdf9;
  --shell-strong: #ffffff;
  --shell-tint: rgba(246, 241, 233, 0.92);
  --ink: #1f2226;
  --ink-soft: #313741;
  --ink-muted: #5b636f;
  --line: rgba(83, 87, 90, 0.18);
  --line-strong: rgba(67, 71, 75, 0.34);
  --blue: #258acb;
  --green: #7dba44;
  --yellow: #f3c333;
  --orange: #f28f28;
  --red: #ec4736;
  --link: #1c638d;
  --link-underline: rgba(28, 99, 141, 0.35);
  --stripe-sequence: linear-gradient(90deg, var(--blue), var(--green), var(--yellow), var(--orange), var(--red));
  --tone-blue-surface: #eef6fb;
  --tone-blue-border: rgba(37, 138, 203, 0.22);
  --tone-green-surface: #f2f7ea;
  --tone-green-border: rgba(125, 186, 68, 0.24);
  --tone-yellow-surface: #fdf6dd;
  --tone-yellow-border: rgba(243, 195, 51, 0.28);
  --tone-orange-surface: #fcecdf;
  --tone-orange-border: rgba(242, 143, 40, 0.24);
  --tone-red-surface: #fbe6e0;
  --tone-red-border: rgba(236, 71, 54, 0.22);
  --shadow: 0 4px 12px rgba(39, 45, 53, 0.08);
  --shadow-soft: 0 2px 8px rgba(39, 45, 53, 0.06);
  --focus: rgba(37, 138, 203, 0.28);
  --cursor-diagram: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%231f2226' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M12 2v20M2 12h20M12 2l-2.6 2.6M12 2l2.6 2.6M12 22l-2.6-2.6M12 22l2.6-2.6M2 12l2.6-2.6M2 12l2.6 2.6M22 12l-2.6-2.6M22 12l-2.6 2.6'/%3E%3Ccircle cx='12' cy='12' r='2.5' fill='%231f2226' stroke='%23fffdf9' stroke-width='1.1'/%3E%3C/svg%3E") 12 12, grab;
  --cursor-diagram-active: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%231f2226' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M12 2v20M2 12h20M12 2l-2.6 2.6M12 2l2.6 2.6M12 22l-2.6-2.6M12 22l2.6-2.6M2 12l2.6-2.6M2 12l2.6 2.6M22 12l-2.6-2.6M22 12l-2.6 2.6'/%3E%3Ccircle cx='12' cy='12' r='4' fill='%231f2226' stroke='%23fffdf9' stroke-width='1.4'/%3E%3C/svg%3E") 12 12, grabbing;
  --max-width: 1280px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans Condensed', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 14%, rgba(37, 138, 203, 0.12), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(243, 195, 51, 0.14), transparent 18%),
    radial-gradient(circle at 84% 78%, rgba(236, 71, 54, 0.11), transparent 20%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 238, 230, 0.98)),
    repeating-linear-gradient(
      180deg,
      transparent 0 47px,
      rgba(70, 75, 80, 0.04) 47px 48px
    );
  background-color: var(--canvas);
}

body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: 122px;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      transparent 0 24px,
      var(--blue) 24px 33px,
      var(--green) 33px 42px,
      var(--yellow) 42px 51px,
      var(--orange) 51px 60px,
      var(--red) 60px 69px,
      transparent 69px 100%
    );
  opacity: 0.96;
  z-index: 0;
}

::selection {
  background: rgba(243, 195, 51, 0.48);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--ink);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.page-art,
.blob,
.tube {
  display: none !important;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 36px, var(--max-width));
  margin: 0 auto;
  padding: 78px 0 42px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.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;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: block;
  background: url('polarh10-stripe-mark.png') center / contain no-repeat;
}

.brand-copy {
  min-width: 0;
}

.brand-copy span {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.brand-copy strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
  min-width: 0;
  flex-wrap: wrap;
}

.header-search {
  display: flex;
  align-items: stretch;
  flex: 0 1 19rem;
  min-width: min(100%, 18.5rem);
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.header-search-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

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

.header-search-input:focus {
  outline: 0;
}

.header-search:focus-within {
  box-shadow: 0 0 0 3px var(--focus);
}

.header-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: rgba(243, 238, 230, 0.72);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.header-search-button:hover {
  background: rgba(243, 238, 230, 0.94);
  color: var(--ink);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.top-nav a.active,
.top-nav a:hover {
  border-color: rgba(37, 138, 203, 0.26);
  background: rgba(243, 238, 230, 0.72);
  color: var(--ink);
}

.hero,
.page-layout,
.viewer-layout {
  display: grid;
  gap: 18px;
  margin-top: 20px;
  align-items: start;
}

.hero {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.92fr);
}

.hero-home {
  grid-template-columns: minmax(0, 1.38fr) minmax(380px, 0.9fr);
  align-items: stretch;
}

.page-layout,
.viewer-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.page-layout-single {
  grid-template-columns: minmax(0, 1fr);
}

.viewer-layout {
  min-height: 74vh;
}

.panel,
.viewer-nav,
.viewer-main {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--shell);
  box-shadow: var(--shadow-soft);
}

.hero-copy,
.hero-aside,
.section-panel,
.sidebar,
.content-panel,
.viewer-shell,
.viewer-nav,
.viewer-main {
  padding: 24px;
}

.sidebar section + section {
  margin-top: 18px;
}

.viewer-nav section + section {
  margin-top: 18px;
}

.hero-aside,
.sidebar,
.viewer-nav {
  background: #f8f3ec;
}

.hero-aside p,
.sidebar p,
.viewer-nav p,
.viewer-nav .caption {
  color: var(--ink-muted);
}

.eyebrow,
.page-marker,
.category-label,
.kicker,
.meta {
  display: inline-block;
  margin: 0 0 12px;
  padding: 0;
  font-family: 'IBM Plex Sans Condensed', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-muted);
}

.hero-aside .eyebrow,
.sidebar .category-label,
.viewer-nav .category-label {
  color: var(--link);
}

.hero h1,
.page-title {
  margin: 0 0 12px;
  font-size: clamp(2.9rem, 7vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.065em;
  text-transform: none;
}

.content-panel .page-title {
  margin-bottom: 16px;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
}

.hero p,
.page-intro,
.section-subtitle,
.path-card p,
.preview-card p,
.doc-list p,
.meta,
.caption,
.footer,
.prose p,
.prose li,
.prose blockquote {
  color: var(--ink-muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  background: var(--paper);
  border-color: rgba(37, 138, 203, 0.32);
  box-shadow: 0 2px 8px rgba(39, 45, 53, 0.05);
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.button.primary:hover {
  background: #2b3138;
  border-color: #2b3138;
  color: var(--paper);
}

.button[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.stats,
.audience-grid,
.card-grid,
.preview-grid {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  margin-top: 22px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.audience-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat,
.note-list li,
.doc-list a,
.audience-card,
.preview-card,
.path-card,
.step-card,
.nav-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.stat:hover,
.preview-card:hover,
.path-card:hover,
.step-card:hover,
.doc-list a:hover,
.nav-item:hover {
  border-color: rgba(31, 34, 38, 0.18);
  box-shadow: 0 2px 8px rgba(39, 45, 53, 0.04);
}

.stat {
  background: rgba(255, 255, 255, 0.86);
}

.stat strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat span {
  display: block;
  color: var(--ink-muted);
  font-size: 0.96rem;
  line-height: 1.45;
}

.section {
  margin-top: 18px;
}

.tone-dark,
.tone-blue,
.tone-green,
.tone-yellow,
.tone-orange,
.tone-red,
.tone-cool,
.tone-violet,
.tone-warm,
.tone-signal,
.logo-sequence > :nth-child(5n + 1),
.logo-sequence > :nth-child(5n + 2),
.logo-sequence > :nth-child(5n + 3),
.logo-sequence > :nth-child(5n + 4),
.logo-sequence > :nth-child(5n + 5) {
  position: relative;
  overflow: hidden;
}

.tone-dark::before,
.tone-blue::before,
.tone-green::before,
.tone-yellow::before,
.tone-orange::before,
.tone-red::before,
.tone-cool::before,
.tone-violet::before,
.tone-warm::before,
.tone-signal::before,
.logo-sequence > :nth-child(5n + 1)::before,
.logo-sequence > :nth-child(5n + 2)::before,
.logo-sequence > :nth-child(5n + 3)::before,
.logo-sequence > :nth-child(5n + 4)::before,
.logo-sequence > :nth-child(5n + 5)::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  pointer-events: none;
}

.tone-dark {
  background: #fbf7ef;
  border-color: rgba(32, 34, 38, 0.18);
  box-shadow: 0 3px 10px rgba(39, 45, 53, 0.06);
}

.tone-dark::before {
  background: var(--stripe-sequence);
}

.tone-dark p,
.tone-dark .stat span,
.tone-dark .meta,
.tone-dark .kicker,
.tone-dark .eyebrow {
  color: var(--ink-muted);
}

.tone-dark .eyebrow {
  color: var(--red);
}

.tone-blue,
.tone-cool {
  background: var(--tone-blue-surface);
  border-color: var(--tone-blue-border);
}

.tone-blue::before,
.tone-cool::before {
  background: var(--blue);
}

.tone-green,
.tone-violet {
  background: var(--tone-green-surface);
  border-color: var(--tone-green-border);
}

.tone-green::before,
.tone-violet::before {
  background: var(--green);
}

.tone-yellow,
.tone-warm {
  background: var(--tone-yellow-surface);
  border-color: var(--tone-yellow-border);
}

.tone-yellow::before,
.tone-warm::before {
  background: var(--yellow);
}

.tone-orange {
  background: var(--tone-orange-surface);
  border-color: var(--tone-orange-border);
}

.tone-orange::before {
  background: var(--orange);
}

.tone-red,
.tone-signal {
  background: var(--tone-red-surface);
  border-color: var(--tone-red-border);
}

.tone-red::before,
.tone-signal::before {
  background: var(--red);
}

.logo-sequence > :nth-child(5n + 1) {
  background: var(--tone-blue-surface);
  border-color: var(--tone-blue-border);
}

.logo-sequence > :nth-child(5n + 1)::before {
  background: var(--blue);
}

.logo-sequence > :nth-child(5n + 2) {
  background: var(--tone-green-surface);
  border-color: var(--tone-green-border);
}

.logo-sequence > :nth-child(5n + 2)::before {
  background: var(--green);
}

.logo-sequence > :nth-child(5n + 3) {
  background: var(--tone-yellow-surface);
  border-color: var(--tone-yellow-border);
}

.logo-sequence > :nth-child(5n + 3)::before {
  background: var(--yellow);
}

.logo-sequence > :nth-child(5n + 4) {
  background: var(--tone-orange-surface);
  border-color: var(--tone-orange-border);
}

.logo-sequence > :nth-child(5n + 4)::before {
  background: var(--orange);
}

.logo-sequence > :nth-child(5n + 5) {
  background: var(--tone-red-surface);
  border-color: var(--tone-red-border);
}

.logo-sequence > :nth-child(5n + 5)::before {
  background: var(--red);
}

.hero-home .hero-copy .stats {
  margin-top: 0;
}

.hero-home .hero-copy,
.hero-home .hero-preview {
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-home .hero-copy,
.hero-home .hero-preview {
  height: 100%;
}

.hero-preview {
  background: #f8f3ec;
  min-width: 0;
  overflow: hidden;
  padding: 28px 30px 24px;
  gap: 18px;
}

.hero-preview > * {
  min-width: 0;
}

.hero-preview .section-heading {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(1.95rem, 2.9vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.hero-lede {
  max-width: 44rem;
  font-size: 1.08rem;
}

.hero-preview p {
  max-width: 34ch;
  margin: 0;
}

.hero-preview img {
  display: block;
  width: 100%;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-2);
}

.hero-preview-note {
  align-self: end;
}

.feature-list {
  margin-top: 16px;
}

.feature-list li {
  display: grid;
  gap: 6px;
}

.audience-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.path-card,
.preview-card,
.audience-card,
.step-card {
  color: var(--ink);
}

.path-card h3,
.preview-card h3,
.audience-card h3,
.step-card h3 {
  color: var(--ink);
}

.audience-card p {
  margin: 0;
  color: var(--ink-muted);
}

.path-card code,
.preview-card code,
.audience-card code,
.step-card code {
  color: var(--ink-soft);
}

.audience-link-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.audience-link {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-top: 1px solid rgba(31, 34, 38, 0.1);
}

.audience-link-list li:first-child .audience-link {
  padding-top: 0;
  border-top: 0;
}

.audience-link strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.audience-link span {
  display: block;
  color: var(--ink-muted);
  font-size: 0.96rem;
  line-height: 1.46;
}

.audience-link:hover strong,
.audience-link:focus-visible strong {
  color: var(--ink);
  text-decoration: underline;
}

.step-card {
  display: grid;
  gap: 7px;
  align-content: start;
}

.step-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.section-heading,
.sidebar h2,
.category-heading,
.viewer-nav h2,
.viewer-main h2,
.content-panel h1,
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin: 0 0 10px;
  letter-spacing: -0.045em;
  text-transform: none;
}

.section-heading,
.category-heading,
.viewer-main h2,
.prose h2 {
  font-size: 2rem;
}

.category-heading {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.path-card h3,
.preview-card h3,
.step-card h3,
.prose h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  text-transform: none;
}

.path-card code,
.sidebar small,
.kicker,
.meta,
.prose code,
.source-stage pre {
  font-family: 'IBM Plex Mono', monospace;
}

.preview-card img,
.hero-preview img,
.prose img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
}

.doc-list,
.note-list,
.link-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.doc-list a {
  display: block;
}

.doc-list strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.doc-list span,
.nav-item .desc {
  display: block;
  color: inherit;
  opacity: 0.82;
  font-size: 0.96rem;
  line-height: 1.46;
}

.nav-item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  font: inherit;
  line-height: 1.35;
  overflow-wrap: anywhere;
  appearance: none;
  cursor: pointer;
}

.nav-item + .nav-item {
  margin-top: 8px;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(37, 138, 203, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

.content-panel {
  min-width: 0;
  background: var(--paper);
}

.search-panel {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.search-panel p {
  margin: 0 0 12px;
}

.search-panel-standalone {
  padding-bottom: 0;
  border-bottom: 0;
}

.search-panel-results-only .pagefind-ui__form {
  display: none;
}

.search-panel-results-only .pagefind-ui__drawer,
.search-panel-results-only .pagefind-ui__result-area {
  margin-top: 0;
}

.search-section {
  margin-top: 20px;
}

.search-status {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--paper-2);
  color: var(--ink-muted);
}

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

.search-status[data-state='error'] {
  border-style: solid;
  background: #fff1ed;
  color: var(--ink);
}

#pagefind-search {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.search-results {
  display: grid;
  gap: 14px;
}

.search-results-summary,
.search-results-note {
  margin: 0;
  color: var(--ink-muted);
}

.search-results-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.search-result {
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

.search-result-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.search-result-link,
.search-subresult-link {
  color: var(--ink);
  text-decoration: none;
}

.search-result-link:hover,
.search-result-link:focus-visible,
.search-subresult-link:hover,
.search-subresult-link:focus-visible {
  color: var(--link);
  text-decoration: underline;
}

.search-result-excerpt,
.search-subresult-excerpt {
  margin: 8px 0 0;
  color: var(--ink-muted);
}

.search-result-excerpt mark,
.search-subresult-excerpt mark {
  padding: 0 0.1em;
  background: #fff3b3;
  color: var(--ink);
}

.search-result-subsection {
  margin-top: 12px;
}

.search-result-subheading {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.search-result-sublist {
  margin: 0;
  padding-left: 18px;
}

.search-subresult + .search-subresult {
  margin-top: 8px;
}

.prose {
  font-size: 1rem;
  line-height: 1.72;
}

.prose h1:first-child,
.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose blockquote,
.prose pre {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose a {
  color: var(--link);
  border-bottom: 1px solid var(--link-underline);
}

.prose .path-card,
.prose .preview-card,
.prose .path-card:hover,
.prose .preview-card:hover,
.prose .path-card:focus-visible,
.prose .preview-card:focus-visible {
  color: var(--ink);
  border-bottom: 0;
  text-decoration: none;
}

.prose code {
  font-size: 0.92em;
  background: rgba(246, 241, 233, 0.92);
  padding: 0.12rem 0.3rem;
  border: 1px solid rgba(31, 34, 38, 0.08);
  border-radius: 4px;
}

.prose pre,
.viewer-stage,
.source-stage {
  overflow: auto;
  border: 1px solid var(--line-strong);
  color: var(--paper);
}

.prose pre {
  padding: 18px;
  border-radius: var(--radius-md);
  background: #222932;
}

.prose pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

.formula-block {
  margin: 0 0 1rem;
  padding: 18px 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--paper-2);
  box-shadow: var(--shadow-soft);
}

.formula-block .katex-display {
  width: max-content;
  min-width: 100%;
  margin: 0;
}

.formula-block .katex-display > .katex {
  display: block;
  text-align: center;
}

.formula-block .katex {
  font-size: 1.08em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.prose th,
.prose td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 34, 38, 0.1);
}

.prose th {
  background: rgba(246, 241, 233, 0.92);
}

.prose blockquote {
  margin-left: 0;
  padding: 0 0 0 16px;
  border-left: 4px solid var(--orange);
}

.caption-card {
  margin: 1rem 0 1.35rem;
  padding: 16px 18px 18px 20px;
  border: 1px solid var(--line-strong);
  border-left: 6px solid var(--orange);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(242, 143, 40, 0.08), rgba(246, 241, 233, 0.96)),
    var(--paper);
  box-shadow: var(--shadow-soft);
}

.caption-card-title {
  display: block;
  margin: 0 0 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.caption-card p {
  margin: 0;
  color: var(--ink-soft);
}

.caption-card code {
  background: rgba(255, 255, 255, 0.72);
}

.footer {
  margin-top: 20px;
  padding: 14px 0 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.viewer-page {
  min-height: 100vh;
}

.viewer-shell {
  margin-top: 20px;
}

.viewer-toolbar {
  margin-bottom: 16px;
}

.viewer-toolbar h2 {
  margin: 0;
}

.viewer-canvas-shell {
  --viewer-overlay-offset: 78px;
  position: relative;
  margin-bottom: 12px;
}

.viewer-overlay {
  position: absolute;
  inset: 12px 12px auto 12px;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  pointer-events: none;
}

.viewer-overlay > * {
  pointer-events: auto;
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  justify-self: end;
  justify-content: flex-end;
  gap: 10px;
}

.viewer-hint {
  margin: 0 0 14px;
  color: var(--ink-muted);
  font-size: 0.96rem;
}

.viewer-zoom {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(37, 138, 203, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.86);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.viewer-stage,
.source-stage {
  min-height: 58vh;
  padding: var(--viewer-overlay-offset) 14px 14px;
  border-radius: var(--radius-lg);
}

.viewer-stage {
  background: var(--paper);
}

.source-stage {
  background: #222932;
}

.viewer-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 0.7fr));
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(37, 138, 203, 0.18);
  border-radius: var(--radius-md);
  background: #fbf7ef;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
}

.viewer-related-note {
  margin: -2px 0 14px;
  color: var(--ink-muted);
  font-size: 0.94rem;
}

.viewer-meta p,
.viewer-meta code {
  margin: 0;
}

.viewer-meta-item {
  display: grid;
  gap: 4px;
  align-content: start;
}

.viewer-meta-item strong {
  color: var(--ink-soft);
}

.meta-key {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.viewer-description {
  color: var(--ink-muted);
}

.diagram-frame {
  position: relative;
  min-height: 30rem;
  height: min(70vh, 52rem);
  border: 1px solid rgba(67, 71, 75, 0.16);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.diagram-surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  cursor: var(--cursor-diagram);
  touch-action: none;
  overscroll-behavior: contain;
}

.diagram-surface.is-dragging {
  cursor: var(--cursor-diagram-active);
}

.diagram-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(37, 138, 203, 0.05), transparent 18%),
    linear-gradient(315deg, rgba(236, 71, 54, 0.04), transparent 18%);
  z-index: 0;
}

.diagram-surface svg {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  cursor: inherit;
  touch-action: none;
}

.viewer-canvas-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 18px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.98), rgba(242, 236, 226, 1));
  --viewer-overlay-offset: 86px;
}

.viewer-canvas-shell:fullscreen .viewer-overlay {
  inset: 18px 18px auto 18px;
}

.viewer-canvas-shell:fullscreen .viewer-stage,
.viewer-canvas-shell:fullscreen .source-stage {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: var(--viewer-overlay-offset) 18px 18px;
  border: 0;
  border-radius: 0;
}

.viewer-canvas-shell:fullscreen .viewer-stage {
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.98), rgba(242, 236, 226, 1));
}

.viewer-canvas-shell:fullscreen .source-stage {
  background: #222932;
}

.viewer-canvas-shell:fullscreen .diagram-frame {
  height: 100%;
  min-height: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px dashed rgba(67, 71, 75, 0.24);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.56);
}

.source-stage pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #f6f1e9;
}

.four-oh-four {
  display: grid;
  place-items: center;
  min-height: 58vh;
  text-align: center;
}

.four-oh-four h1 {
  margin: 0 0 10px;
  font-size: clamp(4rem, 12vw, 8rem);
  line-height: 0.88;
  letter-spacing: -0.08em;
  color: var(--ink);
}

.four-oh-four p {
  max-width: 42ch;
  margin: 0 auto 20px;
  color: var(--ink-muted);
}

@media (hover: none) and (pointer: coarse) and (min-width: 681px) and (max-width: 1024px) {
  .viewer-canvas-shell {
    --viewer-overlay-offset: 124px;
  }

  .viewer-overlay {
    grid-template-columns: 1fr;
  }

  .viewer-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    justify-self: stretch;
  }

  .viewer-controls .button {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
  }

  #btn-source {
    grid-column: span 1;
  }

  #btn-fullscreen {
    grid-column: span 2;
  }
}

@media (max-width: 980px) {
  .hero,
  .page-layout,
  .viewer-layout,
  .video-feature {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .hero-aside,
  .hero-preview {
    max-width: 42rem;
    width: 100%;
  }

  .hero-preview img {
    margin-inline: auto;
  }
}

@media (max-width: 860px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    padding: 15px 16px;
  }

  .header-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-search {
    flex: none;
    width: 100%;
  }

  .header-search-input {
    width: 100%;
  }

  .top-nav {
    width: 100%;
    gap: 8px;
  }

  .top-nav a {
    flex: 1 1 132px;
    min-height: 40px;
  }

  .hero-copy,
  .hero-aside,
  .section-panel,
  .sidebar,
  .content-panel,
  .viewer-shell,
  .viewer-nav,
  .viewer-main {
    padding: 22px;
  }

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

  .viewer-meta-item:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  body::before {
    height: 92px;
    background:
      linear-gradient(
        180deg,
        rgba(37, 138, 203, 0.82) 0 7px,
        rgba(37, 138, 203, 0.24) 7px 18px,
        rgba(37, 138, 203, 0.06) 18px 48px,
        transparent 48px 100%
      );
  }

  .site-shell {
    width: min(100% - 20px, var(--max-width));
    padding-top: 58px;
  }

  .site-header {
    gap: 14px;
    padding: 14px 16px;
  }

  .brand {
    width: 100%;
    gap: 12px;
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .brand-copy span {
    margin-bottom: 3px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .brand-copy strong {
    font-size: 1.62rem;
  }

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

  .header-search-button {
    min-width: 52px;
  }

  .top-nav a {
    min-width: 0;
    padding: 10px 12px;
  }

  .site-header,
  .hero-copy,
  .hero-aside,
  .section-panel,
  .sidebar,
  .content-panel,
  .viewer-shell,
  .viewer-nav,
  .viewer-main {
    padding: 18px;
  }

  .hero h1,
  .page-title {
    font-size: clamp(2.35rem, 12vw, 4rem);
  }

  .content-panel .page-title {
    font-size: clamp(2.1rem, 10vw, 3.3rem);
  }

  .stats,
  .card-grid,
  .preview-grid,
  .step-grid {
    grid-template-columns: 1fr;
  }

  .page-layout > .content-panel {
    order: 1;
  }

  .page-layout > .sidebar {
    order: 2;
  }

  .viewer-main {
    order: 1;
  }

  .viewer-nav {
    order: 2;
  }

  .action-row,
  .viewer-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .action-row .button {
    width: 100%;
  }

  .viewer-canvas-shell {
    --viewer-overlay-offset: 124px;
  }

  .viewer-overlay {
    inset: 10px 10px auto 10px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .viewer-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    width: 100%;
    justify-self: stretch;
  }

  .viewer-controls .button {
    width: 100%;
    min-width: 0;
  }

  #btn-fullscreen {
    grid-column: span 2;
  }

  .viewer-meta {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .viewer-stage,
  .source-stage {
    padding: var(--viewer-overlay-offset) 10px 10px;
  }

  .diagram-frame {
    min-height: 19rem;
    height: min(58vh, 30rem);
  }

  .prose pre {
    padding: 14px;
  }

  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 520px) {
  .site-shell {
    width: min(100% - 14px, var(--max-width));
    padding-top: 54px;
  }

  .hero-copy,
  .hero-aside,
  .section-panel,
  .sidebar,
  .content-panel,
  .viewer-shell,
  .viewer-nav,
  .viewer-main {
    padding: 16px;
  }

  .hero h1,
  .page-title {
    font-size: clamp(2rem, 11.5vw, 3rem);
  }

  .diagram-frame {
    min-height: 17rem;
    height: min(55vh, 26rem);
  }
}

@media (max-width: 360px) {
  .top-nav,
  .action-row {
    grid-template-columns: 1fr;
  }
}
