@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/roboto-mono-cyrillic.6f1e779fee12.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/roboto-mono-latin.7e38134bbe04.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --background: 240 8% 5%;
  --foreground: 42 18% 91%;
  --secondary: 240 6% 11%;
  --muted-foreground: 240 4% 55%;
  --accent: 230 100% 67%;
  --border: 240 8% 12%;
  --hairline: 240 8% 12%;
  --container: 1200px;
  --font-primary: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-micro: 0.875rem;
  --fs-small: 1.0625rem;
  --fs-body: 1.1875rem;
  --fs-body-lg: 1.3125rem;
  --fs-lead: 2.125rem;
  --fs-section-title: 3.375rem;
  --fs-page-title: 4.5rem;
  --fs-hero-title: 5.25rem;
  --text-measure: 56rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: 45 25% 96%;
  --foreground: 240 7% 5%;
  --secondary: 45 18% 92%;
  --muted-foreground: 0 0% 42%;
  --accent: 230 100% 62%;
  --border: 42 15% 86%;
  --hairline: 42 15% 86%;
}

:root.dark {
  color-scheme: dark;
  --background: 240 8% 5%;
  --foreground: 42 18% 91%;
  --secondary: 240 6% 11%;
  --muted-foreground: 240 4% 55%;
  --accent: 230 100% 67%;
  --border: 240 8% 12%;
  --hairline: 240 8% 12%;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --background: 45 25% 96%;
    --foreground: 240 7% 5%;
    --secondary: 45 18% 92%;
    --muted-foreground: 0 0% 42%;
    --accent: 230 100% 62%;
    --border: 42 15% 86%;
    --hairline: 42 15% 86%;
  }
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-primary);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "ss01", "cv11";
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: radial-gradient(hsl(var(--foreground) / 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

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

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: hsl(var(--accent) / 0.25);
  color: hsl(var(--foreground));
}

:focus {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 3px;
}

@supports selector(:focus-visible) {
  :focus:not(:focus-visible) { outline: none; }
  :focus-visible {
    outline: 2px solid hsl(var(--accent));
    outline-offset: 3px;
  }
}

.site {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.container {
  width: min(100% - 3rem, var(--container));
  margin-inline: auto;
}

.font-mono { font-family: var(--font-primary); }
.accent { color: hsl(var(--accent)); }
.muted { color: hsl(var(--muted-foreground)); }
.hairline { border-color: hsl(var(--hairline)); }
.strong { font-weight: 600; color: hsl(var(--foreground)); }

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.65rem 0.8rem;
  transform: translateY(-180%);
  border: 1px solid hsl(var(--hairline));
  background: hsl(var(--background));
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid hsl(var(--hairline));
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(10px);
}

.topbar {
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a,
.footer a,
.link-underline {
  position: relative;
  display: inline-block;
}

.nav a,
.footer a {
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  transition: color 180ms ease;
}

.footer a {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.nav a:hover,
.nav a[aria-current="page"],
.footer a:hover,
.link-underline:hover,
.link-underline[aria-current="page"] {
  color: hsl(var(--foreground));
}

.nav a::after,
.footer a::after,
.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: hsl(var(--accent));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 280ms ease;
}

.nav a:hover::after,
.nav a[aria-current="page"]::after,
.footer a:hover::after,
.link-underline:hover::after,
.link-underline[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left center;
}

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

.lang {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
}

.lang a { color: hsl(var(--muted-foreground)); }
.lang a[aria-current="true"], .lang a:hover { color: hsl(var(--foreground)); }

.theme-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: hsl(var(--muted-foreground));
}

.theme-toggle:hover { color: hsl(var(--foreground)); }
.theme-toggle .theme-icon {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

.theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.625rem);
  z-index: 60;
  width: min(15rem, calc(100vw - 2rem));
  padding: 0.375rem;
  border: 1px solid hsl(var(--hairline));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.theme-menu[hidden] { display: none; }

.theme-option {
  width: 100%;
  min-height: 2.75rem;
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) 1.25rem;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  padding: 0.5rem 0.625rem;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.4;
  text-align: left;
}

.theme-option:hover,
.theme-option:focus,
.theme-option[aria-checked="true"] {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

.theme-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.theme-option-label { min-width: 0; }

.theme-option-check {
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}

.theme-option[aria-checked="true"] .theme-option-check { visibility: visible; }
.theme-check { width: 1rem; height: 1rem; }

.theme-option:focus {
  outline-offset: -2px;
}

.reading-progress {
  position: fixed;
  left: 0;
  top: 3.56rem;
  z-index: 45;
  width: 100%;
  height: 1px;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: hsl(var(--accent));
}

.reading-progress::-webkit-progress-bar { background: transparent; }
.reading-progress::-webkit-progress-value { background: hsl(var(--accent)); }
.reading-progress::-moz-progress-bar { background: hsl(var(--accent)); }

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

.section-number {
  grid-column: span 1;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: hsl(var(--muted-foreground));
}

.section-body { grid-column: span 11; }

.section {
  padding-block: 6rem;
  border-top: 1px solid hsl(var(--hairline));
  scroll-margin-top: 5.5rem;
}

.hero {
  padding-block: 6rem 8rem;
  scroll-margin-top: 5.5rem;
}

.label {
  margin: 0 0 2rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--muted-foreground));
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.avatar {
  width: clamp(6rem, 12vw, 11rem);
  height: clamp(6rem, 12vw, 11rem);
  flex: 0 0 auto;
}

