/* ============================================================
   Клякса — "Connect an agent" page (/<lang>/agents/)
   Reuses tokens, topbar, section heads, feature icons, CTA and
   footer from styles.css; only this page's blocks live here.
   Every word is in the HTML; /js/agents.js adds the client tabs and the
   screenshot lightbox. Without it all guides and configs show in a row.
   ============================================================ */

.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: rgba(228, 87, 46, .5); }
.footer-links a[aria-current="page"] { color: var(--ink); border-bottom-color: transparent; }

.agents { padding-bottom: 4px; }
.agents code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--card);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* ---------- hero ---------- */
.agents-hero { padding: clamp(10px, 2vh, 22px) 0 6px; max-width: 860px; }
.agents-back { font-size: 14px; }
.agents-kicker {
  font-family: var(--font-hand);
  font-size: clamp(22px, 2.6vw, 28px);
  color: var(--accent);
  margin: 14px 0 0;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.agents-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(36px, 5.4vw, 64px);
  line-height: 1;
  margin: 2px 0 0;
  text-wrap: balance;
}
:lang(zh) .agents-title { font-size: clamp(30px, 4.4vw, 52px); line-height: 1.2; word-break: keep-all; }
.agents-lead {
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.5;
  color: var(--muted);
  max-width: 64ch;
  margin: 14px 0 0;
  text-wrap: pretty;
}

/* the MCP address — the one thing to copy from this page */
.mcp-address {
  margin: 22px 0 0;
  background: var(--ink-deep);
  color: var(--paper);
  border-radius: 16px 220px 18px 220px / 220px 16px 220px 18px;
  padding: 16px clamp(16px, 3vw, 26px) 14px;
  box-shadow: 0 10px 28px rgba(38,34,27,.16);
  max-width: 720px;
}
.mcp-address-label { margin: 0 0 6px; font-size: 14px; color: #c9c0af; }
.agents .mcp-address-url {
  display: block;
  background: none;
  padding: 0;
  font-size: clamp(17px, 2.4vw, 24px);
  color: var(--amber);
  user-select: all;
}
.mcp-address-note { margin: 8px 0 0; font-size: 13px; color: #9b9384; }

/* "Klyaksa is free*" */
.free-line { margin: 16px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.free-badge {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  background: var(--amber);
  padding: 4px 12px;
  border-radius: 10px 180px 12px 180px / 180px 11px 180px 12px;
}
.free-note { font-size: 13px; color: var(--muted); }

/* table of contents */
.agents-toc { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 20px 0 0; }
.agents-toc a {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 5px 13px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border: 1.5px solid var(--line);
  border-radius: 12px 200px 14px 200px / 200px 13px 200px 14px;
}
.agents-toc a:hover { color: var(--accent); border-color: rgba(228, 87, 46, .5); }

/* ---------- sections ---------- */
.agents-section {
  margin: 30px 0 0;
  padding-top: 22px;
  border-top: 2px dashed #d8c9a8;
  scroll-margin-top: 16px;
}
.agents-section .section-head { margin-bottom: 16px; }
.agents-section .section-sub code { font-size: 1em; }
.agents-note, .agents-lead-sm {
  margin: 16px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 80ch;
}
.agents-lead-sm { margin: 0 0 16px; }

/* tool groups */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tool-card {
  background: color-mix(in srgb, var(--card) 55%, var(--paper));
  border: 1.5px solid var(--line-2);
  border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px;
  padding: 18px 20px;
}
.tool-card h3 { margin: 8px 0 6px; font-size: 17px; font-weight: 700; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
@media (max-width: 980px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .tool-grid { grid-template-columns: 1fr; } }

/* two ways to connect */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.auth-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px;
  padding: 20px 22px;
}
.auth-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 700; }
.auth-card p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; }
.auth-card .how-btn { margin-top: auto; }
.auth-small { font-size: 13.5px; }
.auth-oauth { background: var(--ink-deep); color: var(--paper); }
.auth-oauth p { color: #c9c0af; }
.auth-oauth b { color: var(--paper); }
.auth-key { background: color-mix(in srgb, var(--card) 55%, var(--paper)); border: 1.5px solid var(--line-2); }
.auth-key p { color: var(--muted); }
.auth-key b { color: var(--ink); }
@media (max-width: 760px) { .auth-grid { grid-template-columns: 1fr; } }

/* a step-by-step guide (one client) */
.guide {
  background: var(--paper-2);
  border: 1.5px solid var(--line-2);
  border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px;
  padding: clamp(16px, 3vw, 26px);
  margin: 0 0 16px;
  scroll-margin-top: 16px;
}
.guide-title { margin: 0 0 10px; font-size: 19px; font-weight: 700; }
.guide-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  font-size: 15px;
  line-height: 1.5;
}
.guide-steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 36px;
  margin-bottom: 8px;
}
.guide-steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: -4px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  color: var(--accent);
}
.guide-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--card);
  border-inline-start: 3px solid var(--amber);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

