:root {
  --bg: #171716;
  --page: #191918;
  --sidebar: #111110;
  --text: #f1f0ed;
  --muted: #b5b2aa;
  --faint: #827f78;
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.09);
  --selection: rgba(123, 179, 255, 0.24);
  --gray-bg: #2b2b28;
  --gray-bg-hover: #353530;
  --blue-bg: rgba(53, 88, 143, 0.22);
  --blue-line: #7eb2ff;
  --orange-bg: rgba(165, 103, 49, 0.24);
  --orange-line: #ffb36b;
  --cover-url: url("https://assets.science.nasa.gov/dynamicimage/assets/science/missions/webb/science/2022/07/STScI-01GA6KKWG229B16K4Q38CH3BXS.png?crop=faces%2Cfocalpoint&fit=clip&h=1200&w=2100");
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color-scheme: dark;
}

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

::-webkit-scrollbar-track {
  background: #111110;
}

::-webkit-scrollbar-thumb {
  border: 3px solid #111110;
  border-radius: 999px;
  background: #3f3f38;
}

::-webkit-scrollbar-thumb:hover {
  background: #53534a;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 64% 0%, rgba(54, 83, 128, 0.22), transparent 34rem),
    radial-gradient(circle at 0% 26rem, rgba(144, 89, 52, 0.13), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection);
}

a {
  color: inherit;
  text-decoration-color: rgba(241, 240, 237, 0.32);
  text-underline-offset: 0.14em;
}

a:hover {
  text-decoration-color: rgba(241, 240, 237, 0.86);
}

.page-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}

.notion-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 18px 16px 24px 18px;
  border-right: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 11rem),
    var(--sidebar);
  overflow-y: auto;
}

.notion-sidebar::-webkit-scrollbar-track {
  background: var(--sidebar);
}

.notion-sidebar::-webkit-scrollbar-thumb {
  border-color: var(--sidebar);
}

.notion-home {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.notion-home:hover {
  background: rgba(255, 255, 255, 0.07);
}

.notion-home-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.notion-toc {
  margin-top: 22px;
  padding-bottom: 40px;
}

.toc-label {
  margin: 0 0 8px 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toc-link {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

.toc-link:hover,
.toc-link.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.toc-link.level-3 {
  padding-left: 22px;
  font-size: 12.5px;
}

.notion-page {
  width: 100%;
  min-width: 0;
  background: var(--page);
}

.cover-image {
  width: 100%;
  height: clamp(300px, 31vw, 410px);
  background-image:
    linear-gradient(180deg, rgba(9, 10, 13, 0.06), rgba(25, 25, 24, 0.18) 58%, var(--page) 100%),
    var(--cover-url);
  background-position: center 47%;
  background-size: cover;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.page-content {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 88px 120px;
  overflow-x: clip;
  overflow-y: visible;
}

.page-header {
  margin-bottom: 42px;
}

.page-icon {
  display: inline-grid;
  width: 126px;
  height: 126px;
  margin: -68px 0 52px;
  place-items: center;
  border-radius: 24px;
  background: transparent;
  font-size: 94px;
  line-height: 1;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.45));
}

.release-date {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

#page-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 4.4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
  overflow-wrap: break-word;
  white-space: nowrap;
}

.authors {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.post h2,
.post h3,
.post h4 {
  position: relative;
  color: var(--text);
  scroll-margin-top: 32px;
}

.post h2 {
  margin: 2.05em 0 0.55em;
  padding-top: 0.2em;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.22;
}

.post h3 {
  margin: 1.7em 0 0.45em;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.post h4 {
  margin: 1.4em 0 0.35em;
  font-size: 18px;
  font-weight: 650;
}

.post p,
.post li {
  color: var(--text);
  overflow-wrap: break-word;
}

.post p {
  margin: 0.65em 0;
}

.post > p:first-of-type {
  position: relative;
  margin: 1.35em 0 1.25em;
  padding: 16px 18px 16px 56px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #f5f2ea;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.58;
}

.post > p:first-of-type::before {
  position: absolute;
  top: 17px;
  left: 18px;
  content: "💡";
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(255, 205, 84, 0.2));
}

.post strong {
  font-weight: 650;
}

.post em {
  color: #d8d3ca;
}

.post blockquote {
  margin: 1.15em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 3px solid rgba(255, 255, 255, 0.28);
  color: #d4d0c8;
}

.post ul,
.post ol {
  margin: 0.7em 0 0.9em;
  padding-left: 1.45em;
}

.post li + li {
  margin-top: 0.28em;
}

.post code {
  padding: 0.18em 0.36em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.11);
  color: #ff9d9d;
  font-family: var(--mono);
  font-size: 0.88em;
}

.post pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: 8px;
  background: #111110;
  box-shadow: inset 0 0 0 1px var(--line-soft);
  font-family: var(--mono);
  line-height: 1.5;
}

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

.post img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.2em auto 0.55em;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.image-link {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.image-link.figure-compact {
  width: min(100%, 690px);
  margin: 0 auto;
}

.image-link.figure-compact img {
  width: 100%;
  margin: 0;
}

.image-link::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(15, 15, 14, 0.72);
  color: rgba(255, 255, 255, 0.86);
  content: "open full size";
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity 140ms ease;
}

.image-link:hover::after,
.image-link:focus-visible::after {
  opacity: 1;
}

.post p:has(> img:only-child) {
  margin: 1.4em 0 0.6em;
}

.post p:has(> .image-link:only-child) {
  margin: 1.4em 0 0.6em;
}

.post iframe,
.post video {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.2em auto 0.55em;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #10100f;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.post iframe {
  min-height: 460px;
}

.post table {
  display: block;
  max-width: 100%;
  width: 100%;
  margin: 1.2em 0;
  overflow-x: auto;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}

.post th,
.post td {
  min-width: 120px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.post th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 650;
}

.post hr {
  height: 1px;
  margin: 2em 0;
  border: 0;
  background: var(--line-soft);
}

.post details {
  margin: 1.1em 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.post details[open] {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

.post summary {
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  list-style-position: outside;
}

.post details[open] > summary {
  border-bottom: 1px solid var(--line-soft);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: rgba(255, 255, 255, 0.055);
}

.post details > :not(summary) {
  margin-left: 14px;
  margin-right: 14px;
}

.post details > :last-child {
  margin-bottom: 14px;
}

.post div[style*="border-left"] {
  margin: 1.15em 0 !important;
  padding: 12px 14px !important;
  border-radius: 6px !important;
  color: var(--text) !important;
  font-size: 15px;
}

.post div[style*="#2563eb"] {
  border-left-color: var(--blue-line) !important;
  background: var(--blue-bg) !important;
}

.post div[style*="#2563eb"] strong {
  color: #a8c9ff !important;
}

.post div[style*="#f97316"] {
  border-left-color: var(--orange-line) !important;
  background: var(--orange-bg) !important;
}

.post div[style*="#f97316"] strong {
  color: #ffc08a !important;
}

.post div[style*="border-left"] a {
  color: #f5f1e9;
  text-decoration-color: rgba(245, 241, 233, 0.42);
}

.demo-embed-stack {
  display: grid;
  gap: 18px;
  margin: 0.85em 0 1.8em;
}

.demo-embed-card {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.028)),
    #141413;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.28);
}

.demo-embed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.055);
}

