/* 24Bit System documentation
   Design language matched to 24bitsystem.com (tokens: navy / purple / blue gradient). */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* brand palette, mirrored from 24bitsystem.com */
  --white: #ffffff;
  --black: #000000;
  --primary: #0b1f3a;
  --secondary: #5f7398;
  --brand: #7b3fe4;
  --accent: #1e90ff;
  --brand-ink: #183b73;
  --brand-gradient: linear-gradient(135deg, #1e90ff 0%, #7b3fe4 100%);
  --surface-soft: #eef4ff;
  --surface-soft-2: #f8fbff;
  --neutral-50: #fafafa;
  --neutral-100: #f4f4f5;
  --neutral-200: #e4e4e7;
  --neutral-300: #d4d4d8;
  --neutral-400: #a1a1aa;
  --neutral-500: #71717a;
  --neutral-600: #52525b;
  --neutral-700: #3f3f46;
  --neutral-800: #27272a;
  --neutral-900: #0b1f3a;
  --body: #fcfbf8;

  --line: rgba(123, 63, 228, 0.1);
  --line-soft: rgba(11, 31, 58, 0.08);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 32px;
  --shadow-card: 0 8px 20px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04),
    inset 0 1px rgba(255, 255, 255, 0.9);
  --shadow-float: 0 14px 40px rgba(53, 35, 92, 0.08), inset 0 1px rgba(255, 255, 255, 0.72);
  --maxw: 1320px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--primary);
  background-color: var(--body);
  background-image: radial-gradient(circle at top left, rgba(123, 63, 228, 0.035), rgba(123, 63, 228, 0) 28%),
    radial-gradient(circle at top right, rgba(30, 144, 255, 0.05), rgba(30, 144, 255, 0) 26%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand-ink);
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover {
  color: var(--brand);
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
}
code {
  background: var(--surface-soft-2);
  border: 1px solid var(--line-soft);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  color: var(--brand-ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 12px 0;
  background: var(--primary);
  color: #fff;
}
.skip:focus {
  left: 0;
  color: #fff;
}

/* ---------- floating pill header ---------- */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px 14px 12px 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(44px);
  -webkit-backdrop-filter: blur(44px);
  border: 1px solid rgba(123, 63, 228, 0.1);
  box-shadow: var(--shadow-float);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  line-height: 0;
}
.brand img {
  display: block;
  height: 52px;
  width: auto;
}
.brand-tag {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  padding: 4px 9px 5px;
  border-radius: 99px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.12), rgba(123, 63, 228, 0.14));
  box-shadow: inset 0 0 0 1px rgba(123, 63, 228, 0.16);
  background-clip: padding-box;
  color: var(--brand-ink);
  text-decoration: none;
}
.brand:hover {
  color: var(--primary);
}

.crumbs {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--secondary);
}
.crumbs a {
  color: var(--secondary);
}
.crumbs a:hover {
  color: var(--brand);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 99px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-ink);
  cursor: pointer;
  background: radial-gradient(62.56% 62.56% at 28.14% -10.42%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
    linear-gradient(0deg, var(--surface-soft-2), var(--surface-soft-2));
  box-shadow: 0 -3px rgba(204, 221, 255, 0.9) inset, 0 1px rgba(255, 255, 255, 0.8) inset,
    0 8px 18px rgba(11, 31, 58, 0.08);
  border: 1px solid rgba(30, 144, 255, 0.12);
  transition: all 0.3s ease;
}
.menu-toggle:hover {
  color: var(--brand);
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 36px;
  width: min(var(--maxw), calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 96px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 22px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  font-size: 15px;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--neutral-200);
  border-radius: 99px;
}

.sidebar-title {
  margin: 22px 0 8px;
  padding-left: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
}
.sidebar-title:first-child {
  margin-top: 0;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li a {
  display: block;
  padding: 9px 12px;
  border-radius: 99px;
  color: var(--primary);
  font-weight: 500;
  transition: background 0.25s ease, color 0.25s ease;
}
.sidebar li a:hover {
  background: var(--surface-soft);
  color: var(--brand);
  text-decoration: none;
}
.sidebar li a.active {
  background: radial-gradient(62.56% 62.56% at 28.14% -10.42%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(30, 144, 255, 0.14), rgba(123, 63, 228, 0.16));
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(123, 63, 228, 0.14);
}

.content {
  min-width: 0;
}

/* ---------- typography ---------- */

.content h1 {
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--primary);
}

.content h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--primary);
  margin: 56px 0 18px;
  padding-bottom: 14px;
  position: relative;
}
.content h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 92px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.12), rgba(123, 63, 228, 0.68));
}

.content h3,
.content h3.subhead {
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 32px 0 10px;
  color: var(--primary);
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--secondary);
  margin: 0 0 34px;
  max-width: 46rem;
}

.muted {
  color: var(--secondary);
}

.note {
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
  border-left: 3px solid rgba(123, 63, 228, 0.4);
  color: var(--secondary);
  font-size: 15px;
}

.callout {
  margin: 32px 0;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.07), rgba(123, 63, 228, 0.09));
  border: 1px solid rgba(123, 63, 228, 0.14);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.7);
}
.callout strong {
  color: var(--brand-ink);
}
.callout p {
  margin: 8px 0 0;
}