.dark .avatar { filter: invert(1); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .avatar { filter: invert(1); }
}

h1, h2, h3, h4, p { margin: 0; }

.hero h1,
.page-title,
.section-title,
.note-title {
  font-family: var(--font-primary);
  font-weight: 700;
  letter-spacing: 0;
  color: hsl(var(--foreground));
}

.hero h1,
.page-title,
.section-title,
.note-title {
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.hero h1,
.page-title {
  line-height: 0.95;
}

.hero h1 { font-size: var(--fs-hero-title); }
.page-title { font-size: var(--fs-page-title); }

.section-title {
  max-width: var(--text-measure);
  font-size: var(--fs-section-title);
  line-height: 1.08;
}

.lead {
  max-width: var(--text-measure);
  font-size: var(--fs-lead);
  line-height: 1.22;
  color: hsl(var(--foreground));
}

.work-lead {
  font-size: calc(var(--fs-lead) * 0.9);
}

.copy-lg {
  max-width: var(--text-measure);
  font-size: var(--fs-body-lg);
  line-height: 1.7;
}

.copy {
  max-width: var(--text-measure);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: hsl(var(--muted-foreground));
}

.mono-copy {
  max-width: var(--text-measure);
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  line-height: 1.7;
}

.system-comment {
  max-width: var(--text-measure);
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

.copy,
.copy-lg,
.mono-copy,
.system-comment,
.accordion-content {
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: pretty;
}

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mt-20 { margin-top: 5rem; }

.terminal {
  display: inline-block;
  position: relative;
  border: 1px solid hsl(var(--hairline));
  padding: 1rem 1.25rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.6;
}

.terminal::before,
.terminal::after {
  content: "+";
  position: absolute;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1;
  color: hsl(var(--muted-foreground));
}

.terminal::before { top: -6px; left: -6px; }
.terminal::after { right: -6px; bottom: -6px; }

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

.work-list {
  max-width: var(--text-measure);
  border-bottom: 1px solid hsl(var(--hairline));
}

.accordion-item {
  --accordion-index-width: 1.125rem;
  --accordion-gap: clamp(1rem, 3vw, 2rem);
  border-top: 1px solid hsl(var(--hairline));
}

.accordion-heading {
  min-width: 0;
  margin: 0;
}

.accordion-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: var(--accordion-index-width) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--accordion-gap);
  border: 0;
  padding: clamp(1.5rem, 3vw, 2rem) 0;
  cursor: pointer;
  background: transparent;
  text-align: left;
}

.accordion-trigger:disabled { cursor: default; }

.accordion-index {
  width: var(--accordion-index-width);
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.accordion-title {
  min-width: 0;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.75;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.accordion-title span { color: hsl(var(--muted-foreground)); }
.accordion-plus {
  font-family: var(--font-primary);
  font-size: var(--fs-body-lg);
  color: hsl(var(--muted-foreground));
  transition: transform 300ms ease, color 180ms ease;
}

.accordion-trigger:hover .accordion-plus { color: hsl(var(--accent)); }
.accordion-trigger[aria-expanded="true"] .accordion-plus { transform: rotate(45deg); }

.accordion-panel {
  display: block;
}

.accordion-panel > div {
  overflow: visible;
}

.accordion-content {
  max-width: var(--text-measure);
  padding: 0 0 2rem calc(var(--accordion-index-width) + var(--accordion-gap));
  color: hsl(var(--muted-foreground));
  font-size: var(--fs-small);
  line-height: 1.75;
}

.signals {
  max-width: var(--text-measure);
  border-top: 1px solid hsl(var(--hairline));
  font-family: var(--font-primary);
  font-size: var(--fs-small);
}

.signal-row {
  display: grid;
  grid-template-columns: minmax(13rem, 0.72fr) minmax(0, 1.28fr);
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid hsl(var(--hairline));
}

.signal-row dt {
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: hsl(var(--muted-foreground));
}

.signal-row dd {
  margin: 0;
  color: hsl(var(--foreground));
}

.thinking-header {
  padding-block: 6rem 4rem;
}

.note {
  padding-block: 2.5rem;
  border-bottom: 1px solid hsl(var(--hairline));
  scroll-margin-top: 5.5rem;
}

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

.note-code {
  grid-column: span 1;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: hsl(var(--muted-foreground));
}

.note-main {
  grid-column: span 11;
  max-width: var(--text-measure);
}

.note .accordion-trigger {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-top: 0;
}

.note .accordion-trigger > span:first-child {
  display: none;
}

.note-title {
  font-size: var(--fs-lead);
  line-height: 1.15;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--muted-foreground));
}

