/* =========================================================================
   instagram-mcp-ai — documentation site styles
   Self-contained, dependency-free. System font stack (no web fonts).
   Dark by default, light-aware via prefers-color-scheme. Warm Instagram-
   adjacent gradient accent (original — no logos or brand marks).
   ========================================================================= */

:root {
  color-scheme: dark light;

  /* Warm gradient accent */
  --accent: #ff5a7e;
  --accent-2: #b45cff;
  --accent-strong: #ff90a8;
  --accent-ink: #2a0810;
  --accent-soft: rgba(255, 90, 126, 0.1);
  --accent-border: rgba(255, 90, 126, 0.24);
  --grad: linear-gradient(120deg, #feca57 0%, #ff6b8b 42%, #d648c4 74%, #8a5cff 100%);
  --grad-soft: linear-gradient(120deg, rgba(254, 202, 87, 0.16), rgba(214, 72, 196, 0.16), rgba(138, 92, 255, 0.16));

  /* Surfaces (dark, faintly plum-tinted) */
  --bg: #120a10;
  --bg-alt: #150b12;
  --surface: #1a1019;
  --surface-2: #22152400;
  --surface-2: #221525;
  --card: #18101b;
  --code-bg: #130a13;
  --code-text: #ecdfe8;

  /* Lines */
  --border: rgba(255, 255, 255, 0.09);
  --hair: rgba(255, 255, 255, 0.08);

  /* Text */
  --text: #efe4ec;
  --heading: #fbf4f8;
  --text-2: #dccfd8;
  --muted: #ab99a6;
  --muted-2: #94818e;
  --dim: #776573;

  /* Status */
  --read: #5fb1ff;
  --write: #ffb64d;
  --danger: #ff6b6b;
  --ok: #43d19e;

  /* Shape */
  --radius: 14px;
  --radius-sm: 9px;

  /* Widths */
  --maxw: 1280px;
  --content-w: 900px;
  --sidebar-w: 262px;
  --topbar-h: 58px;

  /* Fonts — system stacks only */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbf7f9;
    --bg-alt: #f6eef3;
    --surface: #ffffff;
    --surface-2: #fbf3f8;
    --card: #ffffff;
    --code-bg: #2a1622;
    --code-text: #f3e7ef;

    --border: rgba(30, 12, 24, 0.12);
    --hair: rgba(30, 12, 24, 0.1);

    --text: #33232d;
    --heading: #1c0f18;
    --text-2: #4a3742;
    --muted: #6b5561;
    --muted-2: #7d6873;
    --dim: #9a8593;

    --accent: #d6247e;
    --accent-2: #8a3ab9;
    --accent-strong: #b81f6c;
    --accent-ink: #ffffff;
    --accent-soft: rgba(214, 36, 126, 0.08);
    --accent-border: rgba(214, 36, 126, 0.22);
  }
}

/* ------------------------------------------------------------------ reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 14px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

/* --------------------------------------------------------------- backdrop */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 15% -5%, rgba(254, 202, 87, 0.12), transparent 60%),
    radial-gradient(55% 55% at 92% 4%, rgba(138, 92, 255, 0.14), transparent 62%),
    radial-gradient(70% 60% at 50% 108%, rgba(214, 72, 196, 0.1), transparent 60%);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    linear-gradient(var(--hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--hair) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  opacity: 0.5;
}

/* ------------------------------------------------------------- skip link */
.skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: top 0.16s ease;
}
.skip-link:focus {
  top: 12px;
  text-decoration: none;
}

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
}

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:hover {
  border-color: var(--accent-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--heading);
  font-weight: 600;
}
.brand:hover {
  text-decoration: none;
}
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font-size: 17px;
  flex: 0 0 auto;
  box-shadow: 0 2px 12px rgba(214, 72, 196, 0.35);
}
.brand .name {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand .name .dim {
  color: var(--muted-2);
  font-weight: 400;
}

.spacer {
  flex: 1 1 auto;
}

.toplinks {
  display: flex;
  align-items: center;
  gap: 4px;
}
.toplinks a {
  color: var(--text-2);
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 14px;
}
.toplinks a:hover {
  color: var(--heading);
  background: var(--surface);
  text-decoration: none;
}
.toplinks a.sponsor {
  color: var(--accent-strong);
}

.ver-pill {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
.gh-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
}
.gh-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* --------------------------------------------------------------- backdrop */
.backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: 89;
  background: rgba(0, 0, 0, 0.5);
}
.backdrop.show {
  display: block;
}

