@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/space-grotesk-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/space-grotesk-bold.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/* IBM Plex Mono has no box-drawing glyphs; DejaVu Sans Mono draws the tree lines. */
@font-face {
  font-family: 'Fensu Box Drawing';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/dejavu-sans-mono-diagram.woff2') format('woff2');
  unicode-range: U+2500-259F;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --bg: #fff;
  --fg: #171a1f;
  --muted: #626a76;
  --panel: #f8f9fb;
  --line: #d7dce3;
  --faint-line: #e9ecf1;
  --orange: #ff730a;
  --link: #ac4200;
  --button-fg: #171a1f;
  --mark: #f46400;
  --success: #16825c;
  --mono: 'IBM Plex Mono', 'Fensu Box Drawing', ui-monospace, monospace;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0f12;
  --fg: #e9ebef;
  --muted: #a3aab6;
  --panel: #171a1f;
  --line: #414752;
  --faint-line: #2a2f37;
  --orange: #ff8736;
  --link: #ff9e5c;
  --mark: #ff6a0a;
  --success: #54cf8e;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: Inter, system-ui, sans-serif; font-size: 16px; line-height: 1.55; }
button { font: inherit; }
button[hidden] { display: none; }
a { color: var(--link); text-underline-offset: 4px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 2px; }
svg { flex: none; }
code { font-family: var(--mono); font-weight: 400; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.035em; }
h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 750; }
h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; }
.wrap { width: min(100% - 80px, 1200px); margin-inline: auto; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 12px 16px; background: var(--bg); }
.site-header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--faint-line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 24px; }
.brand-lockup { display: grid; flex: none; }
.brand-byline { display: flex; align-items: center; min-height: 24px; margin-inline-start: 44%; color: var(--muted); font: 500 11px/14px 'Space Grotesk', Inter, sans-serif; text-decoration: none; white-space: nowrap; }
.brand { display: inline-flex; flex: none; }
.brand img { height: 30px; width: auto; }
.brand .logo-dark, .icon-sun { display: none; }
[data-theme='dark'] .brand .logo-light, [data-theme='dark'] .icon-moon { display: none; }
[data-theme='dark'] .brand .logo-dark, [data-theme='dark'] .icon-sun { display: block; }
nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
nav a { color: var(--fg); font-weight: 500; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 6px; white-space: nowrap; }
.nav-icon { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; color: var(--muted); }
.nav-icon svg { width: 18px; height: 18px; }
.theme-toggle { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Hero: the headline beside the Fensu mark, which picks the output in the window under it. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 40px; align-items: center; padding: 88px 0 72px; }
.eyebrow { color: var(--muted); font-size: 15px; margin-bottom: 24px; }
h1 { font-size: clamp(42px, 5vw, 62px); font-weight: 780; letter-spacing: -0.05em; line-height: 1.05; text-wrap: balance; }
.lede { font-size: 20px; line-height: 1.6; color: var(--muted); margin-top: 24px; max-width: 600px; text-wrap: balance; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 18px; border: 1px solid var(--line); border-radius: 2px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--fg); }
.button.primary { background: var(--orange); border-color: var(--orange); color: var(--button-fg); }
.command { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; font-size: 12px; line-height: 1.7; }
.command code { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.command code span { color: var(--muted); }
.install { font-size: 13px; min-height: 46px; }
.copy { flex: none; border: 1px solid var(--line); border-radius: 2px; background: var(--bg); padding: 4px 8px; color: var(--muted); font-family: Inter, sans-serif; font-size: 12px; cursor: pointer; }

/* The script (fence.js) sets --panes-max to the tallest pane, so the hero keeps its height when the
   output switches. Without the script the mark stays hidden and the first pane shows alone. */
.hv-fence { --mark-height: 230px; display: grid; align-content: start; width: min(560px, 100%); min-height: calc(var(--mark-height) + var(--panes-max, 0px) + 40px); font-family: var(--mono); }
.fence-mark { position: relative; height: var(--mark-height); }
.hv-fence:not(.is-ready) .fence-mark { display: none; }
.fence-mark canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; }
.fence-label { position: absolute; left: var(--x, 0); top: var(--y, 0); padding: 4px 0; border: 0; background: none; color: var(--muted); font: 700 18px 'Space Grotesk', Inter, sans-serif; white-space: nowrap; cursor: pointer; }
.fence-label[data-side='-1'] { transform: translate(calc(-100% - 36px), -50%); }
.fence-label[data-side='1'] { transform: translate(36px, -50%); }
.fence-label::after { content: ''; position: absolute; top: 50%; width: 24px; border-top: 1px dotted currentColor; }
.fence-label[data-side='-1']::after { right: -32px; }
.fence-label[data-side='1']::after { left: -32px; }
.fence-label[aria-selected='true'] { color: var(--link); }
.hv-window { overflow: hidden; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); }
.hv-bar { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--faint-line); color: var(--muted); font-size: 11px; }
.hv-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint-line); }
.hv-bar span { margin-left: 8px; }
.hv-panes { overflow: hidden; }
.hv-fence.is-ready .hv-panes { transition: height 0.3s ease; }
.hv-panes > pre { padding: 18px 20px 20px; border: 0; background: transparent; white-space: normal; font-size: 11px; line-height: 1.7; overflow: hidden; }

