:root {
  --light: #faf9f7;
  --lightgray: #e6e4e0;
  --gray: #6f6f76;
  --darkgray: #44444a;
  --dark: #1f1f24;
  --secondary: #264a62;
  --tertiary: #4c746b;
  --highlight: #8f9fa922;
  --textHighlight: #fff23688;
  --surface: #ffffff;
  --surface-subtle: #f3f1ee;
  --hairline: rgba(31, 31, 36, 0.08);
  --shadow-sm: 0 1px 3px rgba(20, 28, 38, 0.04), 0 4px 12px rgba(20, 28, 38, 0.04);
  --shadow-md: 0 10px 30px rgba(20, 28, 38, 0.09);
  --shadow-lg: 0 20px 60px rgba(20, 28, 38, 0.16);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --titleFont: "Schibsted Grotesk", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --headerFont: "Schibsted Grotesk", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bodyFont: "Source Sans 3", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --codeFont: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[saved-theme="dark"] {
  --light: #141416;
  --lightgray: #29292f;
  --gray: #86868f;
  --darkgray: #cfd0d6;
  --dark: #f2f2f5;
  --secondary: #7d9db2;
  --tertiary: #84aba2;
  --highlight: #8f9fa920;
  --textHighlight: #b3aa0288;
  --surface: #1b1b1f;
  --surface-subtle: #18181c;
  --hairline: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.44);
  --shadow-lg: 0 24px 68px rgba(0, 0, 0, 0.62);
}

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

html {
  scroll-behavior: smooth;
  text-size-adjust: none;
  background-color: var(--light);
}

:root.theme-transition,
:root.theme-transition body,
:root.theme-transition .project-item,
:root.theme-transition .stack-grid,
:root.theme-transition .contact-chip,
:root.theme-transition .repo-meta-grid,
:root.theme-transition .graph-outer,
:root.theme-transition .search-button,
:root.theme-transition .note-popover,
:root.theme-transition code {
  transition: background-color 240ms var(--ease-out), color 200ms var(--ease-out), border-color 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

body {
  margin: 0;
  background-color: var(--light);
  background-image: radial-gradient(ellipse 70% 340px at 50% -110px, color-mix(in srgb, var(--secondary) 8%, transparent), transparent 72%);
  background-repeat: no-repeat;
  color: var(--darkgray);
  font-family: var(--bodyFont);
  font-size: 16px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: color-mix(in srgb, var(--secondary) 28%, transparent);
  color: var(--dark);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--gray) 30%, transparent);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--gray) 52%, transparent);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 1000;
  pointer-events: none;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--secondary), var(--tertiary));
  opacity: 0.92;
  will-change: transform;
}

