:root {
  color-scheme: light;
  --paper: #fff9ef;
  --paper-2: #f8eadc;
  --ink: #251d19;
  --soft-ink: #63554e;
  --faint-ink: #8a766a;
  --line: #dfcdbb;
  --violet: #6f55ff;
  --violet-dark: #4630c9;
  --rose: #c6547f;
  --coral: #e98565;
  --moss: #547d61;
  --cream: #fff4df;
  --code-bg: #211c2f;
  --code-ink: #f6f1ff;
  --code-muted: #c9bfdc;
  --syntax-comment: #a99fba;
  --syntax-keyword: #ff9fbd;
  --syntax-string: #ffd789;
  --syntax-number: #b9eaa2;
  --syntax-function: #99dcff;
  --syntax-method: #ffb3cc;
  --syntax-property: #d8c2ff;
  --syntax-builtin: #f2b2ff;
  --syntax-constant: #ffbd8a;
  --syntax-variable: #f6f1ff;
  --syntax-selector: #a7e6d3;
  --syntax-tag: #ffad7a;
  --syntax-attr: #bfeaa3;
  --syntax-operator: #e3d7f5;
  --syntax-punctuation: #b6a9cd;
  --shadow: 0 28px 90px rgba(64, 42, 25, 0.16);
  --small-shadow: 0 16px 40px rgba(64, 42, 25, 0.11);
  --radius: 28px;
  --body-font: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --display-font: Avenir Next, Segoe UI, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(111, 85, 255, 0.22), transparent 27rem),
    radial-gradient(circle at 88% 8%, rgba(198, 84, 127, 0.18), transparent 25rem),
    radial-gradient(circle at 18% 78%, rgba(84, 125, 97, 0.17), transparent 31rem),
    linear-gradient(135deg, #fff9ef 0%, #f8eadc 42%, #efe1d5 100%);
  font-family: var(--body-font);
  font-size: clamp(1rem, 0.3vw + 0.98rem, 1.12rem);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(111, 85, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 85, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 16rem, #000 80%, transparent);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  transform: translateY(-160%);
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  color: white;
  background: var(--violet-dark);
  font-family: var(--display-font);
  font-weight: 800;
  text-decoration: none;
}

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

.site-header {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 6.5rem) 1rem clamp(1.5rem, 4vw, 3rem);
}

.site-header::before,
.site-header::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.55;
  pointer-events: none;
}

.site-header::before {
  width: 19rem;
  height: 19rem;
  left: max(-8rem, -8vw);
  top: 2rem;
  background:
    radial-gradient(circle at 40% 35%, rgba(255, 255, 255, 0.75), transparent 14%),
    radial-gradient(circle at 55% 50%, rgba(111, 85, 255, 0.28), transparent 45%),
    rgba(198, 84, 127, 0.16);
  border: 1px solid rgba(111, 85, 255, 0.16);
}

.site-header::after {
  width: 24rem;
  height: 24rem;
  right: max(-10rem, -10vw);
  bottom: -11rem;
  background:
    radial-gradient(circle at 43% 42%, rgba(255, 255, 255, 0.65), transparent 12%),
    radial-gradient(circle at 50% 50%, rgba(233, 133, 101, 0.28), transparent 48%),
    rgba(84, 125, 97, 0.15);
  border: 1px solid rgba(233, 133, 101, 0.18);
}

.hero-card {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 1rem));
  margin: 0 auto;
  border: 1px solid rgba(223, 205, 187, 0.78);
  border-radius: clamp(1.3rem, 4vw, 3rem);
  padding: clamp(1.25rem, 5vw, 4.5rem);
  background:
    linear-gradient(120deg, rgba(255, 249, 239, 0.92), rgba(255, 244, 223, 0.75)),
    radial-gradient(circle at top left, rgba(111, 85, 255, 0.12), transparent 38rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.site-kicker {
  width: fit-content;
  margin: 0 0 1.1rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(111, 85, 255, 0.28);
  border-radius: 999px;
  color: var(--violet-dark);
  background: rgba(111, 85, 255, 0.08);
  font-family: var(--display-font);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.site-title {
  max-width: 920px;
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2.65rem, 8.5vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.085em;
}

.site-subtitle {
  max-width: 720px;
  margin: 1.35rem 0 0;
  color: var(--soft-ink);
  font-size: clamp(1.05rem, 1vw + 0.85rem, 1.42rem);
  line-height: 1.45;
  text-wrap: balance;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(14rem, 19rem) minmax(0, 65rem);
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: start;
  width: min(1380px, calc(100% - 2rem));
  margin: 0 auto 5rem;
}

.toc {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 1px solid rgba(223, 205, 187, 0.82);
  border-radius: 1.35rem;
  padding: 1rem;
  background: rgba(255, 249, 239, 0.78);
  box-shadow: var(--small-shadow);
  backdrop-filter: blur(15px);
}

.toc-title {
  margin: 0 0 0.75rem;
  color: var(--faint-ink);
  font-family: var(--display-font);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  border-radius: 0.8rem;
  padding: 0.34rem 0.46rem;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 0.86rem;
  line-height: 1.18;
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--violet-dark);
  background: rgba(111, 85, 255, 0.1);
  outline: none;
}

.toc .toc-h3 {
  padding-left: 0.9rem;
  color: var(--soft-ink);
  font-size: 0.78rem;
}

.article {
  min-width: 0;
  border: 1px solid rgba(223, 205, 187, 0.86);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 3vw, 3.25rem);
  background:
    linear-gradient(180deg, rgba(255, 249, 239, 0.96), rgba(255, 250, 244, 0.92)),
    radial-gradient(circle at top right, rgba(111, 85, 255, 0.08), transparent 34rem);
  box-shadow: var(--shadow);
}

