/* ==========================================================================
   Gradien — Core docs (V3)
   Shared presentation for public/core/docs/** — the hub (index.html) and
   every article page. Built exclusively on design-system.css tokens: no
   serif type, no legacy per-page tokens (--surface, --rule, --quiet, etc).
   Depends on /styles/design-system.css (loaded first).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared shell — two-column layout (article: .doc-shell, hub: .shell)
   -------------------------------------------------------------------------- */
.doc-shell,
.shell {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 880px);
  gap: clamp(36px, 5vw, 72px);
  padding: clamp(40px, 6vw, 72px) var(--gutter) 96px;
  max-width: var(--container-max);
  margin-inline: auto;
}

main { min-width: 0; }

.side-nav {
  position: sticky;
  top: 96px;
  align-self: start;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.side-nav p {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.side-nav a {
  display: block;
  padding: 8px 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.side-nav a:hover { color: var(--ink); transform: translateX(2px); }

/* --------------------------------------------------------------------------
   Article hero (.doc-hero) + shared eyebrow
   -------------------------------------------------------------------------- */
.doc-hero {
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: block;
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.doc-hero h1 {
  font-family: var(--font-sans);
  font-size: var(--text-h2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  max-width: 720px;
}
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   Buttons — shared by article pages and the hub
   -------------------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h);
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-ui);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.button:hover { background: var(--surface-soft); border-color: var(--ink); }
.button.primary { border-color: var(--black); background: var(--black); color: var(--white); }
.button.primary:hover { background: #262626; border-color: #262626; color: var(--white); }

/* --------------------------------------------------------------------------
   Setup request / prompt card — shared (hub uses .prompt-card-header,
   article pages use .prompt-head — same visual treatment)
   -------------------------------------------------------------------------- */
.setup-request { padding: 42px 0 48px; border-bottom: 1px solid var(--line); }
.setup-request h2 {
  margin: 0 0 12px;
  font-family: var(--font-sans);
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-heading);
  color: var(--text-primary);
}
.setup-request p { margin: 0 0 22px; color: var(--text-muted); max-width: 72ch; }

.prompt-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--white);
  box-shadow: var(--shadow-md);
  padding: clamp(20px, 3vw, 30px);
}
.prompt-head,
.prompt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.prompt-head p,
.prompt-card-header p { margin: 0; color: var(--text-muted); max-width: 660px; }

.prompt-card pre, .doc-body pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--black);
  color: var(--white);
}
.prompt-card pre { margin: 0; }
.doc-body pre { margin: 18px 0 26px; }

.prompt-card code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
.prompt-card pre code, .doc-body pre code {
  display: block;
  background: transparent;
  border: 0;
  color: var(--white);
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Copy field / copy button — shared; keeps positioning + is-copied swap
   -------------------------------------------------------------------------- */
.copy-field { position: relative; min-width: 0; }
.copy-field pre { padding-right: 64px !important; }
.copy-button {
  position: absolute !important;
  top: 12px;
  right: 12px;
  width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--white) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out) !important;
}
.copy-button:hover { background: rgba(255, 255, 255, 0.16) !important; border-color: rgba(255, 255, 255, 0.42) !important; transform: translateY(-1px); }
.copy-button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.copy-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-icon-check { display: none; }
.copy-button.is-copied .copy-icon-copy { display: none; }
.copy-button.is-copied .copy-icon-check { display: block; }

/* --------------------------------------------------------------------------
   Article body (.doc-body)
   -------------------------------------------------------------------------- */
.doc-body { padding-top: 48px; }
.doc-body h2, .doc-body h3, .doc-body h4, .doc-body h5 {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.doc-body h2 { font-size: var(--text-h3); line-height: var(--leading-heading); margin: 40px 0 14px; }
.doc-body h3 { font-size: var(--text-title); line-height: var(--leading-snug); margin: 32px 0 12px; }
.doc-body h4, .doc-body h5 { font-size: var(--text-body-lg); line-height: var(--leading-snug); margin: 24px 0 10px; }
.doc-body p, .doc-body li {
  font-size: var(--text-ui);
  line-height: var(--leading-relaxed, 1.65);
  color: var(--ink-body);
  max-width: 72ch;
  overflow-wrap: anywhere;
}
.doc-body p { margin: 0 0 16px; }
.doc-body a { color: var(--text-link); }
.doc-body ul, .doc-body ol { margin: 16px 0 24px; padding-left: 1.2em; max-width: 72ch; }
.doc-body li { margin: 8px 0; }
.doc-body strong { color: var(--text-primary); font-weight: var(--weight-medium); }
.doc-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  color: var(--text-primary);
  padding: 2px 5px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Some legacy article pages still use the revamp `.article-body` shell while
   sharing this docs stylesheet. Keep long MCP URLs and setup commands inside
   the article column at narrow viewports. */
.article-body { min-width: 0; }
.article-body code,
.doc-footer code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding-top: 24px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Hub (/core/docs/) — hero with side illustration, path list, prompt
   section, four-step grid, manual setup cards, agent-guide card grid,
   reference list. All rules below are scoped under .shell so they can
   never affect article pages (which use .doc-shell) or the small set of
   docs pages that load /styles/revamp.css instead of this template.
   ========================================================================== */

.shell .hero {
  padding: 0 0 72px;
  border-bottom: 1px solid var(--line);
}
.shell section {
  padding: var(--section-y-tight, 76px) 0;
  border-bottom: 1px solid var(--line);
}
.shell .docs-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(320px, 1fr);
  gap: clamp(34px, 5vw, 70px);
  align-items: center;
}
.shell .hero h1 {
  font-family: var(--font-sans);
  font-size: var(--text-h1);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  max-width: 660px;
}
.shell .lead {
  max-width: 780px;
  margin: var(--space-3) 0 0;
  font-size: var(--text-lead);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}