a {
  color: var(--secondary);
  font-weight: 600;
  text-decoration: none;
  transition: color 180ms var(--ease-out), background-color 180ms var(--ease-out), transform 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

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

a.internal {
  background-color: var(--highlight);
  border-radius: 5px;
  padding: 0.06rem 0.36rem;
  line-height: 1.4rem;
  border: 1px solid transparent;
}

a.internal:hover {
  background-color: color-mix(in srgb, var(--secondary) 16%, transparent);
  border-color: color-mix(in srgb, var(--secondary) 28%, transparent);
}

a.internal.tag-link::before {
  content: "#";
  opacity: 0.68;
  margin-right: 0.04rem;
}

code {
  font-family: var(--codeFont);
  font-size: 0.84em;
  color: var(--dark);
  background-color: color-mix(in srgb, var(--lightgray) 68%, transparent);
  border: 1px solid color-mix(in srgb, var(--lightgray) 92%, transparent);
  border-radius: 4px;
  padding: 0.07rem 0.3rem;
}

pre {
  font-family: var(--codeFont);
  font-size: 0.85rem;
  line-height: 1.55;
  border: 1px solid var(--lightgray);
  border-radius: 7px;
  padding: 0.9rem 1.05rem;
  overflow-x: auto;
  background-color: var(--surface);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

h1, h2, h3, h4 {
  font-family: var(--headerFont);
  color: var(--dark);
  font-weight: 700;
  line-height: 1.26;
}

@keyframes quartzFadeUp {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes quartzFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes iconSpin {
  from {
    transform: rotate(-35deg) scale(0.82);
    opacity: 0.6;
  }
  to {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

.page > #quartz-body {
  display: grid;
  grid-template:
    "grid-sidebar-left grid-center grid-sidebar-right" / 305px minmax(0, 1fr) 305px;
  max-width: 1480px;
  margin: 0 auto;
  min-height: 100vh;
}

:root[reader-mode="on"] .page > #quartz-body {
  grid-template: "grid-center" / minmax(0, 1fr);
}

:root[reader-mode="on"] .sidebar {
  display: none !important;
}

.reader-exit-bar {
  display: none;
  margin-bottom: 1rem;
}

:root[reader-mode="on"] .reader-exit-bar {
  display: block;
  animation: quartzFadeIn 220ms var(--ease-out);
}

.reader-exit-btn {
  background: var(--surface);
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  color: var(--darkgray);
  font-family: var(--bodyFont);
  font-size: 0.85rem;
  padding: 0.34rem 0.78rem;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.reader-exit-btn:hover {
  border-color: var(--secondary);
  color: var(--dark);
  background-color: var(--highlight);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 4.75rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  animation: quartzFadeIn 340ms var(--ease-out);
}

.sidebar.left {
  grid-area: grid-sidebar-left;
  border-right: 1px solid var(--hairline);
}

.sidebar.right {
  grid-area: grid-sidebar-right;
  border-left: 1px solid var(--hairline);
}

.left-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--dark);
  min-width: 0;
}

.brand-lockup:hover .page-title {
  color: var(--secondary);
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--lightgray);
  flex-shrink: 0;
  transition: border-color 180ms ease, transform 200ms var(--ease-out);
}

.brand-lockup:hover .brand-avatar {
  border-color: var(--secondary);
  transform: scale(1.04);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  font-family: var(--titleFont);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--dark);
  transition: color 180ms ease;
}

.brand-handle {
  font-family: var(--codeFont);
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--gray);
  line-height: 1.25;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.search-button {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.15rem;
  padding: 0 0.6rem;
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--gray);
  font-family: var(--bodyFont);
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.search-button:hover {
  border-color: color-mix(in srgb, var(--secondary) 55%, var(--lightgray));
  color: var(--dark);
}

.search-button kbd {
  margin-left: auto;
  font-family: var(--codeFont);
  font-size: 0.66rem;
  color: var(--gray);
  border: 1px solid var(--lightgray);
  border-radius: 4px;
  padding: 0.05rem 0.32rem;
  background-color: var(--surface-subtle);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--darkgray);
  cursor: pointer;
  padding: 0;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms var(--ease-out), transform 140ms var(--ease-out);
}

.icon-button.mobile-explorer-btn {
  display: none;
}

.icon-button:hover {
  background-color: var(--surface);
  border-color: var(--lightgray);
  color: var(--dark);
}

.icon-button:active {
  transform: scale(0.93);
}

.icon-button.spin svg {
  animation: iconSpin 280ms var(--ease-out);
}

:root[saved-theme="light"] .darkmode .sun-icon,
:root:not([saved-theme="dark"]) .darkmode .sun-icon {
  display: none;
}

:root[saved-theme="dark"] .darkmode .moon-icon {
  display: none;
}

.explorer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.explorer-title-btn {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 0.45rem;
  font-family: var(--headerFont);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  cursor: pointer;
  transition: color 160ms ease;
}

.explorer-title-btn:hover {
  color: var(--dark);
}

.explorer.collapsed .explorer-content {
  display: none;
}

.explorer.collapsed .explorer-title-btn .chevron {
  transform: rotate(-90deg);
}