/* ----------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 34px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 6px 40px 0;
  scrollbar-width: thin;
}
.sidebar h4 {
  margin: 18px 0 6px;
  padding: 0 8px;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sidebar nav {
  display: flex;
  flex-direction: column;
}
.sidebar nav a {
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  border-left: 2px solid transparent;
}
.sidebar nav a:hover {
  color: var(--heading);
  background: var(--surface);
  text-decoration: none;
}
.sidebar nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* ---------------------------------------------------------------- content */
.content {
  min-width: 0;
  padding: 8px 0 96px;
  max-width: var(--content-w);
}
.content section {
  padding-top: 30px;
  margin-top: 22px;
  border-top: 1px solid var(--hair);
}
.content section:first-of-type {
  border-top: none;
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.22;
  font-weight: 650;
}
h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.15rem);
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.95rem);
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  scroll-margin-top: calc(var(--topbar-h) + 14px);
}
h3 {
  font-size: 1.2rem;
  margin: 26px 0 10px;
}
p {
  margin: 0 0 14px;
}
.lead {
  font-size: 1.12rem;
  color: var(--text-2);
}
strong {
  color: var(--heading);
  font-weight: 650;
}

.content ul,
.content ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.content li {
  margin: 5px 0;
}

/* inline code */
code {
  font-family: var(--mono);
  font-size: 0.86em;
}
:not(pre) > code {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

/* anchor link on headings */
.anchor {
  color: var(--dim);
  font-weight: 400;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.14s ease;
  text-decoration: none;
}
h2:hover .anchor {
  opacity: 1;
}

/* ------------------------------------------------------------------- hero */
.hero {
  padding-top: 40px !important;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 40px;
  align-items: center;
}
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  padding: 5px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}
.hero h1 .accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero .lead {
  font-size: 1.16rem;
  color: var(--text-2);
  max-width: 40ch;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 20px;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--heading);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}
.btn:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn.primary {
  background: var(--grad);
  color: #fff;
  border: none;
  box-shadow: 0 6px 22px rgba(214, 72, 196, 0.32);
}
.btn.primary:hover {
  box-shadow: 0 10px 30px rgba(214, 72, 196, 0.42);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.badge.ok {
  color: var(--ok);
  border-color: rgba(67, 209, 158, 0.3);
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --------------------------------------------------------------- terminal */
.hero-visual {
  min-width: 0;
}
.terminal-wrap {
  border-radius: var(--radius);
  padding: 1px;
  background: var(--grad);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: termIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.terminal {
  border-radius: calc(var(--radius) - 1px);
  background: var(--code-bg);
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--hair);
}
.term-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3a2b33;
}
.term-bar .dot:nth-child(1) {
  background: #ff5f57;
}
.term-bar .dot:nth-child(2) {
  background: #febc2e;
}
.term-bar .dot:nth-child(3) {
  background: #28c840;
}
.term-bar .term-label {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
}
.term-bar .term-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}
.term-bar .term-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.8s ease-in-out infinite;
}
.term-body {
  position: relative;
  padding: 16px 16px 20px;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.72;
  color: var(--code-text);
  min-height: 320px;
  overflow: hidden;
}
.term-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 44px;
  background: linear-gradient(180deg, rgba(255, 90, 126, 0.1), transparent);
  animation: scan 5.5s linear infinite;
  pointer-events: none;
}
.term-line {
  white-space: pre-wrap;
  word-break: break-word;
}
.term-line.cmd {
  color: #fff;
}
.term-line.cmd .p {
  color: var(--accent-strong);
}
.term-line.muted {
  color: var(--muted-2);
}
.term-line.tool {
  color: var(--accent-strong);
}
.term-line.ok {
  color: var(--ok);
}
.term-line.wr {
  color: var(--write);
}
.term-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes termIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(67, 209, 158, 0.5);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 5px rgba(67, 209, 158, 0);
  }
}
@keyframes scan {
  0% {
    transform: translateY(-60px);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translateY(360px);
    opacity: 0;
  }
}