.note-caption {
  text-transform: none;
  letter-spacing: normal;
}

.sub-outline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 2.5rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  color: hsl(var(--muted-foreground));
}

.note-sections {
  display: grid;
  gap: 2.5rem;
  max-width: var(--text-measure);
}

.note-section {
  scroll-margin-top: 5.5rem;
}

.note-section h4 {
  margin-bottom: 1rem;
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--muted-foreground));
}

.note-section p + p { margin-top: 1rem; }

.footer {
  margin-top: 3rem;
  padding-block: 2rem;
  border-top: 1px solid hsl(var(--hairline));
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-primary);
  font-size: var(--fs-micro);
  color: hsl(var(--muted-foreground));
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.caret::after {
  content: "|";
  display: inline-block;
  margin-left: 0.15em;
  color: hsl(var(--accent));
  animation: blink 1.05s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .caret::after { animation: none; }
  .accordion-plus,
  .nav a,
  .footer a,
  .link-underline {
    transition: none;
  }
}

@media (prefers-contrast: more) {
  .site-header {
    background: hsl(var(--background));
    backdrop-filter: none;
  }
  .system-comment,
  .accordion-title span,
  .muted { color: hsl(var(--foreground)); }
}

@media (forced-colors: active) {
  body::before { display: none; }
  .site-header {
    background: Canvas;
    backdrop-filter: none;
  }
  .theme-menu {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
  }
  .theme-option[aria-checked="true"] .theme-option-check { color: Highlight; }
  .avatar {
    forced-color-adjust: none;
    filter: none;
    border: 1px solid CanvasText;
  }
  .reading-progress {
    forced-color-adjust: none;
    color: Highlight;
  }
  .reading-progress::-webkit-progress-value { background: Highlight; }
  .reading-progress::-moz-progress-bar { background: Highlight; }
  a { text-decoration: underline; }
  :focus { outline: 2px solid Highlight; }
  @supports selector(:focus-visible) {
    :focus:not(:focus-visible) { outline: none; }
    :focus-visible { outline: 2px solid Highlight; }
  }
}

@media (forced-colors: active) and (prefers-color-scheme: dark) {
  .avatar { filter: invert(1); }
}

@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: hsl(var(--background)); }
}

pre,
code {
  font-family: var(--font-primary);
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
}

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

@media (max-width: 820px) {
  :root {
    --fs-micro: 0.8125rem;
    --fs-small: 1rem;
    --fs-body: 1.125rem;
    --fs-body-lg: 1.25rem;
    --fs-lead: 1.8125rem;
    --fs-section-title: 3rem;
    --fs-page-title: 3.75rem;
    --fs-hero-title: 4.125rem;
  }
  .container { width: min(100% - 2rem, var(--container)); }
  .topbar {
    height: 3.5rem;
    min-height: 3.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
  }
  .brand {
    display: none;
  }
  .controls {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    min-height: 3.5rem;
  }
  .nav {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a {
    flex: 0 0 auto;
    line-height: 1.2;
  }
  .reading-progress {
    top: 3.56rem;
  }
  .grid-section,
  .note-grid {
    display: block;
  }
  .section-number,
  .note-code {
    display: none;
  }
  .section {
    padding-block: 5rem;
  }
  .hero {
    padding-block: 5rem 6rem;
  }
  .hero-title-row {
    align-items: flex-start;
    gap: 1.25rem;
  }
  .note .accordion-trigger > span:nth-child(2) {
    min-width: 0;
  }
  .note-meta {
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
    letter-spacing: 0.14em;
  }
  .note-meta .accent {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .note-meta > span:nth-child(2) {
    display: none;
  }
  .note-caption {
    flex: 1 1 10rem;
    min-width: 10rem;
  }
  .terminal-grid,
  .signal-row {
    grid-template-columns: 1fr;
  }
  .signal-row dt,
  .signal-row dd {
    grid-column: auto;
  }
  .footer .container {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  :root {
    --fs-lead: 1.5625rem;
    --fs-section-title: 2.5rem;
    --fs-page-title: 3rem;
    --fs-hero-title: 3.375rem;
  }
  .hero-title-row {
    flex-direction: column;
  }
  .controls {
    gap: 0.7rem;
  }
}

@media print {
  :root,
  :root.dark,
  :root[data-theme],
  :root:not([data-theme]) {
    color-scheme: light;
    --background: 0 0% 100%;
    --foreground: 0 0% 0%;
    --secondary: 0 0% 100%;
    --muted-foreground: 0 0% 20%;
    --accent: 0 0% 0%;
    --border: 0 0% 70%;
    --hairline: 0 0% 70%;
  }
  .site-header,
  .reading-progress,
  .theme-picker,
  .skip-link,
  body::before,
  .caret::after { display: none !important; }
  .site,
  body { background: #fff; color: #000; }
  .avatar { filter: none !important; }
  .accordion-panel[hidden] { display: block !important; }
  a { color: #000; text-decoration: underline; }
}
