/* ============================================================================
   CHAPIEE DOCS — the design system for docs.chapiee.ai.
   ==========================================================================

   ⚠️ This is DELIBERATELY NOT the app's styling, and should stay that way.

   The dashboard is a dense working tool: 13px UI text, cards on a grey ground,
   tight rails, everything reachable without scrolling. Documentation is read,
   not operated — so this is a DOCUMENT, not an interface:

     · 17px body on a ~68ch measure, 1.7 line-height (the app runs 13px/1.5)
     · one flowing column on white, no cards stacked on grey
     · generous vertical rhythm; sections breathe instead of packing in
     · a single sticky contents rail, not a navigation chrome

   What IS shared, because it is the identity rather than the layout: the
   official palette (royal blue #102FD5, cyan #23CAF5, charcoal #231F20) and the
   two brand typefaces — Pixeloid Mono for headings and Poppins for everything
   else. Per the brand hierarchy, those come from the PDF, never from the
   UI-sample HTML.
   ========================================================================== */

:root {
  /* Brand — from Chapiee Brand Guideline.pdf. */
  --blue: #102fd5;
  --blue-700: #0c24a6;
  --blue-100: #e6eafd;
  --blue-050: #f5f7ff;
  --cyan: #23caf5;
  --ice: #b7f0ff;
  --plum: #56006c;

  --ink: #231f20;
  --ink-2: #464143;
  --ink-3: #6f6b6d;
  --ink-4: #9a9698;

  --surface: #ffffff;
  --surface-2: #fafafb;
  --shell: #efeeee;
  --line: #e8e7ea;
  --line-2: #d7d6dc;

  --good: #047857;
  --good-soft: #d9f2e8;
  --warn: #b46b00;
  --warn-soft: #fdf1dc;

  /* A document measure. Everything long-form is capped at this. */
  --measure: 68ch;
  --radius: 10px;
  --rail: 264px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --blue: #4d63e8;
    --blue-700: #3a51e0;
    --blue-100: #232a4d;
    --blue-050: #1b1f33;
    --ink: #f2f0f0;
    --ink-2: #cdc9ca;
    --ink-3: #a6a2a3;
    --ink-4: #7c7879;
    --surface: #1a1718;
    --surface-2: #211d1e;
    --shell: #231f20;
    --line: #332f30;
    --line-2: #454143;
    --good: #34d399;
    --good-soft: #123a2e;
    --warn: #fbbf24;
    --warn-soft: #3a2c0a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* Anchored headings must not hide under the sticky masthead. */
  scroll-padding-top: 88px;
}

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

body {
  background: var(--surface);
  color: var(--ink);
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, sans-serif;
  /* 17px — a reading size. The app uses 13px because it is a control surface. */
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.pixel {
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  letter-spacing: 0.02em;
  font-weight: 400;
}

/* Skip link — keyboard users shouldn't tab the whole contents rail first. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 60;
}
.skip:focus {
  left: 0;
}

/* ------------------------------------------------------------- MASTHEAD */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.masthead-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.masthead .logo {
  height: 26px;
  width: auto;
  flex: 0 0 auto;
}
.masthead .tag {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--line-2);
}
.masthead .spacer {
  margin-left: auto;
}
.masthead .mh-link {
  font-size: 14px;
  color: var(--ink-2);
}
.masthead .mh-link:hover {
  color: var(--blue);
  text-decoration: none;
}
.masthead .mh-cta {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--blue);
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 150ms ease;
}
.masthead .mh-cta:hover {
  background: var(--blue-700);
  text-decoration: none;
}

@media (max-width: 720px) {
  .masthead .tag,
  .masthead .mh-link {
    display: none;
  }
  .masthead-in {
    padding: 0 20px;
  }
}

/* ------------------------------------------------------------------ HERO */
.hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(60ch 40ch at 12% -10%, var(--blue-050), transparent 70%),
    var(--surface);
}
.hero-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 68px 32px 56px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 18px;
}
.hero h1 {
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  font-weight: 400;
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  max-width: 20ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--blue);
}
.hero .lede {
  margin-top: 22px;
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 62ch;
  font-weight: 300;
}
.hero-meta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-size: 14px;
  color: var(--ink-3);
}
.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-meta svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .hero-in {
    padding: 44px 20px 36px;
  }
  .hero .lede {
    font-size: 17px;
  }
}

/* ------------------------------------------------------------------ SHELL */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px 96px;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 20px 72px;
  }
}

/* -------------------------------------------------------------- CONTENTS */
.toc {
  position: sticky;
  top: 92px;
  padding-top: 48px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}