.chevron {
  transition: transform 220ms var(--ease-out);
  flex-shrink: 0;
  opacity: 0.72;
}

.explorer-content {
  overflow-y: auto;
  padding-right: 0.2rem;
}

.explorer-ul,
.folder-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-outer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 240ms var(--ease-out), opacity 180ms ease;
}

.folder-outer > .folder-ul {
  overflow: hidden;
}

.folder.open > .folder-outer {
  grid-template-rows: 1fr;
  opacity: 1;
}

.folder-ul {
  padding-left: 0.82rem;
  margin-left: 0.38rem;
  border-left: 1px solid var(--lightgray);
}

.folder:not(.open) > .folder-toggle .chevron {
  transform: rotate(-90deg);
}

.folder-toggle {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.3rem 0.25rem;
  margin-top: 0.18rem;
  font-family: var(--bodyFont);
  font-size: 0.89rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  text-align: left;
  border-radius: 5px;
  transition: color 160ms ease, background-color 160ms ease;
}

.folder-toggle:hover {
  color: var(--secondary);
  background-color: color-mix(in srgb, var(--highlight) 60%, transparent);
}

.folder-label {
  flex: 1;
  min-width: 0;
}

.folder-count {
  font-family: var(--codeFont);
  font-size: 0.7rem;
  color: var(--gray);
  opacity: 0.8;
}

.explorer-link {
  display: block;
  padding: 0.25rem 0.55rem;
  margin: 0.08rem 0;
  border-radius: 5px;
  font-size: 0.87rem;
  font-weight: 400;
  color: var(--darkgray);
  overflow-wrap: anywhere;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.explorer-link:hover {
  color: var(--dark);
  background-color: var(--highlight);
  transform: translateX(2px);
}

.explorer-link.active {
  color: var(--secondary);
  font-weight: 600;
  background-color: var(--highlight);
  box-shadow: inset 2px 0 0 var(--secondary);
}

.center {
  grid-area: grid-center;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 4.75rem 2.75rem 3.5rem;
}

.center.note-entering .page-header {
  animation: quartzFadeUp 250ms var(--ease-out) both;
}

.center.note-entering article > * {
  animation: quartzFadeUp 290ms var(--ease-out) both;
}

.center.note-entering article > *:nth-child(2) { animation-delay: 26ms; }
.center.note-entering article > *:nth-child(3) { animation-delay: 50ms; }
.center.note-entering article > *:nth-child(4) { animation-delay: 72ms; }
.center.note-entering article > *:nth-child(5) { animation-delay: 94ms; }
.center.note-entering article > *:nth-child(n+6) { animation-delay: 112ms; }

.page-header {
  margin-bottom: 1.45rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--gray);
  margin-bottom: 0.55rem;
}

.breadcrumbs a {
  color: var(--gray);
  font-weight: 400;
}

.breadcrumbs a:hover {
  color: var(--secondary);
}

.article-title {
  margin: 0 0 0.42rem;
  font-size: 2.22rem;
  letter-spacing: -0.028em;
}

.content-meta {
  margin: 0 0 0.85rem;
  font-family: var(--codeFont);
  font-size: 0.78rem;
  color: var(--gray);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tags li a {
  display: inline-block;
  font-family: var(--codeFont);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.14rem 0.5rem;
}

.tags li a:hover {
  transform: translateY(-1px);
}

.lead-intro {
  font-size: 1.07rem;
  line-height: 1.7;
  color: var(--dark);
  margin: 0 0 1.25rem;
}

.contact-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.3rem;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.68rem;
  border-radius: 6px;
  border: 1px solid var(--lightgray);
  background-color: var(--surface);
  color: var(--darkgray);
  font-family: var(--bodyFont);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 160ms var(--ease-out), background-color 180ms var(--ease-out);
}

.contact-chip:hover {
  border-color: color-mix(in srgb, var(--secondary) 55%, var(--lightgray));
  color: var(--dark);
  transform: translateY(-1px);
}

