/* cass-tool.com: tokens, type, chrome and the parts every page shares.
   The palette is the TUI's default theme, Tokyo Night; agent colors are the TUI's own. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2-variations"), url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/mono-latin.woff2") format("woff2-variations"), url("/fonts/mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #0a0b12;
  --bg2: #0d0f18;
  --panel: #10121c;
  --panel2: #151826;
  --raise: #1b1f30;
  --line: rgba(169, 177, 214, 0.11);
  --line2: rgba(169, 177, 214, 0.2);
  --line3: rgba(169, 177, 214, 0.32);
  --ink: #eef1fc;
  --text: #c6cdea;
  --muted: #a0a8cb;
  --faint: #8088ae;
  --blue: #7aa2f7;
  --cyan: #7dcfff;
  --green: #9ece6a;
  --teal: #73daca;
  --amber: #e0af68;
  --orange: #ff9e64;
  --red: #f7768e;
  --purple: #bb9af7;
  --go: #7aa2f7;
  --go-hi: #94b6ff;
  --go-ink: #0a0b12;
  --chapter: var(--blue);
  --focus: #b4c8ff;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1280px;
  --gut: clamp(20px, 4vw, 48px);
  --head: 64px;
  --r1: 6px;
  --r2: 10px;
  --r3: 14px;
  --r4: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head) + 16px);
  background: var(--bg);
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.62 var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
/* Fine grain keeps the large dark fields from banding. Not on phones, where a fixed layer costs scrolling. */
@media (min-width: 900px) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}
img,
svg {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
p {
  margin: 0;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  text-wrap: balance;
}
code,
kbd,
pre,
samp {
  font-family: var(--mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}
:not(pre) > code {
  padding: 0.1em 0.38em;
  border-radius: 5px;
  background: rgba(122, 162, 247, 0.1);
  color: #d7e0ff;
  overflow-wrap: anywhere;
}
/* A short hyphenated token in inline code (a flag such as --db), kept whole: browsers otherwise break after a hyphen.
   A custom element, so no existing span rule styles it. */
no-break {
  white-space: nowrap;
}
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.05em 0.45em;
  border: 1px solid var(--line3);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel2);
  color: var(--ink);
  font-size: 0.78em;
  line-height: 1.6;
  text-align: center;
}
::selection {
  background: rgba(122, 162, 247, 0.35);
  color: #fff;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
[hidden] {
  display: none !important;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.muted {
  color: var(--muted);
}
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gut));
  margin: 0 auto;
  padding: 0 var(--gut);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r2);
  background: var(--go);
  color: var(--go-ink);
  font-weight: 650;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* ---------- Type ---------- */
.d1 {
  font-size: clamp(44px, 6.5vw, 98px);
  line-height: 0.95;
  letter-spacing: -0.052em;
  font-weight: 800;
}
.d2 {
  font-size: clamp(36px, 5.3vw, 74px);
  line-height: 0.98;
  letter-spacing: -0.047em;
  font-weight: 800;
}
.d3 {
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.038em;
  font-weight: 780;
}
em.g {
  font-style: normal;
  color: var(--chapter);
}
/* Headline highlights shade from the chapter's color to a lighter tint of it. */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  :is(.d1, .d2, .d3) em.g {
    background: linear-gradient(96deg, var(--chapter) 10%, color-mix(in srgb, var(--chapter) 52%, #fff) 95%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
}
.lede {
  max-width: 62ch;
  color: var(--text);
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.6;
}
.kick,
.micro {
  font: 600 12px/1.4 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.kick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.kick.small {
  margin-bottom: 12px;
}
.kick a {
  color: inherit;
  text-decoration: none;
}
.kick a:hover {
  color: var(--ink);
}
.dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chapter);
  opacity: 0.5;
}
.dot.on {
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chapter) 22%, transparent);
}
a.txt {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--chapter) 70%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
a.txt:hover {
  text-decoration-color: var(--chapter);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
  font-weight: 620;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn svg {
  width: 17px;
  height: 17px;
}
/* A text link with an arrow: "Read the docs →", "Edit on GitHub ↗". */
.more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 40px;
  color: var(--chapter, var(--blue));
  font-weight: 620;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}