/* ---------- cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 16px;
  margin: 20px 0 8px;
}

.card {
  display: block;
  padding: 24px 26px;
  border-radius: var(--radius);
  color: var(--primary);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 247, 255, 0.94));
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(123, 63, 228, 0.06);
  transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}
.card:hover {
  text-decoration: none;
  color: var(--primary);
  transform: translateY(-3px);
  border-color: rgba(123, 63, 228, 0.22);
  box-shadow: 0 14px 34px rgba(53, 35, 92, 0.1), 0 0 40px rgba(123, 63, 228, 0.06),
    inset 0 1px rgba(255, 255, 255, 0.9);
}
.card-title {
  display: block;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.card-text {
  display: block;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--secondary);
}

/* ---------- pill button (matches .tf-btn) ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 26px;
  border-radius: 99px;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: #fff;
  background: radial-gradient(62.56% 62.56% at 28.14% -10.42%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #3f237b, #5e31c8 44%, #7b3fe4);
  box-shadow: 0 -3px rgba(61, 32, 122, 0.34) inset, 0 1px rgba(255, 255, 255, 0.28) inset,
    0 12px 28px rgba(63, 35, 123, 0.18), 0 20px 40px rgba(123, 63, 228, 0.18);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.button:hover {
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  background: radial-gradient(62.56% 62.56% at 50% -13%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #49288e, #6938d8 44%, #8a55f2);
  box-shadow: 0 -3px rgba(61, 32, 122, 0.38) inset, 0 1px rgba(255, 255, 255, 0.34) inset,
    0 14px 30px rgba(63, 35, 123, 0.26), 0 24px 46px rgba(123, 63, 228, 0.26),
    0 0 60px rgba(123, 63, 228, 0.15);
}

.button--sm {
  padding: 10px 18px;
  font-size: 14px;
  line-height: 20px;
  gap: 8px;
}

/* ---------- stats ---------- */

.stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
}
.stats li {
  padding: 12px 20px;
  border-radius: 99px;
  background: var(--surface-soft-2);
  border: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--secondary);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.9);
}
.stats strong {
  display: inline-block;
  margin-right: 4px;
  font-size: 18px;
  color: var(--primary);
  letter-spacing: -0.02em;
}

/* ---------- table of contents ---------- */

.toc {
  margin: 0 0 36px;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--surface-soft-2);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.8);
}
.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 32px;
}
.toc li {
  margin: 4px 0;
  break-inside: avoid;
  font-size: 14.5px;
}
.toc a {
  color: var(--primary);
}
.toc a:hover {
  color: var(--brand);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 18px 0 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: #fff;
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
}
th {
  background: var(--neutral-100);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: var(--surface-soft-2);
}
td strong {
  font-weight: 600;
  color: var(--primary);
}

code.id {
  background: none;
  border: 0;
  padding: 0;
  color: var(--neutral-500);
  font-size: 12px;
  white-space: normal;
}

/* ---------- accordions ---------- */

.entry {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.entry[open] {
  border-color: rgba(123, 63, 228, 0.2);
}
.entry > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: background 0.25s ease;
}
.entry > summary::-webkit-details-marker {
  display: none;
}
.entry > summary::before {
  content: "+";
  display: inline-block;
  width: 16px;
  color: var(--brand);
  font-weight: 700;
}
.entry[open] > summary::before {
  content: "\2212";
}
.entry > summary:hover {
  background: var(--surface-soft-2);
}
.entry > *:not(summary) {
  padding-left: 20px;
  padding-right: 20px;
}
.entry > .table-wrap {
  margin: 4px 0 18px;
  box-shadow: none;
}
.entry > p:last-child {
  margin-bottom: 18px;
}
.entry-name {
  flex: 1 1 auto;
  letter-spacing: -0.01em;
}

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--brand-ink);
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.14), rgba(123, 63, 228, 0.16));
  box-shadow: inset 0 0 0 1px rgba(123, 63, 228, 0.16);
}

/* ---------- figures ---------- */

figure {
  margin: 24px 0 32px;
}
.content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: #fff;
  box-shadow: var(--shadow-card);
}
figcaption {
  margin-top: 10px;
  font-size: 14px;
}

/* ---------- content lists ---------- */

.content ul,
.content ol {
  padding-left: 22px;
}
.content li {
  margin: 7px 0;
}
.content ul li::marker {
  color: var(--brand);
}
.content ol li::marker {
  color: var(--brand);
  font-weight: 600;
}

.content p {
  max-width: 62rem;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 26px;
  }
}

@media (max-width: 760px) {
  .topbar .button {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    top: 8px;
    border-radius: 24px;
    padding: 10px 12px 10px 18px;
  }
  .crumbs {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 20px;
  }
  .sidebar {
    display: none;
    position: static;
    max-height: none;
    margin-bottom: 24px;
  }
  .sidebar.open {
    display: block;
  }
  .toc ol {
    columns: 1;
  }
  .content h2 {
    margin-top: 44px;
  }
}

@media (max-width: 520px) {
  .brand img {
    height: 44px;
  }
  .brand-tag {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .sidebar,
  .menu-toggle {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .layout {
    display: block;
    width: 100%;
    padding: 0;
  }
  .entry {
    break-inside: avoid;
  }
}