.contact-chip svg {
  color: var(--secondary);
  flex-shrink: 0;
}

.contact-chip.copied {
  border-color: var(--tertiary);
  color: var(--tertiary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem;
  margin: 0 0 1.25rem;
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  background-color: var(--surface-subtle);
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.68rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--gray);
  font-family: var(--bodyFont);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.filter-tab:hover {
  color: var(--dark);
}

.filter-tab.active {
  background-color: var(--surface);
  color: var(--dark);
  border-color: var(--lightgray);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  font-family: var(--codeFont);
  font-size: 0.7rem;
  color: var(--gray);
}

.filter-tab.active .tab-count {
  color: var(--secondary);
}

.project-group.hidden-group {
  display: none;
}

.project-list {
  list-style: none;
  margin: 0 0 1.4rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
}

.project-item {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 190ms var(--ease-out), transform 190ms var(--ease-out), box-shadow 190ms var(--ease-out);
}

.project-item:hover {
  border-color: color-mix(in srgb, var(--secondary) 52%, var(--lightgray));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.38rem;
}

.project-name {
  font-family: var(--headerFont);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.project-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.project-lang {
  font-family: var(--codeFont);
  font-size: 0.72rem;
  color: var(--gray);
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray);
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.ext-link:hover {
  color: var(--secondary);
  border-color: var(--lightgray);
  background-color: var(--surface-subtle);
}

.ext-link svg {
  transition: transform 160ms var(--ease-out);
}

.ext-link:hover svg {
  transform: translate(1px, -1px);
}

.project-desc {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.56;
  color: var(--darkgray);
}

.stack-grid {
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  background-color: var(--surface);
  overflow: hidden;
  margin: 0 0 1.4rem;
  box-shadow: var(--shadow-sm);
}

.stack-row {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.75rem 1rem;
}

.stack-row + .stack-row {
  border-top: 1px solid var(--lightgray);
}

.stack-key {
  font-family: var(--codeFont);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
}

.stack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.stack-pills code {
  font-size: 0.78rem;
  padding: 0.12rem 0.44rem;
}

article p {
  margin: 0 0 1rem;
}

article h2 {
  font-size: 1.24rem;
  letter-spacing: -0.015em;
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--lightgray);
  scroll-margin-top: 2rem;
}

article h3 {
  font-size: 1.04rem;
  margin: 1.4rem 0 0.48rem;
  scroll-margin-top: 2rem;
}

article ul:not(.project-list) {
  margin: 0 0 1.15rem;
  padding-left: 1.25rem;
}

article ul:not(.project-list) li {
  margin-bottom: 0.5rem;
}

.contact-list {
  list-style: none !important;
  padding-left: 0 !important;
}

.contact-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--hairline);
}

.contact-list li:last-child {
  border-bottom: none;
}

.repo-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin: 1.15rem 0 1.5rem;
  padding: 0.9rem 1.05rem;
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.repo-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.repo-meta-label {
  font-family: var(--codeFont);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
}

.repo-meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
}

.repo-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.45rem 0 0.5rem;
}

.repo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.46rem 0.98rem;
  border-radius: 6px;
  border: 1px solid var(--secondary);
  background-color: var(--secondary);
  color: var(--light);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 180ms var(--ease-out), color 180ms var(--ease-out);
}

.repo-btn:hover {
  background-color: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.repo-btn:active {
  transform: translateY(0);
}

.repo-btn.secondary-btn {
  background-color: var(--surface);
  border-color: var(--lightgray);
  color: var(--darkgray);
}

.repo-btn.secondary-btn:hover {
  border-color: var(--secondary);
  color: var(--dark);
}

.note-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 2.25rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--lightgray);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--lightgray);
  border-radius: 7px;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.pager-link:hover {
  border-color: var(--secondary);
  transform: translateY(-1px);
}

.pager-link.next {
  text-align: right;
  grid-column: 2;
}

