/* Light only, same palette as the landing page. */
:root {
  --peri: #858BEE;
  --peri-d: #5E64D6;
  --ink: #1B2037;
  --ink-soft: #4A4F6A;
  --lilac: #ECEDFF;
  --cloud: #F5F6FC;
  --line: #E2E4F3;
  --bg: #ffffff;
  --link: #5E64D6;
  --focus: #5E64D6;
  --btn-bg: #1B2037;
  --btn-fg: #ffffff;
  --btn-hover: #2b3152;
  --code-bar: #f6f8fa;
  --code-bar-fg: #4A4F6A;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --nav-bg: rgba(255, 255, 255, 0.82);
  --shadow: 0 24px 60px -36px rgba(27, 32, 55, 0.45);
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a { color: inherit; }

:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

::selection { background: var(--lilac); color: var(--ink); }

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-160%);
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 40;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { transform: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

.wm {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.04em;
  color: var(--peri);
  text-decoration: none;
}
.wm b { color: var(--ink); font-weight: 800; }

nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
nav .wrap {
  display: flex;
  align-items: center;
  height: 64px;
}
nav .wm,
nav .btn { flex: none; }
nav .links {
  display: flex;
  gap: 28px;
  margin-left: 28px;
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
}
.nav-docs {
  padding: 10px 8px;
  margin-left: auto;
  margin-right: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  flex: none;
  text-decoration: none;
}
.nav-docs:hover { color: var(--ink); }
.nav-docs:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
nav .links a { text-decoration: none; }
nav .links a:hover,
nav .links a.is-active,
nav .links a[aria-current="page"] { color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: inherit;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.btn-p { background: var(--btn-bg); color: var(--btn-fg); }
.btn-p:hover { background: var(--btn-hover); transform: translateY(-1px); }
.btn-sm { padding: 8px 14px; font-size: 14px; }

main { padding: 72px 0 24px; }

.measure { max-width: 68ch; margin: 0 auto; font-size: 18px; }

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 12px;
}
.index-head h1,
.post-header h1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.lead {
  color: var(--ink-soft);
  font-size: 18px;
  margin-top: 12px;
}
.rss-link {
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--peri-d);
  text-decoration: none;
  padding-bottom: 8px;
}
.rss-link:hover { color: var(--ink); }

.post-list { list-style: none; }
.post-list > li {
  border-top: 1px solid var(--line);
  padding: 32px 0;
}
.post-list > li:last-child { border-bottom: 1px solid var(--line); }
.post-list h2 {
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-weight: 800;
  margin: 8px 0 10px;
}
.post-list h2 a { color: inherit; text-decoration: none; }
.post-list h2 a:hover { color: var(--link); }
.dek { color: var(--ink-soft); font-size: 16.5px; line-height: 1.6; max-width: 62ch; }

.byline {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.byline .who { color: var(--ink); font-weight: 600; }

.post-layout {
  display: grid;
  font-size: 18px;
  width: min(100%, calc(68ch + 220px + 56px));
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr) 220px;
  column-gap: 56px;
  align-items: start;
  grid-template-areas:
    "header toc"
    "article toc"
    "cta toc";
}
.post-header { grid-area: header; margin-bottom: 28px; }
.post-header h1 { margin: 10px 0 16px; }
.prose { grid-area: article; min-width: 0; }
.end-cta { grid-area: cta; }
.kicker {
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker a { color: var(--peri-d); text-decoration: none; }
.kicker a:hover { color: var(--ink); }

.prose {
  font-size: 18px;
  line-height: 1.75;
}
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 2.15em 0 0.55em;
  scroll-margin-top: 88px;
}
.prose h3 {
  font-size: 1.18rem;
  line-height: 1.3;
  letter-spacing: -0.022em;
  font-weight: 700;
  margin: 1.75em 0 0.45em;
  scroll-margin-top: 88px;
}
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.35em; }
.prose li { margin: 0.4em 0; padding-left: 0.2em; }
.prose li > ul, .prose li > ol { margin: 0.35em 0 0.2em; }
.prose li::marker { color: var(--peri-d); }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}
.prose a:hover { color: var(--ink); }
.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 2.4em 0;
}
.prose blockquote {
  margin: 1.5em 0;
  padding: 0.1em 0 0.1em 1.05em;
  border-left: 3px solid var(--peri);
}
.prose blockquote p { color: var(--ink-soft); }
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--lilac);
  color: var(--ink);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  font-variant-ligatures: none;
}
.prose .table-wrap {
  overflow-x: auto;
  margin: 1.4em 0 1.6em;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95em;
  line-height: 1.5;
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.55em 0.75em;
  text-align: left;
  vertical-align: top;
}
.prose th { background: var(--cloud); font-weight: 600; }
.prose img { border-radius: 12px; }

