/* ============================================================
   Docs re-skin (1112): bring /docs onto the homepage visual identity.

   Loaded only by routes/docs.tsx, after c2-page.css. Every rule is scoped
   to body.c2doc (the class the docs layout adds and removes), so the c2
   subpages that share c2-page.css (studio / monitoring / avatar-api /
   voice-api) and the operator console keep their own look.

   Light values are measured off the homepage (/draft/index-8.html):
     ink        #1C2E4A   body copy, headings inside cards
     brand blue #5A86FF   display title, solid CTA, eyebrow, icons
     board      #EAF2FF   card and panel fill
     step       #DBE9FF   one step up: table head, chips
     link       #5A86FF   inline links, same brand blue; hover lifts to #7199FF
     ground     #FFFFFF
   The homepage has no dark version, so dark is derived from the same
   palette: the ink goes down to make the ground, boards step up from it
   in solid fills, and the accent is #83B3FF (never darker on a deep
   surface). Flat fills only: no shadow, no gradient, no outline on cards.
   ============================================================ */

/* ---- tokens: light ---- */
body.c2doc {
  --c2-violet: #5A86FF;
  --c2-violet-deep: #4575C1;
  --c2-accent: #5A86FF;
  --c2-lav: #DBE9FF;
  --c2-lav-hover: #DBE9FF;
  --c2-lav-soft: #EAF2FF;
  --c2-soft-hover: #DBE9FF;
  --c2-ink: #1C2E4A;
  --c2-t1: #1C2E4A;
  --c2-t2: rgba(28, 46, 74, 0.78);
  --c2-t3: rgba(28, 46, 74, 0.66);
  --c2-t4: rgba(28, 46, 74, 0.55);
  --c2-cream: #EAF2FF;
  --c2-ground: #FFFFFF;
  --c2-surface: #EAF2FF;
  --c2-raise: #DBE9FF;
  --c2-underline: #99BFFC;
  --c2-hair: rgba(28, 46, 74, 0.09);

  /* docs-only roles */
  --c2doc-blue: #5A86FF;        /* accent that is allowed to be blue: icons, rails, dots */
  --c2doc-board: #EAF2FF;
  --c2doc-step: #DBE9FF;
  --c2doc-link: #5A86FF;
  --c2doc-link-hover: #7199FF;
  --c2doc-slash: #99BFFC;
  --c2doc-cta-bg: #5A86FF;
  --c2doc-cta-fg: #FFFFFF;
  --c2doc-cta-hover: #4575C1;
  --c2doc-chip-hover: #FFFFFF;  /* Copy button hover inside the code head */

  /* shape */
  --c2-r-card: 16px;
  --c2-r-pill: 999px;
}

