:root {
  --dn-ink: #14202b;
  --dn-muted: #5c6a76;
  --dn-line: #d7dee6;
  --dn-surface: #f5f8fa;
  --dn-panel: #ffffff;
  --dn-teal: #0b6b7a;
  --dn-teal-dark: #063f49;
  --dn-gold: #f5c542;
  --dn-code: #0d1726;
  --dn-pad: clamp(1rem, 3vw, 2.75rem);
  --dn-toc-width: 250px;
  --dn-toc-gap: 2.5rem;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--dn-ink);
  max-width: 1160px;
}

.body {
  padding: var(--dn-pad);
}

.site-nav {
  background: var(--dn-panel);
  border-bottom: 1px solid var(--dn-line);
}

.site-nav > p {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.6rem, 1.6vw, 1.15rem);
  margin: 0;
  padding: 0.85rem clamp(1rem, 3vw, 2.5rem);
}

.site-nav a {
  color: var(--dn-muted);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--dn-teal);
}

.site-nav .project-home {
  align-items: center;
  color: var(--dn-teal-dark);
  display: inline-flex;
  font-size: 1.08rem;
  gap: 0.55rem;
  margin-right: auto;
}

.mark {
  align-items: center;
  background: var(--dn-gold);
  border-radius: 0.45rem;
  color: #2a2417;
  display: inline-flex;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  height: 1.8rem;
  justify-content: center;
  letter-spacing: -0.05em;
  width: 1.8rem;
}

.frontmatter .title h1,
.body > h1:first-child {
  color: var(--dn-teal-dark);
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  letter-spacing: -0.04em;
  margin-bottom: 0.55em;
}

/* The hero and card grid are injected ahead of litedown's .body wrapper so they
 * sit above the table of contents rather than below it. That puts them outside
 * .body's padding, which this restores. */
.hero-wrap {
  padding: var(--dn-pad) var(--dn-pad) 0;
}

.hero-wrap .feature-grid {
  margin-bottom: 0;
}

.hero {
  background:
    radial-gradient(circle at 92% 12%, rgb(245 197 66 / 26%), transparent 30%),
    linear-gradient(135deg, #f2fafc 0%, #ffffff 60%);
  border: 1px solid var(--dn-line);
  border-radius: 1rem;
  margin: 0.5rem 0 1.75rem;
  overflow: hidden;
  padding: clamp(1.4rem, 5vw, 3.5rem);
}

.hero h1 {
  color: var(--dn-teal-dark);
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
  margin: 0.18em 0 0.3em;
  max-width: 780px;
}

.eyebrow {
  color: var(--dn-teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  margin: 0;
  text-transform: uppercase;
}

.lede {
  color: var(--dn-muted);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.55;
  max-width: 760px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.5rem 0 0;
}

.button {
  border: 1px solid var(--dn-line);
  border-radius: 0.5rem;
  color: var(--dn-teal-dark) !important;
  display: inline-block;
  font-weight: 700;
  padding: 0.65rem 1rem;
  text-decoration: none;
}

.button.primary {
  background: var(--dn-teal);
  border-color: var(--dn-teal);
  color: white !important;
}

.transport-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.6rem 0 0;
}

.transport-strip code {
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-radius: 0.35rem;
  color: var(--dn-teal-dark);
  font-size: 0.84rem;
  padding: 0.28rem 0.55rem;
}

.feature-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.25rem 0 2.5rem;
}

.feature {
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-radius: 0.75rem;
  color: var(--dn-ink) !important;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}

.feature:hover {
  border-color: var(--dn-teal);
  transform: translateY(-2px);
}

.feature strong {
  color: var(--dn-teal-dark);
}

.feature span {
  color: var(--dn-muted);
  line-height: 1.45;
}

/* --- Landing page components ------------------------------------------- */