.pager-dir {
  font-family: var(--codeFont);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
}

.pager-title {
  font-family: var(--headerFont);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--dark);
}

.site-footer {
  margin-top: 3.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--lightgray);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  font-weight: 500;
  color: var(--gray);
}

.site-footer a:hover {
  color: var(--secondary);
}

.graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.graph h3,
.toc h3,
.backlinks h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
}

.graph-expand-btn {
  width: 1.7rem;
  height: 1.7rem;
}

.graph-outer {
  position: relative;
  height: 242px;
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--gray) 26%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.graph-outer:hover {
  border-color: color-mix(in srgb, var(--secondary) 48%, var(--lightgray));
  box-shadow: var(--shadow-md);
}

.graph-legend {
  position: absolute;
  left: 8px;
  bottom: 7px;
  display: flex;
  gap: 0.6rem;
  padding: 0.14rem 0.45rem;
  border-radius: 4px;
  background-color: color-mix(in srgb, var(--surface) 84%, transparent);
  font-family: var(--codeFont);
  font-size: 0.66rem;
  color: var(--gray);
  pointer-events: none;
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.graph-legend .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.graph-legend .dot-active {
  background-color: var(--tertiary);
}

.graph-legend .dot-hub {
  background-color: var(--secondary);
}

#graph-canvas,
#global-graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#graph-canvas:active,
#global-graph-canvas:active {
  cursor: grabbing;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 0.5rem;
  cursor: pointer;
  color: var(--gray);
}

.toc-header:hover h3 {
  color: var(--dark);
}

.toc.collapsed .toc-content {
  display: none;
}

.toc.collapsed .toc-header .chevron {
  transform: rotate(-90deg);
}

.toc-content {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--lightgray);
}

.toc-content li {
  margin: 0.14rem 0;
}

.toc-content li.depth-3 a {
  padding-left: 1.35rem;
}

.toc-content a {
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--gray);
  display: block;
  line-height: 1.4;
  padding: 0.18rem 0 0.18rem 0.78rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.toc-content a:hover {
  color: var(--dark);
  border-left-color: color-mix(in srgb, var(--secondary) 45%, transparent);
}

.toc-content a.in-view {
  color: var(--secondary);
  font-weight: 600;
  border-left-color: var(--secondary);
}

.backlinks h3 {
  margin-bottom: 0.5rem;
}

.backlinks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}

.backlinks li {
  margin: 0;
}

.backlinks a {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.14rem 0.48rem;
}

.note-popover {
  position: fixed;
  z-index: 950;
  width: 326px;
  max-width: calc(100vw - 24px);
  padding: 0.9rem 1.02rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--secondary) 32%, var(--lightgray));
  background-color: color-mix(in srgb, var(--surface) 95%, var(--light));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.98);
  transition: opacity 160ms var(--ease-out), transform 180ms var(--ease-out), visibility 160ms ease;
}

.note-popover.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.note-popover h4 {
  margin: 0 0 0.2rem;
  font-size: 0.96rem;
  color: var(--dark);
}

.note-popover .popover-meta {
  font-family: var(--codeFont);
  font-size: 0.72rem;
  color: var(--gray);
  margin: 0 0 0.48rem;
}

.note-popover .popover-summary {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--darkgray);
  margin: 0 0 0.58rem;
}

.note-popover .popover-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.note-popover .popover-tag {
  font-family: var(--codeFont);
  font-size: 0.7rem;
  color: var(--secondary);
  background-color: var(--highlight);
  padding: 0.06rem 0.36rem;
  border-radius: 4px;
  font-weight: 500;
}

.search-container {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background-color: rgba(10, 12, 16, 0.44);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10vh 1rem 2rem;
  transition: opacity 180ms var(--ease-out), visibility 180ms ease;
}

.search-container.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-space {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transform: translateY(-10px) scale(0.98);
  transition: transform 220ms var(--ease-out);
}

.search-container.active .search-space {
  transform: translateY(0) scale(1);
}

