/* ChipPilot docs handoff implementation */

body.docs-page {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

.docs-page .nav-links a.is-active,
.docs-page .nav-links a.active {
  color: var(--acc);
  background: var(--acc-soft);
  position: relative;
}

.docs-page .nav-links a.is-active::after,
.docs-page .nav-links a.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  border-radius: 1px;
  background: var(--acc);
}

.docs-page .nav-theme {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-1);
  background: transparent;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.docs-page .nav-theme:hover {
  border-color: var(--fg-3);
  color: var(--fg);
  background: var(--bg-2);
}

.docs-page .nav-theme svg {
  width: 16px;
  height: 16px;
}

.docs-bg {
  position: fixed;
  inset: 64px 0 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--acc) 5%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--acc) 5%, transparent) 1px, transparent 1px);
  background-size: 96px 96px;
  background-position: -1px -1px;
  opacity: 0.6;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 0%, transparent 75%);
}

.docs-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px var(--pad) 120px;
}

.docs-side {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
}

.docs-side::-webkit-scrollbar {
  width: 6px;
}

.docs-side::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}

.docs-filter {
  position: relative;
  margin-bottom: 24px;
}

.docs-filter input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg-2);
  color: var(--fg);
  font: 13px var(--f-sans);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.docs-filter input::placeholder {
  color: var(--fg-3);
}

.docs-filter input:focus {
  border-color: var(--acc-line);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.docs-filter svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  color: var(--fg-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.docs-side h4 {
  margin: 18px 4px 10px;
  color: var(--fg-3);
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.docs-nav a {
  display: block;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.3;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}

.docs-nav a:hover {
  color: var(--fg);
  background: var(--bg-2);
}

.docs-nav a.is-active {
  color: var(--acc);
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

.docs-nav a.is-hidden {
  display: none;
}

.side-foot {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.side-foot p {
  margin: 0 0 10px;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.4;
}

.side-foot .btn {
  width: 100%;
  height: 32px;
  justify-content: center;
  padding: 0 12px;
  font-size: 12px;
}

.docs-main {
  min-width: 0;
}

.doc-section {
  position: relative;
  padding: 56px 0;
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 84px;
}

.doc-section-first {
  padding-top: 16px;
  border-top: 0;
}

.anchor-alias {
  position: absolute;
  top: -84px;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  margin-bottom: 28px;
  padding: 0 14px;
  border: 1px solid var(--acc-line);
  border-radius: 999px;
  background: var(--acc-soft);
  color: var(--acc);
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.doc-eyebrow .sq {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--acc);
}

.doc-section h1 {
  max-width: 14ch;
  margin: 0 0 28px;
  color: var(--fg);
  font-size: clamp(40px, 5.4vw, 68px);
  font-weight: 480;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.doc-section h2 {
  margin: 0 0 18px;
  color: var(--fg);
  font-size: clamp(32px, 3.4vw, 44px);
  letter-spacing: -0.028em;
  line-height: 1.05;
}

.doc-lead {
  max-width: 68ch;
  color: var(--fg-2);
  font-size: 15.5px;
  line-height: 1.6;
}

.doc-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 78ch;
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 7%, transparent);
  color: color-mix(in srgb, var(--warn) 90%, var(--fg));
  font-size: 13.5px;
  line-height: 1.55;
}

.doc-note .ico {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--warn);
}

.intent-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 32px;
  margin-top: 32px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.intent-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--acc);
  opacity: 0.6;
}

.intent-code {
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.65;
}

.intent-code .tok {
  margin-right: 8px;
  color: var(--acc);
}

.intent-text p {
  color: var(--fg-1);
  font-size: 14.5px;
  line-height: 1.6;
}

.intent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tag {
  padding: 5px 10px;
  border: 1px solid var(--acc-line);
  border-radius: var(--radius-sm);
  background: var(--acc-soft);
  color: var(--acc);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-grid {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.card-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.d-card {
  position: relative;
  padding: 20px 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.d-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}

.d-card .k {
  display: block;
  margin-bottom: 14px;
  color: var(--acc);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.d-card h3 {
  margin: 0 0 8px;
  color: var(--fg);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.d-card p {
  margin: 0;
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.55;
}

.pilot-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.pilot-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}

.pilot-step:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}

.pilot-step .n {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--acc-line);
  border-radius: 6px;
  background: var(--acc-soft);
  color: var(--acc);
  font-family: var(--f-mono);
  font-size: 13px;
}

.pilot-step .txt {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.55;
}

.pilot-step .txt b {
  color: var(--fg);
  font-weight: 500;
}

.doc-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 22px 24px;
  border: 1px solid var(--acc-line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--acc) 10%, transparent), transparent 60%),
    var(--surface);
}

.doc-cta h3 {
  margin: 0 0 4px;
  color: var(--fg);
  font-size: 18px;
  font-weight: 500;
}

.doc-cta p {
  max-width: 56ch;
  margin: 0;
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.55;
}

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--acc-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--acc);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover {
  transform: translateY(-2px);
  background: var(--acc-soft);
}

.to-top svg {
  width: 16px;
  height: 16px;
}

.docs-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 28px var(--pad);
  border-top: 1px solid var(--hairline);
  color: var(--fg-3);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.docs-footer a {
  color: var(--fg-2);
}

.docs-footer a:hover {
  color: var(--acc);
}

:root[data-theme="light"] .docs-bg {
  opacity: 0.75;
}

:root[data-theme="light"] .docs-page .nav-theme {
  background: var(--surface);
}

@media (max-width: 980px) {
  .card-grid.cols-3,
  .card-grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .docs-page .nav-cta {
    display: flex;
  }

  .docs-page .nav-menu-button {
    display: none;
  }

  .docs-shell {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 24px;
  }

  .docs-side {
    position: relative;
    top: auto;
    max-height: none;
    padding: 0;
  }

  .docs-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .side-foot {
    margin-top: 18px;
  }
}

@media (max-width: 760px) {
  .intent-card {
    grid-template-columns: 1fr;
    padding: 20px;
  }
}

@media (max-width: 720px) {
  .doc-cta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .docs-shell {
    padding-bottom: 88px;
  }

  .docs-page .nav-inner {
    gap: 12px;
  }

  .docs-page .nav-cta {
    gap: 8px;
  }

  .docs-page .nav-cta .btn--primary {
    padding: 0 14px;
    font-size: 11px;
  }

  .docs-nav,
  .card-grid.cols-2,
  .card-grid.cols-3,
  .card-grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .doc-section {
    padding: 44px 0;
  }

  .doc-section h1 {
    max-width: 12ch;
  }

  .pilot-step {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 16px;
  }

  .to-top {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 420px) {
  .docs-page .nav-cta .btn--primary {
    padding: 0 11px;
    font-size: 10.5px;
    letter-spacing: 0.04em;
  }

  .docs-page .nav-cta .btn--primary .arr {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  .docs-page *,
  .docs-page *::before,
  .docs-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