/* ---- tokens: dark ---- */
html[data-theme="dark"] body.c2doc {
  --c2-violet: #83B3FF;
  --c2-violet-deep: #99BFFC;
  --c2-accent: #83B3FF;
  --c2-lav: #25395A;
  --c2-lav-hover: #2F4670;
  --c2-lav-soft: #1A2A44;
  --c2-soft-hover: #25395A;
  --c2-ink: #F4F8FF;
  --c2-t1: #F4F8FF;
  --c2-t2: #C7D5EA;
  --c2-t3: #A9BAD3;
  --c2-t4: #91A3BF;
  --c2-cream: #1A2A44;
  --c2-ground: #101B2D;
  --c2-surface: #1A2A44;
  --c2-raise: #25395A;
  --c2-underline: rgba(153, 191, 252, 0.55);
  --c2-hair: rgba(219, 233, 255, 0.14);

  --c2doc-blue: #83B3FF;
  --c2doc-board: #1A2A44;
  --c2doc-step: #25395A;
  --c2doc-link: #99BFFC;
  --c2doc-link-hover: #99BFFC;
  --c2doc-slash: rgba(219, 233, 255, 0.45);
  --c2doc-cta-bg: #83B3FF;
  --c2doc-cta-fg: #1C2E4A;
  --c2doc-cta-hover: #99BFFC;
  --c2doc-chip-hover: #2F4670;

  /* the homepage bunny on a deep surface: white face, features in the ground */
  --narya-bunny-ink: #101B2D;
}
html:has(body.c2doc) { background: #FFFFFF; }
html[data-theme="dark"]:has(body.c2doc) { background: #101B2D; }

/* ============================================================ top bar */
body.c2doc .c2doc-lockup { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
body.c2doc .c2p-brand { gap: 8px; align-items: center; align-self: center; }
body.c2doc .c2p-brand .c2doc-bun { width: 22px; height: 22px; display: block; flex: none; }
body.c2doc .c2p-brand b {
  font-size: 20px; font-weight: 800; line-height: 1;
  letter-spacing: -0.01em; text-transform: uppercase;
  color: var(--c2doc-blue);
  transition: color 0.16s ease;
}
body.c2doc .c2p-brand:hover b { color: var(--c2doc-link-hover); }
html[data-theme="dark"] body.c2doc .c2p-brand b { color: #FFFFFF; }
html[data-theme="dark"] body.c2doc .c2p-brand:hover b { color: #DBE9FF; }

/* "/Docs": a path segment after the wordmark, its own link back to the docs index */
body.c2doc .c2doc-top-tag {
  display: inline-flex; align-items: baseline; gap: 1px; align-self: center;
  font-size: 18px; font-weight: 500; line-height: 1;
  letter-spacing: -0.005em; text-transform: none;
  color: var(--c2-ink);
  transition: color 0.16s ease;
}
body.c2doc .c2doc-top-tag i {
  font-style: normal; font-weight: 400;
  color: var(--c2doc-slash);
  transition: color 0.16s ease;
}
body.c2doc .c2doc-top-tag:hover,
body.c2doc .c2doc-top-tag:hover i { color: var(--c2doc-blue); }

/* Home: a plain text nav item, the way the homepage nav sets Docs / Pricing */
body.c2doc .c2doc-home {
  display: inline-flex; align-items: center; height: 40px; padding: 0 8px;
  font-size: 15px; font-weight: 500; line-height: 1;
  color: var(--c2doc-blue);
  transition: color 0.16s ease;
}
body.c2doc .c2doc-home:hover { color: var(--c2-ink); }

/* Log in / Dashboard: the homepage "Sign in" pill */
body.c2doc .c2p-back {
  height: 40px; padding: 0 16px; border-radius: 12px;
  font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
  background: var(--c2doc-cta-bg); color: var(--c2doc-cta-fg);
}
body.c2doc .c2p-back:hover { transform: none; background: var(--c2doc-cta-hover); }

/* theme pill: the selected side is a solid accent chip, the other a bare icon */
body.c2doc .c2p-lang { background: var(--c2doc-board); }
body.c2doc .c2p-lang button { color: var(--c2-t3); }
body.c2doc .c2p-lang button:hover { background: none; color: var(--c2-ink); }
body.c2doc .c2p-lang button.is-on,
body.c2doc .c2p-lang button.is-on:hover { background: var(--c2doc-cta-bg); color: var(--c2doc-cta-fg); }

/* ============================================================ type */
/* one sans family everywhere except code */
body.c2doc .c2doc-side-label,
body.c2doc .c2doc-eyebrow,
body.c2doc .c2d-kicker,
body.c2doc .c2p-block-no,
body.c2doc .c2doc-onthis p,
body.c2doc .c2d-code-head span,
body.c2doc .c2d-steps li::before,
body.c2doc .c2doc-updown small,
body.c2doc .c2doc-main span.rounded-full.font-mono {
  font-family: var(--c2-font);
}
body.c2doc .c2doc-side-label,
body.c2doc .c2doc-eyebrow,
body.c2doc .c2d-kicker,
body.c2doc .c2p-block-no,
body.c2doc .c2doc-onthis p,
body.c2doc .c2d-code-head span { letter-spacing: 0.12em; font-weight: 600; }

/* display title in the brand blue, like the homepage headline */
body.c2doc .c2doc-h1 { color: var(--c2doc-blue); }

/* ============================================================ buttons */
body.c2doc .c2d-btn {
  min-height: 40px; padding: 0 18px;
  font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
}
body.c2doc .c2d-btn:hover { transform: none; }
body.c2doc .c2doc-page .c2d-btn { background: var(--c2doc-board); color: var(--c2-ink); }
body.c2doc .c2doc-page .c2d-btn:hover { background: var(--c2doc-step); }
body.c2doc .c2doc-page .c2d-btn.is-solid { background: var(--c2doc-cta-bg); color: var(--c2doc-cta-fg); }
body.c2doc .c2doc-page .c2d-btn.is-solid:hover { background: var(--c2doc-cta-hover); }
body.c2doc .c2d-code-head button { letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 12px; }

/* ============================================================ sidebar
   Text-only list in four quiet groups (overview / products / guides /
   developer reference). Groups are separated by space and a hairline, not
   headings. The current page is an ink label on a soft pill; Elsewhere is
   a smaller, lighter set of outbound links so it stops reading as more
   chapters. */
body.c2doc .c2doc-shell {
  grid-template-columns: clamp(244px, 18vw, 272px) minmax(0, 1fr) clamp(180px, 14vw, 224px);
}
body.c2doc .c2doc-side { padding: 28px 16px 40px 20px; }
body.c2doc .c2doc-side-label { padding: 0 12px; margin-bottom: 10px; font-size: 11px; }
body.c2doc .c2doc-onthis p { font-size: 11px; }
body.c2doc .c2doc-side nav { gap: 0; }
body.c2doc .c2doc-nav-group { display: flex; flex-direction: column; gap: 2px; }
body.c2doc .c2doc-nav-group + .c2doc-nav-group {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--c2-hair);
}
body.c2doc .c2doc-nav {
  padding: 8px 12px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; line-height: 1.3;
  color: var(--c2-t2); white-space: nowrap;
}
body.c2doc .c2doc-nav:hover { background: none; color: var(--c2-ink); }
body.c2doc .c2doc-nav[aria-current="page"],
body.c2doc .c2doc-nav[aria-current="page"]:hover {
  background: var(--c2doc-board); color: var(--c2-ink); font-weight: 700;
}
/* Elsewhere: secondary outbound links */
body.c2doc .c2doc-side nav + .c2doc-side-label.is-elsewhere {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--c2-hair);
}
body.c2doc .c2doc-elsewhere { gap: 0; }
body.c2doc .c2doc-elsewhere .c2doc-nav {
  padding: 5px 12px; border-radius: 0;
  font-size: 13.5px; font-weight: 400; color: var(--c2-t3);
  justify-content: flex-start; gap: 5px;
}
body.c2doc .c2doc-elsewhere .c2doc-nav:hover { background: none; color: var(--c2doc-link); }
body.c2doc .c2doc-side .c2doc-elsewhere a.c2doc-nav::after { margin-left: 0; color: currentColor; opacity: 0.7; }

/* ============================================================ On this page
   hairline rail as a border (no box-shadow anywhere in the shell) */
body.c2doc .c2doc-onthis a {
  box-shadow: none;
  border-left: 1px solid var(--c2-hair);
  padding-left: 11px;
  transition: color 0.14s ease, border-color 0.14s ease;
}
body.c2doc .c2doc-onthis a.is-on {
  box-shadow: none;
  border-left: 2px solid var(--c2doc-blue);
  padding-left: 10px;
  color: var(--c2-ink);
}

/* ============================================================ content */
/* inline links: the one place link blue is allowed */
body.c2doc .c2d-a { color: var(--c2doc-link); }
body.c2doc .c2d-a:hover { color: var(--c2doc-link-hover); text-decoration-color: var(--c2doc-link-hover); }

/* inside cards: copy and labels stay ink, never blue.
   Components colour their accents with var(--c2-accent) inline, so the
   token is re-pointed to ink inside every card surface; line icons get
   the blue back explicitly (bare stroke, no tile). */
body.c2doc .c2doc-main :is(
  .c2p-block, .c2d-steps, .c2d-kv, .c2d-check, .c2d-example,
  .c2d-tablewrap, .c2d-note, .c2d-code, .overflow-hidden.rounded-2xl, .rounded-2xl.p-5
) { --c2-accent: var(--c2-ink); }
body.c2doc .c2doc-main svg.lucide { color: var(--c2doc-blue) !important; }
body.c2doc .c2doc-main .c2d-check li::before { background: var(--c2doc-blue); }
body.c2doc .c2doc-main span.rounded-full.font-mono { color: var(--c2-ink) !important; }
body.c2doc .c2doc-main .c2d-code-head span { color: var(--c2-t3); }
body.c2doc .c2doc-main .c2p-block .c2doc-pkg { color: var(--c2-ink); background: var(--c2doc-step); }

/* fills: cards sit on the ground as boards; anything nested steps up one
   level, so there is never a white strip inside a tinted block */
body.c2doc .c2p-block { background: var(--c2doc-board); }
body.c2doc .c2doc-main :is(
  .c2p-block, .c2d-steps, .c2d-kv, .c2d-check, .c2d-example,
  .c2d-tablewrap, .c2d-note, .overflow-hidden.rounded-2xl, .rounded-2xl.p-5
) code:not(pre code) { background: var(--c2doc-step); }
body.c2doc .c2d-code-head { background: var(--c2doc-step); }
body.c2doc .c2d-code-head button { background: var(--c2doc-board); color: var(--c2-ink); }
body.c2doc .c2d-code-head button:hover { background: var(--c2doc-chip-hover); }
body.c2doc .c2doc-main .rounded-xl.font-mono { background: var(--c2doc-step); }
body.c2doc .c2doc-updown button:hover { background: var(--c2doc-step); }

/* dark: c2-page.css strips card fills in dark and draws columns with a top
   hairline. The homepage language is solid boards in both themes, so the
   boards come back here and that variant is switched off. */
html[data-theme="dark"] body.c2doc .c2d-grid { gap: clamp(10px, 1.1vw, 18px); }
html[data-theme="dark"] body.c2doc .c2d-grid .c2p-block {
  padding: clamp(20px, 2.1vw, 36px);
  background: var(--c2doc-board);
  border-radius: var(--c2-r-card);
  border-top: 0;
}
html[data-theme="dark"] body.c2doc .c2d-grid .c2p-block:hover { transform: translateY(-3px); }
html[data-theme="dark"] body.c2doc .c2d-grid .c2p-block-no {
  margin-bottom: clamp(14px, 1.4vw, 24px);
  color: var(--c2-t4);
}
html[data-theme="dark"] body.c2doc .c2d-grid button.c2p-block:hover h3 { color: inherit; }
html[data-theme="dark"] body.c2doc .c2doc-main .c2d-grid .c2p-block .c2doc-pkg { background: var(--c2doc-step); }
html[data-theme="dark"] body.c2doc .c2d-grid + .c2d-note { margin-top: clamp(14px, 1.4vw, 22px); }
html[data-theme="dark"] body.c2doc .c2d-note { background: var(--c2doc-board); }

/* TTS page language select: drawn to match, no boxed native look */
body.c2doc .c2doc-main [data-slot="select-trigger"] {
  height: 40px; padding: 0 14px;
  border: 0; border-radius: 12px;
  background: var(--c2doc-board); color: var(--c2-ink);
}
body.c2doc .c2doc-main [data-slot="select-trigger"]:hover { background: var(--c2doc-step); }
body.c2doc [data-slot="select-content"] {
  --accent: var(--c2doc-step); --accent-foreground: var(--c2-ink);
  border: 0; border-radius: 12px;
  background: var(--c2doc-board); color: var(--c2-ink);
}

/* ============================================================ breakpoints */
@media (max-width: 1180px) {
  body.c2doc .c2doc-shell { grid-template-columns: 244px minmax(0, 1fr); }
}
/* 900 and below: the sidebar is one horizontally scrolling strip under the
   top bar. Same grouping, drawn as thin vertical dividers between groups. */
@media (max-width: 900px) {
  body.c2doc .c2doc-shell { grid-template-columns: minmax(0, 1fr); }
  body.c2doc .c2doc-side { padding: 10px var(--c2-pad); gap: 0; }
  body.c2doc .c2doc-side nav { flex-direction: row; align-items: center; gap: 0; flex: none; }
  body.c2doc .c2doc-nav-group { flex-direction: row; gap: 2px; flex: none; }
  body.c2doc .c2doc-nav-group + .c2doc-nav-group {
    margin: 0 0 0 8px; padding: 0 0 0 8px;
    border-top: 0; border-left: 1px solid var(--c2-hair);
  }
  body.c2doc .c2doc-nav { padding: 8px 14px; }
  body.c2doc .c2doc-elsewhere {
    margin-left: 8px; padding-left: 8px;
    border-left: 1px solid var(--c2-hair);
  }
  body.c2doc .c2doc-elsewhere .c2doc-nav { padding: 8px 10px; }
  body.c2doc .c2p-brand b { font-size: 18px; }
  body.c2doc .c2p-brand .c2doc-bun { width: 20px; height: 20px; }
  body.c2doc .c2doc-top-tag { font-size: 16px; }
  html[data-theme="dark"] body.c2doc .c2d-grid { gap: clamp(10px, 1.1vw, 18px); }
  html[data-theme="dark"] body.c2doc .c2d-grid .c2p-block { padding: clamp(20px, 2.1vw, 36px); }
}
/* phones: the wordmark folds away, leaving bunny + /Docs, so logo, Home,
   theme and Log in still sit on one row */
@media (max-width: 480px) {
  body.c2doc .c2doc-top { gap: 8px; }
  body.c2doc .c2p-nav-right { gap: 6px; }
  body.c2doc .c2doc-lockup { gap: 6px; }
  body.c2doc .c2p-brand b {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  body.c2doc .c2p-back { padding: 0 12px; }
  body.c2doc .c2p-lang button { padding: 6px 8px; }
}