.toc h2 {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
  margin-bottom: 14px;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
}
.toc a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 7px 10px 7px 0;
  font-size: 14.5px;
  color: var(--ink-2);
  border-left: 2px solid transparent;
  padding-left: 14px;
  margin-left: -16px;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}
.toc a::before {
  content: counter(toc);
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink-4);
  flex: 0 0 14px;
}
.toc a:hover {
  color: var(--blue);
  text-decoration: none;
}
.toc a.is-current {
  color: var(--blue);
  font-weight: 500;
  border-left-color: var(--blue);
}
.toc a.is-current::before {
  color: var(--blue);
}
.toc-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-4);
}

@media (max-width: 980px) {
  .toc {
    position: static;
    max-height: none;
    padding: 32px 0 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
  }
}

/* ------------------------------------------------------------------ PROSE */
.prose {
  padding-top: 48px;
  min-width: 0;
}

/* A step — the main unit of this document. */
.step {
  padding: 40px 0 44px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 88px;
}
.step:first-of-type {
  padding-top: 8px;
}
.step:last-of-type {
  border-bottom: none;
}

.step-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.step-n {
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  font-size: 13px;
  color: var(--blue);
  background: var(--blue-100);
  border-radius: 6px;
  padding: 4px 10px;
  flex: 0 0 auto;
}
.step h2 {
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  font-weight: 400;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.step-time {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-4);
  flex: 0 0 auto;
}

.step > p,
.prose > p {
  max-width: var(--measure);
  margin-top: 18px;
  color: var(--ink-2);
  font-weight: 300;
}

.step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 32px;
  max-width: var(--measure);
}

/* --------------------------------------------------------------- TASK LIST */
.tasks {
  list-style: none;
  margin-top: 26px;
  max-width: var(--measure);
  display: grid;
  gap: 2px;
}
.task {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.tasks .task:last-child {
  border-bottom: 1px solid var(--line);
}
.task-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--blue-100);
  color: var(--blue);
  flex: 0 0 auto;
  margin-top: 1px;
}
.task-mark svg {
  width: 14px;
  height: 14px;
}
.task-mark.is-planned {
  background: var(--shell);
  color: var(--ink-4);
}
.task-t {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}
.task-d {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-3);
  font-weight: 300;
}
.task-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
}
.task-link svg {
  width: 14px;
  height: 14px;
}

/* "Not built yet" — never rendered as a link, so nobody clicks into nothing. */
.soon-tag {
  display: inline-block;
  margin-left: 10px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 2px;
  background: var(--shell);
  color: var(--ink-4);
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 500;
}

/* ------------------------------------------------------------------ NOTE */
.note {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 14px;
  max-width: var(--measure);
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--blue-050);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
}
.note svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
  margin-top: 3px;
}
.note.is-warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}
.note.is-warn svg {
  color: var(--warn);
}
.note b {
  font-weight: 600;
}

/* ------------------------------------------------------------------ CODE */
.codeblock {
  max-width: var(--measure);
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.codeblock-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-4);
}
.codeblock-top .spacer {
  margin-left: auto;
}
.copy-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    border-color 140ms ease,
    color 140ms ease;
}
.copy-btn svg {
  width: 13px;
  height: 13px;
}
.copy-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.codeblock pre {
  padding: 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}
.tok-tag {
  color: var(--plum);
}
.tok-attr {
  color: var(--blue);
}
.tok-val {
  color: var(--good);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .tok-tag {
    color: var(--ice);
  }
}

/* Inline code. */
code:not(pre code) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--shell);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ TABLE */
.table-wrap {
  max-width: var(--measure);
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
  background: var(--surface-2);
}
tr:last-child td {
  border-bottom: none;
}
td .val {
  font-family: 'Pixeloid Mono', 'Silkscreen', ui-monospace, monospace;
  font-size: 13px;
  white-space: nowrap;
}

/* ------------------------------------------------------------ CHECKLIST */
.checklist {
  list-style: none;
  max-width: var(--measure);
  margin-top: 24px;
  display: grid;
  gap: 12px;
}
.checklist li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 13px;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
  font-weight: 300;
}
.checklist svg {
  width: 18px;
  height: 18px;
  color: var(--good);
  margin-top: 4px;
}

/* ------------------------------------------------------------------ FOOT */
.docs-foot {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.docs-foot-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  align-items: center;
  font-size: 14px;
  color: var(--ink-3);
}
.docs-foot .spacer {
  margin-left: auto;
}
@media (max-width: 720px) {
  .docs-foot-in {
    padding: 32px 20px 40px;
  }
}