.diagram {
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-radius: 0.9rem;
  margin: 0 0 2.5rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.diagram svg {
  margin: 0 auto;
  max-width: 780px;
  width: 100%;
}

.section-head {
  align-items: baseline;
  border-bottom: 1px solid var(--dn-line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2.75rem 0 1.5rem;
  padding-bottom: 0.6rem;
}

.section-head h2 {
  border: 0;
  margin: 0;
}

.section-head span {
  color: var(--dn-muted);
  font-size: 0.95rem;
}

.steps {
  counter-reset: dn-step;
  display: grid;
  gap: 1rem;
  margin: 0 0 2.5rem;
}

.step {
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-radius: 0.9rem;
  padding: clamp(1rem, 2.5vw, 1.6rem);
}

.step-head {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}

.step-num {
  align-items: center;
  background: var(--dn-teal);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: none;
  font-size: 0.95rem;
  font-weight: 800;
  height: 1.9rem;
  justify-content: center;
  width: 1.9rem;
}

.step-head h3 {
  margin: 0;
}

.step > p {
  color: var(--dn-muted);
  margin: 0 0 0.9rem 2.7rem;
}

.step-cols {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-left: 2.7rem;
}

.step-body {
  margin-left: 2.7rem;
}

/* Says which DuckDB session a block runs in -- the distinction the old
 * single-block tour hid. */
.code-label {
  align-items: center;
  color: var(--dn-teal-dark);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 800;
  gap: 0.4rem;
  letter-spacing: 0.07em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.code-label:before {
  background: var(--dn-gold);
  border-radius: 50%;
  content: "";
  height: 0.5rem;
  width: 0.5rem;
}

.code-label.client:before {
  background: var(--dn-teal);
}

.step pre {
  margin: 0 0 0.6rem;
}

/* Query results as real tables instead of the README's ASCII art, which
 * overflowed the content column and was clipped. */
table.res {
  font-size: 0.86rem;
  margin: 0.3rem 0 0;
  width: auto;
}

table.res th,
table.res td {
  border: 1px solid var(--dn-line);
  padding: 0.3rem 0.7rem;
}

table.res th {
  background: var(--dn-surface);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

table.res td {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.layer-stack {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 2.5rem;
}

.layer {
  align-items: baseline;
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-left: 0.35rem solid var(--dn-teal);
  border-radius: 0.5rem;
  display: grid;
  gap: 0.2rem 1.2rem;
  grid-template-columns: 9rem minmax(0, 1fr);
  padding: 0.85rem 1.1rem;
}

.layer strong {
  color: var(--dn-teal-dark);
}

.layer span {
  color: var(--dn-muted);
}

.layer:nth-child(2) { border-left-color: #2a8fa0; }
.layer:nth-child(3) { border-left-color: #6bb3bf; }
.layer:nth-child(4) { border-left-color: var(--dn-gold); }

.demo-strip {
  align-items: center;
  background:
    radial-gradient(circle at 90% 20%, rgb(245 197 66 / 24%), transparent 40%),
    linear-gradient(135deg, #f2fafc 0%, #ffffff 65%);
  border: 1px solid var(--dn-line);
  border-radius: 1rem;
  display: grid;
  gap: clamp(1rem, 3vw, 2.5rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 0 2.5rem;
  padding: clamp(1.2rem, 3vw, 2.2rem);
}

.demo-strip h2 {
  margin-top: 0;
}

.demo-strip p {
  color: var(--dn-muted);
}

.demo-strip pre {
  margin: 0;
}

.next-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 2rem;
}

.next-grid a {
  background: var(--dn-panel);
  border: 1px solid var(--dn-line);
  border-radius: 0.6rem;
  color: var(--dn-teal-dark) !important;
  font-weight: 700;
  padding: 0.8rem 0.9rem;
  text-decoration: none;
}

.next-grid a:hover {
  border-color: var(--dn-teal);
}

.next-grid span {
  color: var(--dn-muted);
  display: block;
  font-size: 0.83rem;
  font-weight: 400;
  margin-top: 0.15rem;
}

@media (max-width: 860px) {
  .step-cols,
  .demo-strip,
  .next-grid {
    grid-template-columns: 1fr;
  }

  .layer {
    grid-template-columns: 1fr;
  }

  .step > p,
  .step-cols,
  .step-body {
    margin-left: 0;
  }
}

.callout {
  background: #fff9e8;
  border: 1px solid #ead49a;
  border-left: 0.3rem solid var(--dn-gold);
  border-radius: 0.35rem;
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
}

a,
a:visited {
  color: var(--dn-teal);
}

h2,
h3 {
  color: var(--dn-teal-dark);
  letter-spacing: -0.015em;
}

code {
  font-size: 0.92em;
}

pre {
  border-radius: 0.55rem;
  max-width: 100%;
  overflow-x: auto;
}

pre > code {
  background: var(--dn-surface) !important;
  border: 1px solid var(--dn-line);
  box-sizing: border-box;
  color: var(--dn-ink) !important;
  display: block !important;
  max-width: 100%;
  min-width: 0 !important;
  overflow-x: auto;
  white-space: pre;
  width: 100% !important;
}

svg {
  display: block;
  height: auto;
  max-width: 100%;
}

pre > code .token {
  background: transparent !important;
  color: var(--dn-ink) !important;
}

pre > code .token.comment,
pre > code .token.prolog,
pre > code .token.doctype,
pre > code .token.cdata {
  color: #52606d !important;
}

pre > code .token.keyword,
pre > code .token.atrule {
  color: #08505c !important;
}

pre > code .token.string,
pre > code .token.char,
pre > code .token.regex {
  color: #9b1c1c !important;
}

pre > code .token.function,
pre > code .token.builtin,
pre > code .token.class-name {
  color: #8b1e3f !important;
}

pre > code .token.number,
pre > code .token.boolean,
pre > code .token.constant,
pre > code .token.symbol,
pre > code .token.variable {
  color: #4c1d95 !important;
}

pre > code .token.operator,
pre > code .token.punctuation {
  color: #334155 !important;
}

/* Sticky left-hand contents column, the reading layout litedown's book format
 * uses. litedown gets it by floating #TOC into the page margin, which needs
 * --side-width plus --side-gap of free space on both sides and therefore a
 * ~800px body (hence its 1264.02px breakpoint). This site runs wider and has
 * no right-margin footnotes, so the TOC gets its own grid column instead.
 * The #TOC rule matches the specificity of article.min.css's own
 * `body:not(.pagesjs) #TOC` block so it wins on load order rather than
 * !important. Below the breakpoint the TOC returns to normal flow. */
@media (min-width: 1080px) {
  body {
    max-width: 1340px;
  }

  /* Reserve the contents column as left padding and float the TOC back into
   * it with a negative margin. Do not use a grid here: the TOC is one child
   * among hundreds of sibling blocks, so it can only span rows via
   * `grid-row: 1 / -1`, and with no explicit rows declared `-1` resolves to
   * the first line. The TOC then sized row 1 to its own full height and the
   * first paragraph, sharing that row, was followed by hundreds of pixels of
   * blank space. Floating keeps every sibling in normal flow. */
  /* Only reserve the column on pages that actually have a contents list. The
   * landing page renders with toc disabled, and without :has() it kept an
   * empty 290px indent. */
  .body:has(#TOC) {
    padding-left: calc(var(--dn-pad) + var(--dn-toc-width) + var(--dn-toc-gap));
  }

  body:not(.pagesjs) #TOC {
    border: 0;
    border-right: 1px solid var(--dn-line);
    border-radius: 0;
    float: left;
    font-size: 0.87rem;
    line-height: 1.45;
    margin: 0 0 1rem calc(-1 * (var(--dn-toc-width) + var(--dn-toc-gap)));
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    padding: 0 1.1rem 0 0;
    position: sticky;
    top: 1.5rem;
    width: var(--dn-toc-width);
  }

  #TOC a {
    color: var(--dn-muted);
  }

  #TOC a:hover,
  #TOC a.active {
    color: var(--dn-teal);
  }

  #TOC a.active {
    font-weight: 700;
  }
}

#TOC,
#TOC ul,
#TOC li {
  box-sizing: border-box;
  max-width: 100%;
}

#TOC ul {
  columns: 1 !important;
  display: block !important;
  width: auto !important;
}

#TOC li {
  float: none !important;
  position: static !important;
  width: auto !important;
}

table {
  border-color: var(--dn-line);
  width: 100%;
}

thead th {
  background: var(--dn-surface);
  color: var(--dn-teal-dark);
  text-align: left;
}

tbody td:first-child code {
  white-space: nowrap;
}

@media (max-width: 760px) {
  body {
    padding: 0.4rem;
  }

  .site-nav > p {
    flex-wrap: wrap;
  }

  .site-nav .project-home {
    flex-basis: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}