.codeblock {
  margin: 1.35em 0 1.55em;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  max-width: 100%;
  min-width: 0;
}
.codeblock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 8px 6px 14px;
  background: var(--code-bar);
  border-bottom: 1px solid var(--line);
}
.codeblock-lang {
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--code-bar-fg);
}
.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 600 12.5px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
html:not(.js) .copy { display: none; }
.copy:hover { border-color: var(--peri); }
.copy.is-copied { color: var(--peri-d); border-color: var(--peri); }
.prose .codeblock pre {
  margin: 0;
  max-width: 100%;
  padding: 16px 18px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  font-variant-ligatures: none;
  tab-size: 2;
}
.prose .codeblock pre code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}
.prose .codeblock .line {
  display: block;
  min-height: 1.65em;
}

.toc-desktop {
  grid-area: toc;
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding-top: 4px;
}
.toc-mobile { display: none; }
.toc-label {
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--peri-d);
  margin: 0 0 10px;
}
.toc-list, .toc-list ol { list-style: none; margin: 0; padding: 0; }
.toc-list ol { margin: 0 0 4px 12px; }
.toc-list a {
  display: block;
  padding: 5px 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}
.toc-list a:hover { color: var(--ink); }

.end-cta {
  margin-top: 48px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--cloud);
}
.end-cta .kicker { color: var(--peri-d); }
.end-cta-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 8px 0 6px;
}
.end-cta p { color: var(--ink-soft); font-size: 15.5px; line-height: 1.55; margin: 0 0 16px; }
.end-cta .btn { margin-top: 2px; }
.end-cta-links { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.end-cta-links .text-link { color: var(--peri-d); font-weight: 600; font-size: 14.5px; }
.end-cta-links .text-link:hover { color: var(--ink); }
.notice {
  background: var(--lilac);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 1.15em;
  color: var(--ink);
  font-size: 16px;
}

footer {
  padding: 48px 0;
  border-top: 1px solid var(--line);
  margin-top: 72px;
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ink-soft);
}
footer .tag { margin-top: 6px; }
footer .links { display: flex; gap: 22px; flex-wrap: wrap; }
footer .links a { color: var(--ink-soft); text-decoration: none; }
footer .links a:hover { color: var(--ink); }

@media (max-width: 1080px) {
  .post-layout {
    width: min(100%, 68ch);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "mobiletoc"
      "article"
      "cta";
  }
  .toc-desktop { display: none; }
  .toc-mobile {
    display: block;
    grid-area: mobiletoc;
    margin: 0 0 28px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--cloud);
    padding: 0 14px;
  }
  .toc-mobile summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after {
    content: "+";
    color: var(--peri-d);
    font-size: 22px;
    line-height: 1;
  }
  .toc-mobile[open] summary::after { content: "–"; }
  .toc-mobile .toc-list { margin: 0 0 12px; }
}

@media (max-width: 360px) {
  nav .wrap { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 900px) {
  .links.hide { display: none; }
  main { padding: 40px 0 8px; }
  .prose { font-size: 17px; }
  .wrap { padding: 0 20px; }
  footer { margin-top: 48px; }
}

@media (max-width: 520px) {
  .index-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .end-cta .btn { width: 100%; }
  .post-list > li { padding: 26px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