/* --------------------------------------------------------------- stat row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-top: 34px;
}
.stat {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-align: center;
}
.stat .n {
  display: block;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.02em;
}
.stat .l {
  font-size: 12px;
  color: var(--muted);
}

/* -------------------------------------------------------------- callout */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--grad-soft);
  margin: 18px 0;
}
.callout p {
  margin: 0;
}
.callout .c-ico {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1.5;
}
.callout.warn {
  border-left-color: var(--write);
  background: rgba(255, 182, 77, 0.08);
}
.callout.security {
  border-left-color: var(--danger);
  background: rgba(255, 107, 107, 0.07);
}

/* ---------------------------------------------------------------- cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}
.card .ico {
  font-size: 24px;
  margin-bottom: 8px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}
.card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

/* ------------------------------------------------------------- code block */
.codeblock {
  position: relative;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  overflow: hidden;
}
.codeblock pre {
  margin: 0;
  padding: 16px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.66;
  color: var(--code-text);
}
.codeblock code {
  font-family: var(--mono);
  color: var(--code-text);
}
.codeblock .lang {
  position: absolute;
  top: 8px;
  right: 46px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  pointer-events: none;
}
.copy-btn {
  position: absolute;
  top: 7px;
  right: 8px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease, border-color 0.14s ease;
}
.codeblock:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}
.copy-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
}
.copy-btn.copied {
  color: var(--ok);
  border-color: rgba(67, 209, 158, 0.4);
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 16px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  background: var(--surface);
  color: var(--heading);
  font-weight: 600;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.req {
  color: var(--accent-strong);
  font-weight: 600;
}
.opt {
  color: var(--muted-2);
}

/* status pills */
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.pill.ro {
  color: var(--read);
  background: rgba(95, 177, 255, 0.12);
  border: 1px solid rgba(95, 177, 255, 0.3);
}
.pill.wr {
  color: var(--write);
  background: rgba(255, 182, 77, 0.12);
  border: 1px solid rgba(255, 182, 77, 0.3);
}
.pill.dz {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.pill.pb {
  color: var(--accent-2);
  background: rgba(180, 92, 255, 0.14);
  border: 1px solid rgba(180, 92, 255, 0.32);
}

/* ------------------------------------------------------------------ tabs */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin: 8px 0 0;
  flex-wrap: wrap;
}
.tab {
  padding: 9px 15px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}
.tab-panels {
  margin-top: 4px;
}
.tab-panel {
  display: none;
  padding-top: 16px;
}
.tab-panel.active {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
  align-items: start;
}
.tab-left h3 {
  margin-top: 0;
}
.tab-left p {
  color: var(--text-2);
  font-size: 14.5px;
}
.tool-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-strong);
  padding: 3px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: var(--accent-soft);
}
.code-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  overflow: hidden;
}
.code-box pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--code-text);
}

/* --------------------------------------------------------------- quickstart */
.qs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.qs-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  counter-reset: qs;
}
.qs-step {
  position: relative;
  padding-left: 44px;
}
.qs-step::before {
  counter-increment: qs;
  content: counter(qs);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.qs-step h3 {
  margin: 3px 0 6px;
  font-size: 1.02rem;
}
.qs-step p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-2);
}
.qs-cmd {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  cursor: pointer;
  position: relative;
  word-break: break-all;
}
.qs-cmd:hover {
  border-color: var(--accent-border);
}
.qs-cmd::after {
  content: "click to copy";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--dim);
  background: var(--code-bg);
  padding-left: 8px;
}
.qs-cmd.copied::after {
  content: "copied ✓";
  color: var(--ok);
}

.qs-config {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.qs-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.qs-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.qs-tab.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.qs-config-body {
  padding: 4px 0 0;
}
.qs-config-path {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
  padding: 10px 14px 0;
}
.qs-config-body pre {
  margin: 0;
  padding: 12px 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--code-text);
}
.qs-note {
  font-size: 13.5px;
  color: var(--muted);
}

/* --------------------------------------------------------------- prompt */
.prompt {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 11px 14px;
  margin: 12px 0;
  font-style: italic;
  color: var(--text-2);
}
.prompt .tag,
.under-hood .tag {
  display: inline-block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: 1px 6px;
  margin-right: 8px;
  vertical-align: middle;
}

/* ----------------------------------------------------------- tools search */
.tools-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  margin: 14px 0 10px;
}
.tools-search:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.ts-glyph {
  color: var(--accent);
  font-family: var(--mono);
}
#tools-filter {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
}
#tools-filter::placeholder {
  color: var(--dim);
}
.ts-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}
.tools-controls {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
}
.ghost-btn {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.ghost-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
}
.tools-empty {
  display: none;
  color: var(--muted);
  font-style: italic;
  padding: 8px 2px;
}
.tools-empty.show {
  display: block;
}