/* steps of an app guide: each step is a row — number + text on the left,
   its own screenshot on the right (under the text at phone width). A step
   without a screenshot is text only. */
.guide-steps-shots li.step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 12px 28px;
  align-items: start;
  margin: 0;
  padding-block: 16px;
  border-top: 1.5px dashed var(--line);
}
.guide-steps-shots li.step::before { top: 12px; }
.guide-steps-shots li.step:first-child { border-top: 0; padding-top: 4px; }
.guide-steps-shots li.step:first-child::before { top: 0; }
.guide-steps-shots li.step:last-child { padding-bottom: 0; }
.step-text { min-width: 0; padding-top: 2px; }

/* one frame for every screenshot: same column width, height capped so a
   step reads in one screen; a tall shot is scaled down whole (contain), never
   cropped or stretched. width/height attributes keep the box — no CLS. */
.agents .step-shot {
  display: block;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 45%, var(--paper-2));
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color .15s;
}
.agents .step-shot:hover { border-color: rgba(228, 87, 46, .55); }
.agents .step-shot:focus-visible,
.agents .tab:focus-visible,
.lightbox-close:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
.step-shot img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
}
@media (max-width: 760px) {
  .guide-steps-shots li.step { grid-template-columns: minmax(0, 1fr); }
  .step-shot img { max-height: 420px; }
}

/* client tabs (built by agents.js; without JS there are none and every
   panel shows) */
.tablist { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 16px; }
.agents .tab {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 15px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border: 1.5px solid var(--line);
  border-radius: 12px 200px 14px 200px / 200px 13px 200px 14px;
  cursor: pointer;
}
.agents .tab:hover { color: var(--accent); border-color: rgba(228, 87, 46, .5); }
.agents .tab[aria-selected="true"] {
  background: var(--ink-deep);
  border-color: var(--ink-deep);
  color: var(--paper);
  cursor: default;
}
.tabset > [hidden] { display: none; }
.tabset.is-tabbed > .guide { margin-bottom: 0; }
.snippet-grid.is-tabbed { grid-template-columns: minmax(0, 1fr); max-width: 860px; }

/* screenshot lightbox (<dialog>, built by agents.js) */
.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  /* the dialog covers the whole viewport, so it carries the dimming itself */
  background: rgba(33, 29, 23, .96);
  color: var(--paper);
  cursor: zoom-out;
}
.lightbox::backdrop { background: transparent; }
.lightbox-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px clamp(56px, 7vw, 96px) 18px;
}
.lightbox-img {
  display: block;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.lightbox-cap {
  margin: 0;
  max-width: 80ch;
  font-size: 14.5px;
  line-height: 1.45;
  text-align: center;
  color: var(--paper);
}
.lightbox-cap b { color: var(--amber); }
.lightbox-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 14px;
  background: var(--paper);
  color: var(--ink);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
body.lightbox-open { overflow: hidden; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.lightbox-nav[hidden] { display: none; }
.lightbox-nav:hover { background: var(--amber); }
.lightbox-nav:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.lightbox-prev { inset-inline-start: clamp(8px, 2vw, 24px); }
.lightbox-next { inset-inline-end: clamp(8px, 2vw, 24px); }
.lightbox-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper);
  opacity: .8;
  font-variant-numeric: tabular-nums;
}
.lightbox-count:empty { display: none; }
@media (max-width: 640px) {
  /* on a phone the arrows sit over the image edges, swipe is the main way */
  .lightbox-inner { padding-inline: 12px; }
  .lightbox-nav { width: 40px; height: 40px; font-size: 18px; }
}

/* config snippets */
.snippet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.snippet-card {
  min-width: 0;
  background: color-mix(in srgb, var(--card) 55%, var(--paper));
  border: 1.5px solid var(--line-2);
  border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px;
  padding: 18px 20px;
  scroll-margin-top: 16px;
}
.snippet-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.snippet-file { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.agents pre.snippet {
  margin: 0;
  background: var(--ink-deep);
  color: var(--paper);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}
.agents pre.snippet code { background: none; padding: 0; font-size: 1em; overflow-wrap: normal; white-space: pre; }
.snippet-note { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
@media (max-width: 860px) { .snippet-grid { grid-template-columns: minmax(0, 1fr); } }

/* FAQ */
.faq { display: grid; gap: 10px; max-width: 860px; }
.faq-item {
  background: var(--paper-2);
  border: 1.5px solid var(--line-2);
  border-radius: 14px 20px 12px 18px / 18px 12px 20px 14px;
  padding: 12px 18px;
}
.faq-item > summary { cursor: pointer; font-weight: 700; font-size: 16px; }
.faq-item > summary:hover { color: var(--accent); }
.faq-item p { margin: 10px 0 2px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.faq-item b { color: var(--ink); }

.agents .cta { margin-top: 34px; }