.more svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}
.more:hover svg {
  transform: translateX(3px);
}
.btn:hover {
  border-color: var(--line3);
  background: rgba(255, 255, 255, 0.06);
}
.btn:active {
  transform: translateY(1px);
}
.btn.go {
  border-color: transparent;
  background: var(--go);
  color: var(--go-ink);
}
.btn.go:hover {
  background: var(--go-hi);
}
.btn.sm {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14.5px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.btnrow,
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* A command with a copy button. */
.cmd {
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: var(--panel);
}
.cmd + .cmd {
  margin-top: 10px;
}
.cmd-label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  color: var(--faint);
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cmd pre {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 13px 16px;
  overflow-x: auto;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
  scrollbar-width: thin;
}
.copy {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  margin: 6px;
  padding: 0 12px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.copy svg {
  width: 15px;
  height: 15px;
}
.copy:hover {
  color: var(--ink);
  border-color: var(--line2);
}
.copy.done {
  color: var(--green);
}

/* ---------- Header ---------- */
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--head);
  transition: background 0.2s, border-color 0.2s, backdrop-filter 0.2s;
  border-bottom: 1px solid transparent;
}
body.scrolled .top,
body.solid .top {
  background: rgba(10, 11, 18, 0.86);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(1.3) blur(14px);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
}
.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gut));
  margin: 0 auto;
  padding: 0 var(--gut);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  font-size: 20px;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.mark {
  width: 30px;
  height: 30px;
  color: var(--ink);
}
.chapters {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.chapters a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
}
.chapters a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}
.chapters a[aria-current] {
  color: var(--ink);
  background: color-mix(in srgb, var(--chapter) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chapter) 30%, transparent);
}
.chapters a[aria-current] .dot {
  opacity: 1;
}
.chapters .dot {
  width: 7px;
  height: 7px;
}
.tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toollink {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 560;
  text-decoration: none;
}
.toollink:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}
.find {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line2);
  border-radius: 11px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.find svg {
  width: 16px;
  height: 16px;
}
.find:hover {
  color: var(--ink);
  border-color: var(--line3);
}
.find kbd {
  font-size: 11px;
}
.menu {
  display: none;
  position: relative;
}
.menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
}
.menu summary::-webkit-details-marker {
  display: none;
}
.menu summary svg {
  width: 22px;
  height: 22px;
}
.menu[open] summary {
  background: rgba(255, 255, 255, 0.06);
}
.menu nav {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  display: grid;
  gap: 2px;
  width: min(300px, calc(100vw - 32px));
  max-height: calc(100vh - 90px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line2);
  border-radius: var(--r3);
  background: var(--panel2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.menu nav a:not(.btn) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 560;
}
.menu nav a:not(.btn):hover,
.menu nav a[aria-current] {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}
.menu nav .btn {
  margin-top: 8px;
}
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
}
.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #cc7722, #00c896 50%, #4285f4);
  transform: scaleX(0);
  transform-origin: left;
}
@media (max-width: 1099px) {
  .chapters {
    display: none;
  }
  .bar {
    justify-content: space-between;
  }
  .menu {
    display: block;
  }
  .gh,
  .toollink {
    display: none;
  }
}
@media (max-width: 599px) {
  .find span,
  .find kbd {
    display: none;
  }
  .find {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }
}

/* ---------- Footer ---------- */
.end {
  margin-top: 40px;
  padding: 44px 0 52px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
}
.end .wrap {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 18px 40px;
  align-items: start;
}
.end-brand p {
  margin-top: 10px;
  max-width: 36ch;
  color: var(--muted);
  font-size: 14.5px;
}
.end nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 6px;
}
.end nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
}
.end nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}
.stamp {
  grid-column: 1 / -1;
  color: var(--faint);
  font: 13px/1.5 var(--mono);
}
.stamp a {
  color: inherit;
}
.stamp code {
  background: none;
  padding: 0;
  color: inherit;
}
@media (max-width: 799px) {
  .end .wrap {
    grid-template-columns: 1fr;
  }
  .end nav {
    justify-content: flex-start;
    margin-left: -10px;
  }
}

/* ---------- Search palette ---------- */
.palette {
  width: min(680px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 80px));
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--line2);
  border-radius: var(--r4);
  background: var(--panel2);
  color: var(--text);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.palette[open] {
  display: flex;
  flex-direction: column;
}
.palette::backdrop {
  background: rgba(4, 5, 10, 0.72);
  backdrop-filter: blur(3px);
}
.palette .q {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
}
.palette .q > svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--muted);
}
.palette input {
  flex: 1;
  min-width: 0;
  height: 60px;
  border: 0;
  background: none;
  outline: none;
  font-size: 18px;
  color: var(--ink);
}
.palette input::-webkit-search-cancel-button {
  display: none;
}
.palette .esc {
  padding: 6px 10px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
}
.palette .hits {
  flex: 1;
  overflow: auto;
  padding: 8px;
  overscroll-behavior: contain;
}
.palette .keys {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}
.palette .keys a {
  margin-left: auto;
  color: var(--muted);
}
/* Search results in the palette and on the search page (links; the hero's hits are list items). */
a.hit {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
a.hit:hover,
a.hit[aria-selected="true"] {
  background: rgba(122, 162, 247, 0.1);
}
a.hit .where {
  display: flex;
  gap: 8px;
  color: var(--faint);
  font: 12px/1.4 var(--mono);
}
a.hit .where b {
  color: var(--blue);
  font-weight: 600;
}
a.hit strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-weight: 620;
}
a.hit p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}
a.hit mark,
.results mark {
  background: rgba(122, 162, 247, 0.24);
  color: var(--ink);
  border-radius: 3px;
  padding: 0 2px;
}
.note {
  padding: 18px;
  color: var(--muted);
}
.note .btnrow {
  margin-top: 12px;
}

/* ---------- Entrances ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .js .reveal.seen {
    opacity: 1;
    transform: none;
  }
}
.noscript {
  padding: 14px 16px;
  border-radius: var(--r2);
  background: rgba(247, 118, 142, 0.1);
  color: var(--red);
}

/* ---------- Simple pages ---------- */
.missing,
.searchpage {
  padding-top: calc(var(--head) + 80px);
  padding-bottom: 80px;
  min-height: 70vh;
}
.missing .lede {
  margin: 20px 0 28px;
}