.pkg-meta {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}
.pkg-meta em {
  color: var(--accent-strong);
  font-style: normal;
}
h3.pkg-head {
  scroll-margin-top: calc(var(--topbar-h) + 14px);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hair);
}

details.tool {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  margin: 8px 0;
  overflow: hidden;
}
details.tool[open] {
  border-color: var(--accent-border);
}
.tool-sum {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
  font-weight: 400;
}
details.tool summary {
  cursor: pointer;
  padding: 12px 14px;
  list-style: none;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--heading);
}
details.tool summary::-webkit-details-marker {
  display: none;
}
details.tool summary::before {
  content: "▸";
  color: var(--accent);
  margin-right: 9px;
  display: inline-block;
  transition: transform 0.14s ease;
}
details.tool[open] summary::before {
  transform: rotate(90deg);
}
.tool-params {
  padding: 0 14px 14px;
  border-top: 1px solid var(--hair);
}
.tool-params table {
  font-size: 13px;
}
.tool-params .noparams {
  color: var(--muted);
  font-style: italic;
  margin: 12px 0 0;
}

/* --------------------------------------------------------------- usecase */
.usecase {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px;
  margin: 14px 0;
}
.usecase h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.usecase .who {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-strong);
  margin-bottom: 8px;
}
.usecase p {
  font-size: 14px;
  color: var(--text-2);
}
.under-hood {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.under-hood code {
  font-size: 0.82em;
}
.arrow {
  color: var(--accent);
  margin: 0 2px;
}

/* -------------------------------------------------------------- diagram */
figure.diagram {
  margin: 20px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-x: auto;
}
figure.diagram svg {
  width: 100%;
  height: auto;
  min-width: 460px;
}
.diagram .box {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1;
}
.diagram .box.accent {
  fill: var(--accent-soft);
  stroke: var(--accent-border);
}
.diagram .lbl {
  fill: var(--heading);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
}
.diagram .sub {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
}
.diagram .tag {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.diagram .edge {
  stroke: var(--accent);
  stroke-width: 1.6;
  fill: none;
}
.diagram .ah {
  fill: var(--accent);
}
.diagram .edge-lbl {
  fill: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}
figure.diagram figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------- footer */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 34px 24px 44px;
}
.foot-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-2);
}
.foot-inner strong {
  color: var(--heading);
}
.foot-inner a {
  color: var(--text-2);
}
.foot-inner a:hover {
  color: var(--accent-strong);
}
.disclaimer {
  max-width: var(--maxw);
  margin: 18px auto 0;
  opacity: 0.72;
  font-size: 0.8rem;
  color: var(--muted);
}
.disclaimer strong {
  color: var(--text-2);
}

/* -------------------------------------------------------------- back to top */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 90;
}
.to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.to-top:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(214, 72, 196, 0.3);
}

/* ------------------------------------------------------------ doc search */
.toc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin: 0 8px 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}
.toc-search:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.toc-search-glyph {
  color: var(--accent);
  font-size: 13px;
}
.toc-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.toc-search-input::placeholder {
  color: var(--dim);
}
.toc-search-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
}
.toc-search-empty {
  display: none;
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  padding: 4px 10px;
}
.toc-search-empty.show {
  display: block;
}
mark.doc-hit {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 3px;
  padding: 0 1px;
}
.doc-search-active .content section {
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    order: -1;
  }
  .tab-panel.active,
  .qs-grid {
    grid-template-columns: 1fr;
  }
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 18px;
  }
  .icon-btn {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    height: auto;
    z-index: 95;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    padding: 18px 14px 40px;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .sidebar.open {
    transform: none;
  }
  .toplinks {
    display: none;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15.5px;
  }
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }
  .brand .name {
    font-size: 12.5px;
  }
  .ver-pill {
    display: none;
  }
  .hero-cta .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .term-scan,
  .term-cursor {
    display: none;
  }
}

/* ------------------------------------------------------------------ print */
@media print {
  .topbar,
  .sidebar,
  .to-top,
  .bg-glow,
  .bg-grid,
  .hero-visual,
  .backdrop,
  .tools-search,
  .tools-controls {
    display: none !important;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  body {
    color: #000;
    background: #fff;
  }
  details.tool[open] .tool-params,
  details.tool {
    break-inside: avoid;
  }
}