.article > :first-child {
  margin-top: 0;
}

.article h1 {
  display: none;
}

.article h2,
.article h3 {
  max-width: none;
  font-family: var(--display-font);
  line-height: 1.12;
  letter-spacing: -0.024em;
  text-wrap: normal;
}

.article h2 {
  position: relative;
  margin-top: 3.35rem;
  padding-top: 1.45rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.28rem, 0.75vw + 1rem, 1.58rem);
}

.article h2::before {
  content: "";
  position: absolute;
  top: -0.42rem;
  left: 0;
  width: 4.5rem;
  height: 0.72rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), var(--rose), var(--coral));
}

.article h3 {
  margin-top: 1.85rem;
  color: #3a302a;
  font-size: clamp(1rem, 0.36vw + 0.96rem, 1.14rem);
}

.article p,
.article li {
  max-width: none;
  line-height: 1.62;
  text-wrap: normal;
  orphans: 2;
  widows: 2;
}

.article p {
  margin: 1.05rem 0;
}

.article h2 + p,
.article h3 + p {
  margin-top: 0.72rem;
}

.article p:has(code),
.article li:has(code) {
  max-width: none;
}

.article ul,
.article ol {
  max-width: none;
  padding-left: 1.45rem;
}

.article li + li {
  margin-top: 0.44rem;
}

.article a {
  color: var(--violet-dark);
  font-weight: 750;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

.article a:hover,
.article a:focus-visible {
  color: var(--rose);
}

.article code {
  border: 1px solid rgba(111, 85, 255, 0.18);
  border-radius: 0.42rem;
  padding: 0.1rem 0.32rem;
  color: var(--violet-dark);
  background: rgba(111, 85, 255, 0.1);
  font-family: var(--mono-font);
  font-size: 0.88em;
}

.article pre {
  position: relative;
  overflow-x: auto;
  margin: 1.35rem 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at top left, rgba(111, 85, 255, 0.22), transparent 18rem),
    var(--code-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 40px rgba(33, 28, 47, 0.18);
}

.article pre::before {
  content: attr(data-language);
  position: sticky;
  left: 0;
  display: block;
  width: fit-content;
  margin: 0.8rem 0 -0.7rem 1rem;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  color: var(--code-muted);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--display-font);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article pre code {
  display: block;
  border: 0;
  border-radius: 0;
  padding: 1.25rem 1.18rem 1.18rem;
  color: var(--code-ink);
  background: transparent;
  font-family: var(--mono-font);
  font-size: 0.9rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
  font-variant-ligatures: none;
}

.article pre .tok-comment {
  color: var(--syntax-comment);
  font-style: italic;
}

.article pre .tok-keyword {
  color: var(--syntax-keyword);
  font-weight: 700;
}

.article pre .tok-string {
  color: var(--syntax-string);
}

.article pre .tok-number {
  color: var(--syntax-number);
}

.article pre .tok-function {
  color: var(--syntax-function);
}

.article pre .tok-method {
  color: var(--syntax-method);
}

.article pre .tok-property {
  color: var(--syntax-property);
}

.article pre .tok-variable {
  color: var(--syntax-variable);
}

.article pre .tok-builtin {
  color: var(--syntax-builtin);
}

.article pre .tok-constant {
  color: var(--syntax-constant);
}

.article pre .tok-selector {
  color: var(--syntax-selector);
}

.article pre .tok-tag {
  color: var(--syntax-tag);
  font-weight: 700;
}

.article pre .tok-attr {
  color: var(--syntax-attr);
}

.article pre .tok-operator {
  color: var(--syntax-operator);
}

.article pre .tok-punctuation {
  color: var(--syntax-punctuation);
}

.article blockquote {
  max-width: none;
  margin: 1.45rem 0;
  border: 1px solid rgba(198, 84, 127, 0.16);
  border-left: 0.42rem solid var(--rose);
  border-radius: 0 1.1rem 1.1rem 0;
  padding: 0.8rem 1rem;
  color: #463832;
  background: rgba(198, 84, 127, 0.08);
}

.article blockquote p {
  margin: 0;
}

.article hr {
  height: 1px;
  margin: 3.2rem 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid rgba(223, 205, 187, 0.9);
  border-radius: 1rem;
  background: rgba(255, 244, 223, 0.62);
}

.article table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-family: var(--display-font);
  font-size: 0.92rem;
  line-height: 1.36;
}

.article th,
.article td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid rgba(223, 205, 187, 0.85);
  text-align: left;
  vertical-align: top;
}

.article th {
  color: var(--violet-dark);
  background: rgba(111, 85, 255, 0.08);
  font-weight: 850;
}

.article tr:last-child td {
  border-bottom: 0;
}

.article td code,
.article th code {
  white-space: nowrap;
}

.site-footer {
  width: min(60rem, calc(100% - 2rem));
  margin: -2.5rem auto 3rem;
  color: var(--soft-ink);
  text-align: center;
  font-family: var(--display-font);
  font-size: 0.92rem;
}

::selection {
  color: white;
  background: var(--violet-dark);
}

@media (min-width: 1121px) {
  .article h2,
  .article h3 {
    white-space: nowrap;
  }
}

@media (max-width: 1120px) {
  .layout {
    display: block;
    width: min(60rem, calc(100% - 1.5rem));
  }

  .toc {
    position: static;
    max-height: none;
    margin-bottom: 1rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 1rem;
  }

  .article h2 {
    font-size: clamp(1.3rem, 6vw, 1.6rem);
  }

  .article h3 {
    font-size: clamp(1.02rem, 4.5vw, 1.16rem);
  }

  .site-header {
    padding-inline: 0.75rem;
  }

  .hero-card,
  .article {
    border-radius: 1.25rem;
  }

  .article pre code {
    font-size: 0.82rem;
  }
}

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