/* Terminal output, one span per line. Long lines wrap under their label (`= help: `) instead of
   scrolling sideways; --hang is that label's offset in ch. */
.terminal { margin: 0; padding: 22px 24px; background: var(--panel); color: var(--fg); font-family: var(--mono); font-size: 12px; line-height: 1.65; overflow-x: auto; white-space: pre; }
.terminal .ln { display: block; white-space: pre-wrap; padding-left: var(--hang, 0); text-indent: calc(-1 * var(--hang, 0)); min-height: 1lh; }
.terminal .cmd { font-weight: 500; }
.terminal .cmd::before { content: '$ '; color: var(--muted); font-weight: 400; }
.terminal .dim, .terminal .tl .note { color: var(--muted); }
.terminal .code, .terminal .tl.hot .nm, .terminal .tl.hot .note { color: var(--link); }
.terminal .code { font-weight: 500; }
.terminal .ok { color: var(--success); }
.terminal .strong { font-weight: 500; }
/* The project tree above the output; the files a fault is about light up. */
.terminal .tl-rule { display: block; margin: 12px 0; border-bottom: 1px solid var(--faint-line); }

/* Walkthrough: on wide screens, a list of the steps beside one step at a time (site.js). */
.workflow { padding: 72px 0; border-top: 1px solid var(--faint-line); }
.section-head { max-width: 68ch; margin-bottom: 40px; }
.section-head p { margin-top: 14px; color: var(--muted); font-size: 17px; }
.steps { display: grid; gap: 16px; }
.step { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.step .terminal { border-left: 1px solid var(--faint-line); }
.step-text { padding: 28px; }
.step-text .num { display: block; margin-bottom: 12px; color: var(--link); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.step-text h3 { font-size: 18px; }
.step-text p { margin-top: 10px; color: var(--muted); font-size: 15px; }
.step-text .more { margin-top: 14px; font-size: 14px; }
.step-text .more a { text-decoration: none; }
.step-text code, .caption code { padding: 1px 4px; border-radius: 2px; background: rgba(255, 115, 10, 0.1); color: var(--fg); font-size: 0.86em; }
.step-group { margin-top: 24px; color: var(--muted); font-size: 13px; font-weight: 600; }
.step-group:first-child { margin-top: 0; }
.caption { margin-top: 16px; color: var(--muted); font-size: 13px; }
.step-nav { display: none; }

.closing { text-align: center; padding: 56px 0; border-top: 1px solid var(--faint-line); }
.closing h2 { font-size: clamp(26px, 2.7vw, 32px); }
.closing-lede { margin-top: 12px; color: var(--muted); font-size: 16px; }
.closing .actions { justify-content: center; margin-top: 24px; }
.closing p:last-child { color: var(--muted); font-size: 12px; margin-top: 18px; }

footer.wrap { padding-block: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-main, .sqlstack-family { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sqlstack-family { flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--faint-line); }
.sqlstack-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); text-decoration: none; }
.sqlstack-brand img { width: 28px; height: auto; }
.sqlstack-dark, [data-theme='dark'] .sqlstack-light { display: none; }
[data-theme='dark'] .sqlstack-dark { display: block; }
footer nav { font-size: 13px; }
.sqlstack-family nav { flex-wrap: wrap; gap: 8px 20px; }
.sqlstack-family nav a { color: var(--muted); }

@media (hover: hover) {
  nav a:hover { text-decoration-color: var(--orange); }
  .brand-byline:hover, .sqlstack-brand:hover { color: var(--fg); text-decoration: underline; }
  .nav-icon:hover, .theme-toggle:hover, .fence-label:hover { color: var(--fg); }
  .fence-label[aria-selected='true']:hover { color: var(--link); }
  .button:hover, .copy:hover { border-color: var(--link); }
  .primary:hover { background: var(--link); color: var(--bg); }
  .step-text .more a:hover { text-decoration: underline; }
}

@media (min-width: 881px) {
  .stepper { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
  .stepper .terminal { border-left: none; border-top: 1px solid var(--faint-line); font-size: 13px; }
  .stepper .step-text p { max-width: 62ch; }
  .step-nav { display: grid; gap: 2px; }
  .step-nav-group { margin: 18px 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
  .step-nav-group:first-child { margin-top: 0; }
  .step-nav button { display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; border: 0; border-left: 2px solid var(--faint-line); background: none; color: var(--muted); font-size: 15px; text-align: left; cursor: pointer; }
  .step-nav button:hover { color: var(--fg); }
  .step-nav button[aria-current] { border-left-color: var(--orange); color: var(--fg); font-weight: 600; }
  .step-nav .n { color: var(--link); font-family: var(--mono); font-size: 13px; font-weight: 500; }
  /* Every step sits in the same cell, so the panel keeps the tallest step's height. */
  .stepper .steps { display: grid; }
  .stepper .step-group { display: none; }
  .stepper .step { grid-area: 1 / 1; grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-self: stretch; visibility: hidden; }
  .stepper .step.is-active { visibility: visible; }
  .stepper .step:focus { outline: none; }
}

/* Below 1200px the headline needs the full width, so the mark and output move under it. */
@media (max-width: 1199px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hv-fence { justify-self: start; }
}

@media (max-width: 880px) {
  .step { grid-template-columns: 1fr; }
  .step .terminal { border-left: none; border-top: 1px solid var(--faint-line); }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 40px); }
  .header-inner { gap: 16px; }
  .brand img { height: 26px; }
  nav { gap: 12px; }
  .nav-icon, .theme-toggle { width: 36px; height: 36px; }
  .hide-sm { display: none; }
  .hero { padding: 44px 0 40px; gap: 32px; }
  h1 { font-size: clamp(40px, 9vw, 56px); }
  .eyebrow { margin-bottom: 18px; font-size: 13px; }
  .lede { font-size: 18px; margin-top: 20px; }
  .actions { margin-top: 24px; }
  .workflow { padding: 48px 0; }
  .section-head p { font-size: 16px; }
  .step-text { padding: 20px; }
  .terminal { padding: 18px 16px; }
  .closing { text-align: left; }
  .closing .actions { justify-content: flex-start; }
  footer nav { gap: 16px; }
}

@media (max-width: 620px) {
  .hv-fence { --mark-height: 220px; justify-self: stretch; }
  /* The labels become a row under the mark. */
  .fence-mark { display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: 2px 16px; padding-bottom: 6px; }
  .fence-label, .fence-label[data-side='-1'], .fence-label[data-side='1'] { position: relative; left: auto; top: auto; transform: none; font-size: 14px; }
  .fence-label::after { display: none; }
  /* The examples' source lines fit at this width, so the carets stay under what they point at. */
  .hv-panes > pre { padding: 16px; font-size: 10px; line-height: 1.6; }
  /* On phones the tree keeps only the folders and the lit files. */
  .terminal .tl:not(.hot):not(.dir) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .hv-fence.is-ready .hv-panes { transition: none; }
}
