:root {
  --bg: #1b1c1f;
  --bg-elevated: #232428;
  --bg-sunken: #131417;
  --text: #e8e8ea;
  --text-dim: #9a9ba3;
  --border: #34353a;
  --accent: #4d8dff;
  --accent-text: #ffffff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(27, 28, 31, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.brand:hover {
  text-decoration: none;
}
.brand svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex: 0 0 auto;
}
.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 500;
}
.topbar-cta:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

/* ---- layout ---- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.byline {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-dim);
}

.lede {
  font-size: 1.15rem;
  color: var(--text);
}

h2 {
  margin: 2.6em 0 0.6em;
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  scroll-margin-top: 72px;
  border-top: 1px solid var(--border);
  padding-top: 1.4em;
}

h3 {
  margin: 1.8em 0 0.4em;
  font-size: 1.2rem;
}

p {
  margin: 0 0 1.1em;
}

strong {
  color: #fff;
}

ul,
ol {
  margin: 0 0 1.1em;
  padding-left: 1.3em;
}
li {
  margin: 0 0 0.5em;
}

/* ---- table of contents ---- */
.toc {
  margin: 28px 0 8px;
  padding: 18px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.toc-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.toc ol {
  margin: 0;
  padding-left: 1.2em;
  font-size: 15px;
}
.toc li {
  margin: 0 0 0.35em;
}
.toc-deep {
  display: inline-block;
  margin-left: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.toc-deep:hover {
  color: var(--accent);
}

/* ---- "go deeper" block ---- */
.go-deeper {
  margin: 3em 0 0;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.go-deeper-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.go-deeper ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.go-deeper li {
  margin: 0;
  border-top: 1px solid var(--border);
}
.go-deeper li:first-child {
  border-top: none;
}
.go-deeper li a {
  display: block;
  padding: 11px 0;
  font-size: 16px;
  font-weight: 500;
}

/* ---- figures ---- */
figure {
  margin: 2em 0;
}
.fig-frame {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sunken);
  overflow: hidden;
}
.fig-frame svg,
.fig-frame img {
  display: block;
  width: 100%;
  height: auto;
}
figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}

.small-multiples {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.sm-item .fig-frame {
  border-radius: 8px;
}
.sm-item .sm-label {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
@media (max-width: 560px) {
  .small-multiples {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- asides / callouts ---- */
aside.note {
  margin: 2em 0;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 15.5px;
}
aside.note p:last-child {
  margin-bottom: 0;
}
aside.note .note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- CTA ---- */
.cta {
  margin: 3em 0 1em;
  padding: 28px 24px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cta h2 {
  border: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.cta p {
  margin: 0 0 18px;
  color: var(--text-dim);
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.cta-btn:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

/* ---- jump nav (sticky sub-bar on how-to pages) ---- */
.jump-nav {
  position: sticky;
  top: 49px;
  z-index: 9;
  display: flex;
  gap: 4px;
  margin: 26px 0 8px;
  padding: 8px 10px;
  background: rgba(35, 36, 40, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.jump-nav::-webkit-scrollbar {
  display: none;
}
.jump-nav a {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
}
.jump-nav a:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
}
.with-jumpnav h2 {
  scroll-margin-top: 112px;
}

/* ---- "for the experienced" callout ---- */
aside.callout-pro {
  margin: 1.8em 0;
  padding: 16px 20px;
  background: var(--bg-sunken);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 15.5px;
  color: var(--text-dim);
}
aside.callout-pro .callout-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
aside.callout-pro p:last-child {
  margin-bottom: 0;
}
aside.callout-pro strong {
  color: var(--text);
}

/* ---- inline (mid-page) CTA ---- */
.inline-cta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 1.6em 0 2em;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 15.5px;
  color: var(--text-dim);
}
.inline-cta a {
  font-weight: 600;
}

/* ---- gallery ---- */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 2em 0;
}
.gallery figure {
  margin: 0;
}
.gallery figcaption {
  margin-top: 8px;
  font-size: 13.5px;
}
.gallery-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: 18px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dim);
  background: var(--bg-sunken);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
@media (max-width: 560px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

/* ---- FAQ accordion ---- */
.faq {
  margin: 1.2em 0 0;
}
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq details:first-of-type {
  border-top: 1px solid var(--border);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  cursor: pointer;
  list-style: none;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-dim);
}
.faq details[open] summary {
  color: var(--accent);
}
.faq details[open] summary::after {
  content: '\2013';
}
.faq-answer {
  padding: 0 0 18px;
  font-size: 16px;
  color: var(--text-dim);
}
.faq-answer p:last-child {
  margin-bottom: 0;
}

/* ---- prev / next nav ---- */
.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 3em 0 0;
  padding-top: 1.6em;
  border-top: 1px solid var(--border);
}
.prev-next a {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 16px;
  font-weight: 600;
}
.prev-next .pn-next {
  margin-left: auto;
  text-align: right;
}
.prev-next .pn-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- references + footer ---- */
.references {
  font-size: 15px;
}
.references li {
  color: var(--text-dim);
}

/* ---- author bio ---- */
.author-bio {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin: 3em 0 0;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.author-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}
.author-bio-body {
  min-width: 0;
}
.author-bio-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.author-bio-body p:last-child {
  margin-bottom: 0;
}
.author-bio-link {
  margin-top: 10px;
  font-size: 15px;
}

footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  main {
    padding: 28px 16px 60px;
  }
}
