@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;700&family=Geist+Mono:wght@400;500;700&display=swap");

:root {
  color-scheme: dark;
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --text: #cdd6f4;
  --subtext1: #bac2de;
  --subtext0: #a6adc8;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --overlay2: #9399b2;
  --blue: #89b4fa;
  --lavender: #b4befe;
  --sapphire: #74c7ec;
  --sky: #89dceb;
  --teal: #94e2d5;
  --green: #a6e3a1;
  --yellow: #f9e2af;
  --peach: #fab387;
  --maroon: #eba0ac;
  --red: #f38ba8;
  --mauve: #cba6f7;
  --pink: #f5c2e7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Geist Mono", "Geist", "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
  background-color: var(--base);
  background-image:
    radial-gradient(circle at top left, rgba(137, 180, 250, 0.08), transparent 55%),
    radial-gradient(circle at 30% 20%, rgba(148, 226, 213, 0.08), transparent 50%),
    radial-gradient(circle at 70% 10%, rgba(203, 166, 247, 0.08), transparent 50%),
    linear-gradient(180deg, rgba(17, 17, 27, 0.6) 0%, rgba(30, 30, 46, 0.9) 40%, rgba(24, 24, 37, 0.95) 100%);
  color: var(--text);
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.1px;
}

#automata {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.35;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 48px auto;
  padding: 48px 44px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 260px;
  gap: 42px;
  align-items: start;
}

.research-sidebar {
  position: sticky;
  top: 38px;
}

.lab-card {
  border: 1px solid rgba(88, 91, 112, 0.55);
  background: rgba(24, 24, 37, 0.58);
  border-radius: 12px;
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lab-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--sapphire);
  letter-spacing: 0.15px;
}

.lab-note {
  margin: 0 0 11px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--overlay2);
}

.lab-note code {
  color: var(--sky);
  background: rgba(17, 17, 27, 0.75);
  border: 1px solid rgba(88, 91, 112, 0.45);
  border-radius: 6px;
  padding: 1px 4px;
}

.lab-metrics {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lab-metrics li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--subtext0);
  font-size: 0.88rem;
}

.lab-metrics li:last-child {
  margin-bottom: 0;
}

.lab-metrics li code {
  color: var(--green);
  background: rgba(17, 17, 27, 0.85);
  border: 1px solid rgba(88, 91, 112, 0.45);
  border-radius: 8px;
  padding: 2px 6px;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toc-link {
  color: var(--overlay2);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  border-left: 1px solid rgba(127, 132, 156, 0.35);
  padding-left: 9px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link-sub {
  margin-left: 10px;
  font-size: 0.82rem;
}

.toc-link.active {
  color: var(--sky);
  border-color: rgba(137, 220, 235, 0.85);
}

@media (max-width: 1080px) {
  .page {
    max-width: 900px;
    padding: 44px 34px;
  }

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

  .research-sidebar {
    display: none;
  }
}

.markdown h1,
.markdown h2,
.markdown h3 {
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  position: relative;
  margin-bottom: 16px;
}

.markdown h1 {
  font-size: 2.1rem;
  margin-top: 0;
}

.markdown h2 {
  font-size: 1.4rem;
  margin-top: 56px;
}

.markdown h3 {
  font-size: 1.15rem;
  margin-top: 36px;
  color: var(--subtext1);
}

.markdown h1::before,
.markdown h2::before,
.markdown h3::before {
  color: var(--blue);
}

.markdown h1::before {
  content: "# ";
}

.markdown h2::before {
  content: "## ";
}

.markdown h3::before {
  content: "### ";
}

.markdown p {
  margin: 0 0 18px;
  color: var(--subtext1);
}

.markdown strong,
.markdown em {
  position: relative;
  color: var(--text);
}

.markdown strong {
  font-weight: 700;
}

.markdown em {
  font-style: italic;
  color: var(--subtext0);
}

.markdown strong::before,
.markdown strong::after {
  content: "**";
  color: var(--lavender);
  font-weight: 500;
}

.markdown em::before,
.markdown em::after {
  content: "*";
  color: var(--lavender);
}

.markdown blockquote {
  margin: 18px 0 24px;
  padding-left: 22px;
  border-left: 2px solid var(--mauve);
  color: var(--subtext0);
  position: relative;
  font-size: 1.15rem;
  line-height: 1.65;
}

.markdown blockquote::before {
  content: ">";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--mauve);
}

.markdown ul,
.markdown ol {
  list-style: none;
  padding-left: 0;
  margin: 0 0 20px;
}

.markdown li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  color: var(--subtext1);
}

.markdown li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--lavender);
}

.markdown a {
  color: var(--blue);
  text-decoration: none;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.1ch;
  transition: color 0.2s ease;
}

.markdown a .md-link-bracket {
  color: var(--lavender);
  user-select: none;
}

.markdown a .md-link-label {
  color: inherit;
  user-select: none;
}

.markdown a .md-link-url {
  color: var(--overlay1);
  user-select: text;
  word-break: break-word;
}

.markdown a .md-link-paren {
  color: var(--overlay1);
  user-select: none;
}

.markdown.citation-mode a.citation-link .md-link-paren,
.markdown.citation-mode a.citation-link .md-link-url {
  display: none;
}

.markdown .md-cite {
  margin-left: 0.25ch;
  color: var(--peach);
  font-size: 0.7em;
  font-weight: 600;
  user-select: none;
}

.markdown a:hover {
  color: var(--sky);
}

.markdown a:hover .md-link-bracket {
  color: var(--sky);
}

.markdown a:hover .md-link-url {
  color: var(--overlay2);
}

.markdown a:hover .md-link-paren {
  color: var(--overlay2);
}

.markdown code {
  font-family: "Geist Mono", "Geist", "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
  background: rgba(49, 50, 68, 0.7);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--sapphire);
}

.markdown .katex {
  color: inherit;
}

.markdown hr {
  border: none;
  height: 1px;
  background: var(--surface1);
  margin: 36px 0;
}

::selection {
  background: rgba(137, 180, 250, 0.35);
  color: var(--text);
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .page {
    padding: 48px 26px;
  }

  .layout {
    display: block;
  }

  .research-sidebar {
    display: none;
  }

  .markdown h1 {
    font-size: 1.7rem;
  }

  .markdown h1::before,
  .markdown h2::before,
  .markdown h3::before,
  .markdown strong::before,
  .markdown strong::after,
  .markdown em::before,
  .markdown em::after,
  .markdown blockquote::before,
  .markdown li::before {
    content: "";
  }

  .markdown ul,
  .markdown ol {
    list-style: disc;
    padding-left: 22px;
  }

  .markdown li {
    padding-left: 0;
  }

  .markdown a {
    display: inline;
    text-decoration: underline;
  }

  .markdown a .md-link-bracket,
  .markdown a .md-link-paren,
  .markdown a .md-link-url,
  .markdown a .md-cite {
    display: none;
  }

  .markdown a .md-link-label {
    user-select: text;
  }
}