.demo-embed-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.demo-open-link {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.demo-open-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.demo-frame-wrap {
  height: min(680px, 72vh);
  min-height: 520px;
  background: #0d0d0c;
}

.post .demo-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.post .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25em 0;
}

.post .math-display {
  margin: 1em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.post .math-display .katex-display {
  margin: 0;
}

.loading-card {
  padding-top: 18px;
}

.loading-line {
  width: 100%;
  height: 18px;
  margin: 12px 0;
  border-radius: 5px;
  background: linear-gradient(90deg, #2a2a27, #383832, #2a2a27);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

.loading-title {
  width: 74%;
  height: 34px;
}

.loading-line.short {
  width: 46%;
}

.error-card {
  padding: 18px;
  border: 1px solid rgba(255, 118, 118, 0.34);
  border-radius: 8px;
  background: rgba(96, 28, 28, 0.3);
  color: #ffd0d0;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 1060px) {
  .page-shell {
    display: block;
  }

  .notion-sidebar {
    display: none;
  }

  .notion-page {
    max-width: none;
  }

  .cover-image {
    height: clamp(240px, 38vw, 340px);
  }

  .page-content {
    max-width: 820px;
    padding: 0 48px 96px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15.5px;
  }

  .cover-image {
    height: 210px;
    background-position: center top;
  }

  .page-content {
    padding: 0 22px 72px;
  }

  .page-icon {
    width: 88px;
    height: 88px;
    margin: -46px 0 34px;
    border-radius: 16px;
    font-size: 66px;
  }

  #page-title {
    font-size: 34px;
    letter-spacing: -0.04em;
    white-space: normal;
  }

  .post > p:first-of-type {
    padding: 14px 15px 14px 44px;
    font-size: 15.5px;
    line-height: 1.55;
  }

  .post > p:first-of-type::before {
    top: 15px;
    left: 15px;
    font-size: 19px;
  }

  .post h2 {
    font-size: 25px;
  }

  .post h3 {
    font-size: 20px;
  }

  .post th,
  .post td {
    min-width: 180px;
  }

  .post p:has(> .image-link:only-child) {
    margin-right: calc(50% - 50vw + 10px);
    margin-left: calc(50% - 50vw + 10px);
  }

  .post .image-link img {
    width: calc(100vw - 20px);
    max-width: none;
  }

  .demo-embed-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .demo-frame-wrap {
    height: 540px;
    min-height: 440px;
  }
}

@media (max-width: 500px) {
  body {
    font-size: 15px;
  }

  .page-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  #page-title {
    max-width: 100%;
    font-size: 31px;
    line-height: 1.12;
  }

  .authors {
    font-size: 15px;
  }

  .post > p:first-of-type {
    padding-left: 40px;
    font-size: 15px;
  }

  .demo-embed-stack {
    width: calc(100vw - 20px);
    margin-right: calc(50% - 50vw + 10px);
    margin-left: calc(50% - 50vw + 10px);
  }

  .demo-frame-wrap {
    height: 580px;
    min-height: 500px;
  }

  .image-link::after {
    opacity: 1;
  }
}