.shell .hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--space-4); }
.shell .muted { color: var(--text-muted); max-width: 780px; }
.shell h2 {
  font-family: var(--font-sans);
  font-size: var(--text-h2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  max-width: 760px;
  margin: 0 0 18px;
}

/* --- Doc-path / reference link lists --- */
.link-list { display: grid; gap: 10px; margin-top: 16px; }
.link-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
.link-list a strong { color: var(--text-primary); font-weight: var(--weight-medium); }
.link-list a span { color: var(--text-muted); font-size: var(--text-sm); }
.link-list a:hover strong { color: var(--text-link); }

/* --- Interactive doc-navigator illustration (hero side visual) --- */
.docs-navigator {
  position: relative;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, rgba(5, 5, 5, .05) 1px, transparent 1px),
    linear-gradient(rgba(5, 5, 5, .05) 1px, transparent 1px),
    var(--surface-soft);
  background-size: 36px 36px;
  overflow: hidden;
}
.doc-fragment, .doc-node {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.doc-fragment { width: 164px; padding: 12px; }
.doc-fragment span, .doc-node span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.doc-fragment strong, .doc-node strong { display: block; font-size: 13px; line-height: 1.25; }
.doc-fragment p, .doc-node p { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.35; }
.doc-node {
  left: 50%;
  top: 50%;
  width: min(260px, 58%);
  transform: translate(-50%, -50%);
  padding: 20px;
  border-color: var(--ink);
}
.doc-fragment:nth-child(1) { left: 7%; top: 10%; }
.doc-fragment:nth-child(2) { right: 8%; top: 15%; }
.doc-fragment:nth-child(3) { left: 9%; bottom: 12%; }
.doc-fragment:nth-child(4) { right: 11%; bottom: 14%; }
.doc-fragment:nth-child(5) { left: 38%; top: 7%; }
.doc-path { position: absolute; left: 18%; right: 18%; top: 50%; height: 1px; background: var(--text-tertiary); }

/* --- Four-step "what changes after setup" grid (Cards: steps) --- */
.docs-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.docs-flow article {
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.docs-flow article:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.docs-flow span {
  display: block;
  margin-bottom: 28px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.docs-flow strong { display: block; margin-bottom: 7px; font-size: var(--text-body-lg); font-weight: var(--weight-medium); color: var(--text-primary); }
.docs-flow p { color: var(--text-muted); font-size: var(--text-sm); line-height: var(--leading-body); }

.value-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; padding: 0; list-style: none; }
.value-list li { margin: 0; color: var(--ink-body); }
.value-list li strong { display: block; margin-bottom: 6px; color: var(--text-primary); font-weight: var(--weight-medium); }

/* --- Manual setup cards (Cards: manual setup) --- */
.cli-install-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: clamp(22px, 3vw, 34px);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.cli-install-panel:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.cli-install-panel h3 {
  margin-bottom: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-title);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.command-box { min-width: 0; }
.command-box .copy-button { width: 100%; margin-bottom: 12px; }
.command-box pre {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.path-label {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* --- Agent-specific guides (Cards: agent guides) --- */
.provider-groups { display: grid; gap: 28px; margin-top: 30px; }
.provider-group { padding-top: var(--space-2); border-top: 1px solid var(--line); }
.provider-group:first-child { padding-top: 0; border-top: 0; }
.provider-title {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.provider-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.provider-link {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  text-decoration: none;
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.provider-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.provider-link strong { display: block; font-size: var(--text-body-lg); font-weight: var(--weight-medium); color: var(--text-primary); line-height: 1.3; }
.provider-link span { display: block; margin-top: 6px; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.45; }

/* ==========================================================================
   Responsive — shared 860px (sidebar collapses to a wrapping row above the
   content) and 520px (buttons full width) behaviors for both templates.
   ========================================================================== */
@media (max-width: 1020px) {
  .docs-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .provider-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .doc-shell, .shell { grid-template-columns: 1fr; gap: 28px; }
  .side-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    position: static;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 18px;
  }
  .side-nav p { flex-basis: 100%; margin-bottom: 8px; }
  .side-nav a { display: inline-flex; padding: 5px 0; }
  .prompt-head, .prompt-card-header { flex-direction: column; }
  .doc-body { padding-top: 44px; }

  .shell .docs-hero-grid { grid-template-columns: 1fr; }
  .docs-flow { grid-template-columns: 1fr; }
  .value-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .button { width: 100%; }
  .provider-links { grid-template-columns: 1fr; }

  /* Hero illustration: absolutely-positioned fragments don't have room to
     breathe in a single narrow column, so stack them as plain full-width
     rows instead. */
  .docs-navigator { min-height: auto; display: grid; gap: 10px; padding: 16px; }
  .doc-fragment, .doc-node {
    position: relative;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100%;
    transform: none;
  }
  .doc-path { display: none; }
}