.search-input-wrap input {
  width: 100%;
  padding: 0.74rem 1.05rem;
  font-family: var(--bodyFont);
  font-size: 1.02rem;
  color: var(--dark);
  background-color: var(--surface);
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  transition: border-color 160ms ease;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--secondary);
}

.search-body {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  height: 58vh;
  background-color: var(--surface);
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.search-results {
  overflow-y: auto;
  border-right: 1px solid var(--lightgray);
  padding: 0.45rem;
}

.search-result-card {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0.58rem 0.72rem;
  cursor: pointer;
  color: var(--darkgray);
  font-family: var(--bodyFont);
  transition: background-color 140ms ease;
}

.search-result-card:hover,
.search-result-card.focused {
  background-color: var(--highlight);
}

.search-result-card.focused {
  box-shadow: inset 2px 0 0 var(--secondary);
}

.search-result-card h4 {
  margin: 0 0 0.16rem;
  font-size: 0.93rem;
  color: var(--dark);
}

.search-result-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gray);
  line-height: 1.38;
}

.search-preview {
  overflow-y: auto;
  padding: 1.15rem 1.45rem;
  font-size: 0.92rem;
}

.search-preview h3 {
  margin: 0 0 0.45rem;
  font-size: 1.18rem;
}

.search-preview mark {
  background-color: var(--textHighlight);
  color: var(--dark);
  border-radius: 3px;
  padding: 0 0.12rem;
}

.global-graph-container {
  position: fixed;
  inset: 0;
  z-index: 998;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background-color: rgba(10, 12, 16, 0.54);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5vh 4vw;
  transition: opacity 200ms var(--ease-out), visibility 200ms ease;
}

.global-graph-container.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.global-graph-outer {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: var(--surface);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 240ms var(--ease-out);
}

.global-graph-container.active .global-graph-outer {
  transform: scale(1);
}

.global-graph-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.05rem;
  border-bottom: 1px solid var(--lightgray);
  font-family: var(--codeFont);
  font-size: 0.78rem;
  color: var(--gray);
  flex-shrink: 0;
}

.global-graph-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--gray) 22%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}

@media (max-width: 1220px) and (min-width: 801px) {
  .page > #quartz-body {
    grid-template:
      "grid-sidebar-left grid-center"
      "grid-sidebar-left grid-sidebar-right" / 285px minmax(0, 1fr);
  }

  .sidebar.right {
    position: static;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding: 1.75rem 2.25rem 2.5rem;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar.right > .graph,
  .sidebar.right > .backlinks {
    flex: 1 1 260px;
  }

  .sidebar.right > .toc {
    display: none;
  }
}

@media (max-width: 800px) {
  .page > #quartz-body {
    grid-template:
      "grid-sidebar-left"
      "grid-center"
      "grid-sidebar-right" / minmax(0, 1fr);
    padding: 0 1rem;
  }

  .sidebar.left {
    position: static;
    height: auto;
    border-right: none;
    padding: 1.25rem 0 0.5rem;
    gap: 0.75rem;
    overflow: visible;
  }

  .icon-button.mobile-explorer-btn {
    display: inline-flex;
  }

  .explorer {
    display: none;
    border: 1px solid var(--lightgray);
    border-radius: 8px;
    padding: 0.75rem;
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .explorer.mobile-open {
    display: flex;
    animation: quartzFadeUp 200ms var(--ease-out);
  }

  .center {
    padding: 1.35rem 0 2rem;
  }

  .article-title {
    font-size: 1.82rem;
  }

  .stack-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .note-pager {
    grid-template-columns: 1fr;
  }

  .pager-link.next {
    grid-column: 1;
    text-align: left;
  }

  .sidebar.right {
    position: static;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding: 1.5rem 0 2.5rem;
  }

  .sidebar.right > .toc {
    display: none;
  }

  .search-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-preview {
    display: none;
  }

  .note-popover {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
