/* ============================================================================
   KOBIL Agent Trust — Developer Portal component layer

   REQUIRES styles.css to be linked BEFORE this file. This is a component
   layer only: it defines no tokens of its own and resolves
   --bg --surface --surface-2 --surface-3 --border --border-light
   --text --text-secondary --text-muted --blue --blue-dim --violet
   --violet-dim --cyan --emerald --amber --amber-dim --radius --sans
   --mono and the @property --angle conic border from styles.css.
   Tokens are deliberately NOT duplicated here, so there is a single
   source of truth and no chance of the two files drifting apart.
   ============================================================================ */

body {
  background:
    #eef1f7;
}

/* ----- portal sub-navigation ----- */
.portal-subnav { position: sticky; top: 0; z-index: 40; background: rgba(238,241,247,.78); backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--border); }
.portal-subnav .inner { max-width: 1080px; margin: 0 auto; display: flex; gap: 9px; padding: 13px 24px; overflow-x: auto; align-items: center; }
.portal-subnav .brand { font-family: var(--mono); font-size: .78rem; color: var(--green-ink); margin-right: 16px; white-space: nowrap; opacity: .9; }
.portal-subnav a { font-family: var(--sans); font-size: .9rem; font-weight: 700; color: var(--text); text-decoration: none; padding: 9px 18px; border-radius: var(--w12); white-space: nowrap; border: 1px solid var(--border-light); background: rgba(255,255,255,.03); transition: all .18s ease; }
.portal-subnav a:hover { color: var(--text); background: rgba(91,135,248,.12); border-color: rgba(91,135,248,.45); transform: translateY(-1px); box-shadow: 0 6px 18px -10px rgba(41,98,246,.6); }
.portal-subnav a.active { color: #fff; background: linear-gradient(135deg, rgba(41,98,246,.38), rgba(112,41,246,.38)); border-color: rgba(91,135,248,.55); box-shadow: 0 0 0 1px rgba(91,135,248,.3), 0 8px 24px -10px rgba(41,98,246,.8); }

/* ----- layout ----- */
.portal-main { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 60px 24px 100px; }
.portal-main.narrow { max-width: 960px; }

/* ----- hero ----- */
.p-hero { text-align: center; margin-bottom: 30px; }
.eyebrow, .p-hero .eyebrow { display: block; font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: .48px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 14px; }
.p-hero h1 { font-family: var(--display); font-size: clamp(2.1rem, 5vw, 3.3rem); font-weight: 700; color: var(--text); margin: 0 0 14px; line-height: 1.08; letter-spacing: -.03em; }
.p-hero h1 .grad, .grad { background: linear-gradient(135deg, var(--blue) 0%, var(--violet) 50%, var(--cyan) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.p-hero p { color: var(--text-secondary); font-size: 1.1rem; max-width: 730px; margin: 0 auto; line-height: 1.65; }

/* ----- section ----- */
.p-section { margin: 60px 0 0; }
.p-section > h2 { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -.02em; }
.p-section > .sub { color: var(--text-secondary); line-height: 1.6; margin-bottom: 22px; }

/* ----- callouts ----- */
.callout { position: relative; background: linear-gradient(135deg, rgba(41,98,246,.08), rgba(112,41,246,.05)); border: 1px solid rgba(41,98,246,.2); border-radius: var(--radius); padding: 20px 24px; margin: 26px 0; color: var(--text-secondary); font-size: .97rem; line-height: 1.65; }
.callout.warn { background: linear-gradient(135deg, rgba(240,190,72,.08), rgba(240,190,72,.03)); border-color: rgba(240,190,72,.25); }
.callout strong { color: var(--text); }

/* ----- cards (with rotating conic border on hover, like .glow-border) ----- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-decoration: none; transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease; overflow: hidden; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); opacity: 0; transition: opacity .3s ease; background: radial-gradient(ellipse at 0% 0%, rgba(41,98,246,.10), transparent 60%); pointer-events: none; }
.card::before { content: ''; position: absolute; inset: -1px; border-radius: var(--radius); padding: 1px; background: conic-gradient(from var(--angle), var(--blue), var(--violet), var(--cyan), var(--blue)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
a.card:hover, .card.lift:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -16px rgba(17,36,74,.18); border-color: transparent; }
a.card:hover::before, .card.lift:hover::before { opacity: 1; animation: rotateBorder 3.5s linear infinite; }
a.card:hover::after, .card.lift:hover::after { opacity: 1; }
.card .ic { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; margin-bottom:14px; border-radius:var(--w12); background:rgba(41,98,246,.08); color:var(--blue); flex:none; }
.card h3 { font-family: var(--display); font-size: 1.12rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.card p { color: var(--text-secondary); font-size: .92rem; line-height: 1.55; flex: 1; }
.card .go { color: var(--blue); font-size: .85rem; font-weight: 600; margin-top: 16px; }
a.card:hover .go { color: #5b87f8; }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

/* ----- chips / tags ----- */
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 6px 0 14px; }
.tag { cursor: default; font-family: var(--mono); font-size: .7rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-2); }
.tag.ts { color: #1046d1; border-color: rgba(41,98,246,.4); background: var(--blue-dim); }
.tag.py { color: #8a6a12; border-color: rgba(240,190,72,.35); background: var(--amber-dim); }
.tag.fw { color: #5a20c9; border-color: rgba(112,41,246,.4); background: var(--violet-dim); }

/* ----- language switch (TS/Python) ----- */
.lang-switch { position: sticky; top: 56px; z-index: 30; display: flex; justify-content: center; margin: 24px auto 32px; width: max-content; background: var(--surface); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--w12); padding: 5px; box-shadow: 0 8px 24px -12px rgba(17,36,74,.18); }
.lang-switch button { font-family: var(--mono); font-size: .85rem; font-weight: 600; color: var(--text-secondary); background: transparent; border: 0; padding: 9px 24px; border-radius: var(--w8); cursor: pointer; transition: all .18s ease; }
.lang-switch button.active { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; box-shadow: 0 0 20px -6px rgba(41,98,246,.7); }
.lang-py .ts-only { display: none; }
body:not(.lang-py) .py-only { display: none; }

/* ----- step map (numbered chips) ----- */
.step-map { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 30px 0 12px; }
@media (max-width: 640px) { .step-map { grid-template-columns: 1fr; } }
.step-map a { display: flex; gap: 12px; align-items: center; color: var(--text-secondary); text-decoration: none; font-size: .92rem; font-weight: 500; padding: 11px 14px; border-radius: var(--w12); border: 1px solid var(--border); background: var(--surface); transition: all .2s ease; }
.step-map a:hover { border-color: var(--border-light); color: var(--text); transform: translateY(-2px); box-shadow: 0 12px 28px -16px rgba(17,36,74,.18); }
.step-map .n { font-family: var(--display); font-size: .74rem; font-weight: 700; color: #fff; flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 0 14px -4px rgba(41,98,246,.8); }

/* ----- integration steps (glass panels with glowing node) ----- */
.step { position: relative; margin: 24px 0; padding: 28px 30px 30px; scroll-margin-top: 82px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .3s ease, box-shadow .3s ease; }
.step::before { content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--blue), var(--violet) 55%, transparent); opacity: .8; }
.step:hover { border-color: var(--border-light); box-shadow: 0 24px 60px -28px rgba(17,36,74,.18); }
.step-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.step-num { position: relative; width: 50px; height: 50px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 1.02rem; font-weight: 700; color: #fff; background: radial-gradient(circle at 32% 26%, #5b87f8, #1046d1 46%, #5a20c9 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 8px 22px -6px rgba(41,98,246,.6), 0 0 30px -8px rgba(112,41,246,.55); }
.step-num::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(from var(--angle), transparent 0deg, rgba(62,191,252,.7) 60deg, transparent 140deg); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px)); opacity: 0; transition: opacity .4s ease; }
.step:hover .step-num::after { opacity: 1; animation: rotateBorder 4s linear infinite; }
.step h2 { font-family: var(--display); font-size: 1.42rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.step .pkg { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; font-family: var(--mono); font-size: .73rem; color: var(--green-ink); background: linear-gradient(135deg, rgba(29,172,118,.16), rgba(62,191,252,.1)); border: 1px solid rgba(29,172,118,.35); padding: 5px 12px; border-radius: var(--radius-pill); }
.step .pkg::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.step .why { color: var(--text-secondary); line-height: 1.7; margin: 10px 0 16px; }
.ig-foot-note { color: var(--text-muted); font-size: .85rem; line-height: 1.6; margin-top: 10px; }

/* ----- code + diff blocks ----- */
.label { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin: 18px 0 7px; }
pre.code, pre.diff { font-family: var(--mono); font-size: .82rem; line-height: 1.6; background: #02133e; border: 1px solid var(--border); border-radius: var(--w12); padding: 16px 18px; overflow-x: auto; color: #d5d9e3; margin: 0; }
pre.diff .d-add { color: #5fd3a6; display: block; } pre.diff .d-del { color: #ef8a8c; display: block; }
pre.diff .d-ctx { color: var(--text-secondary); display: block; } pre.diff .d-hdr { color: #b9a5f8; display: block; }
code, .why code, .callout code, .step-map code, .sub code, td code, li code, p code { font-family: var(--mono); font-size: .85em; background: rgba(17,36,74,.06); padding: 1px 6px; border-radius: var(--w4); color: #1046d1; }

/* ----- example box: in-box Before/After toggle ----- */
.ex { position: relative; border: 1px solid var(--border); border-radius: var(--w12); overflow: hidden; margin: 16px 0; background: #02133e; transition: border-color .3s ease, box-shadow .3s ease; }
.ex:hover { border-color: var(--border-light); box-shadow: 0 16px 40px -20px rgba(17,36,74,.18); }
.ex-head { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: linear-gradient(180deg, #1a2f5e, #11244a); border-bottom: 1px solid rgba(148,177,232,.16); }
.ex-head::before { content: ''; flex: none; width: 46px; height: 12px; background: radial-gradient(circle 5.5px at 6px 6px, #ff5f57 96%, transparent 0), radial-gradient(circle 5.5px at 23px 6px, #febc2e 96%, transparent 0), radial-gradient(circle 5.5px at 40px 6px, #28c840 96%, transparent 0); }
.ex-head .ex-file { font-family: var(--mono); font-size: .78rem; color: var(--text-secondary); }
.ba-toggle { margin-left: auto; display: flex; background: rgba(2,19,62,.8); border: 1px solid var(--border-light); border-radius: var(--w8); padding: 3px; }
.ba-toggle button { font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--text-secondary); background: transparent; border: 0; padding: 5px 13px; border-radius: var(--w8); cursor: pointer; transition: all .15s ease; }
.ba-toggle button.before.active { background: var(--surface-3); color: #fff; }
.ba-toggle button.after.active { background: linear-gradient(135deg, #1dac76, var(--emerald)); color: #02133e; box-shadow: 0 0 14px -4px rgba(29,172,118,.7); }
.ex pre.code { border: 0; border-radius: 0; margin: 0; background: transparent; }
.ex[data-state="before"] pre.ba-after { display: none !important; }
.ex[data-state="after"]  pre.ba-before { display: none !important; }
.ex .ex-copy { font-family: var(--mono); font-size: .7rem; font-weight: 600; color: var(--text-secondary); background: rgba(2,19,62,.8); border: 1px solid var(--border-light); border-radius: var(--w8); padding: 5px 11px; cursor: pointer; transition: all .15s ease; }
.ex .ex-copy:hover { color: #fff; border-color: var(--blue); box-shadow: 0 0 14px -6px rgba(41,98,246,.8); }

/* ----- copy button (standalone code) ----- */
.code-wrap { position: relative; }
.copy-btn { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: .7rem; font-weight: 600; color: var(--text-secondary); background: rgba(2,19,62,.9); border: 1px solid var(--border-light); border-radius: var(--w8); padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity .15s, color .15s, border-color .15s; }
.code-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #fff; border-color: var(--blue); }

/* ----- checkpoints ----- */
.checkpoint { background: linear-gradient(135deg, rgba(29,172,118,.07), rgba(29,172,118,.02)); border: 1px solid rgba(29,172,118,.22); border-left: 3px solid var(--emerald); border-radius: var(--w12); padding: 14px 18px; margin-top: 18px; }
.checkpoint .label { color: var(--green-ink); margin-top: 0; }
.checkpoint p { color: var(--text-secondary); font-size: .9rem; line-height: 1.55; margin: 6px 0 0; }
.checkpoint.platform { background: linear-gradient(135deg, rgba(240,190,72,.07), rgba(240,190,72,.02)); border-color: rgba(240,190,72,.25); border-left-color: var(--amber); }
.checkpoint.platform .label { color: var(--yellow-ink); }

/* ----- tables ----- */
.p-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--w12); overflow: hidden; }
.p-table th, .p-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: top; }
.p-table thead th { color: var(--text); font-weight: 700; font-size: .82rem; letter-spacing: .03em; background: var(--surface-2); }
.p-table tr:last-child td { border-bottom: 0; }
.p-table tbody tr { transition: background .15s ease; }
.p-table tbody tr:hover td { background: rgba(255,255,255,.025); }

/* ----- repo download buttons (samples) ----- */
.repo-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.repo-btn { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; text-decoration: none; padding: 8px 14px; border-radius: var(--w8); border: 1px solid var(--border-light); color: var(--text-secondary); background: var(--surface-2); transition: all .2s ease; }
.repo-btn:hover { border-color: var(--blue); background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.repo-btn.primary { border: none; color: #fff; background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 0 22px -6px rgba(41,98,246,.6); }
.repo-btn.primary:hover { box-shadow: 0 0 30px -4px rgba(41,98,246,.85); color: #fff; }
.repo-btn .lock { font-size: .72rem; color: var(--amber); }

/* ----- ordered steps list (quickstart) ----- */
.steps-ol { counter-reset: s; list-style: none; padding: 0; }
.steps-ol > li { position: relative; padding: 0 0 22px 48px; }
.steps-ol > li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: var(--w8); background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-family: var(--display); font-size: .85rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 18px -6px rgba(41,98,246,.7); }
.steps-ol > li h4 { color: var(--text); font-size: 1.02rem; margin-bottom: 6px; font-family: var(--display); }
.steps-ol > li p { color: var(--text-secondary); line-height: 1.6; font-size: .94rem; }

/* ----- misc ----- */
a.inline-link { color: var(--blue-ink); text-decoration: none; }
a.inline-link:hover { color: var(--blue); text-decoration: underline; }

/* ----- scroll-triggered entrance animation (JS adds .pre-reveal then .is-revealed) ----- */
.pre-reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1); will-change: opacity, transform; }
.pre-reveal.is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .pre-reveal { opacity: 1; transform: none; transition: none; } a.card:hover::before, .card.lift:hover::before { animation: none; } }

/* ============================================================================
   Docs layout — sticky sidebar submenu + phased tabs (integration page)
   ============================================================================ */
.portal-main.docs-main { max-width: 1180px; }
.docs { display: grid; grid-template-columns: 232px 1fr; gap: 38px; align-items: start; margin-top: 30px; }
.docs-side { position: sticky; top: 74px; align-self: start; display: flex; flex-direction: column; gap: 18px; }
.docs-side .lang-switch { position: static; margin: 0; width: 100%; box-shadow: none; }
.docs-side .lang-switch button { flex: 1; padding: 8px 0; }
.docs-nav { display: flex; flex-direction: column; gap: 18px; }
.docs-group-title { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; padding-left: 12px; }
.docs-group { border-left: 2px solid var(--border); transition: border-color .25s ease; }
.docs-group.active { border-left-color: var(--blue); }
.docs-nav a { display: block; color: var(--text-secondary); text-decoration: none; font-size: .85rem; padding: 6px 12px; border-radius: 0 8px 8px 0; transition: all .15s ease; }
.docs-nav a:hover { color: var(--text); background: rgba(17,36,74,.05); }
.docs-nav a.active { color: var(--blue-ink); font-weight: 600; background: rgba(41,98,246,.07); box-shadow: inset 2px 0 0 var(--blue); }

.phase-tabs { display: flex; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }
.phase-tab { display: inline-flex; align-items: center; gap: 9px; font-family: var(--display); font-size: .95rem; font-weight: 600; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: var(--w12); padding: 10px 16px; cursor: pointer; transition: all .2s ease; }
.phase-tab:hover { border-color: var(--border-light); color: #fff; transform: translateY(-1px); }
.phase-tab.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, rgba(41,98,246,.22), rgba(112,41,246,.22)); box-shadow: inset 0 0 0 1px rgba(148,177,232,.3), 0 10px 26px -14px rgba(41,98,246,.6); }
.phase-tab .pt-n { font-family: var(--display); font-size: .72rem; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; }

.phase-head { margin-bottom: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.phase-kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.phase-head h2 { font-family: var(--display); font-size: 1.8rem; font-weight: 700; color: #fff; margin: 6px 0; letter-spacing: -.02em; }
.phase-head p { color: var(--text-secondary); line-height: 1.6; max-width: 72ch; }

@keyframes phaseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.phase:not([hidden]) { animation: phaseIn .4s cubic-bezier(.16,1,.3,1); }

@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; gap: 20px; }
  .docs-side { position: static; }
  .docs-nav { display: none; }
  .docs-side .lang-switch { align-self: center; width: max-content; }
}
@media (prefers-reduced-motion: reduce) { .phase:not([hidden]) { animation: none; } }

/* ----- plain-language glossary (collapsible) ----- */

/* ----- download CTA rows ----- */
.dl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.dl-label { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); min-width: 118px; }

/* ----- syntax highlighting: keep our dark box + JetBrains Mono, use theme token colors ----- */
pre.code.hljs { background: #02133e; }                 /* our box bg, not the theme's */
.ex pre.code.hljs { background: transparent; }          /* inside the window chrome */
.hljs, pre.code, pre.diff, code { font-family: var(--mono); }
pre.code, pre.diff { font-feature-settings: "calt" 1, "liga" 1; -webkit-font-feature-settings: "calt" 1, "liga" 1; }
pre.code .hljs-comment, pre.code .hljs-quote { font-style: italic; opacity: .85; }

/* ----- chip polish ----- */
.tag { line-height: 1.4; letter-spacing: .02em; }
.eyebrow { font-weight: 600; }
.pkg, .phase-kicker { letter-spacing: .04em; }

/* request-access chip (non-link, for samples not yet on a public repo) */
.repo-btn.req { cursor: default; color: var(--text-muted); }
.repo-btn.req:hover { transform: none; border-color: var(--border-light); background: var(--surface-2); color: var(--text-muted); }

/* ============================================================================
   UX enhancements: a11y, command palette, scroll progress, diff emphasis, etc.
   ============================================================================ */

/* --- accessibility: visible focus + skip link + slightly lighter muted text --- */
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: var(--w8);
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--blue); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 600; }
.skip-link:focus { left: 0; }
.label, .docs-group-title, .dl-label, .ig-foot-note, .cmdk-foot, .cmdk-item .d { color: var(--text-secondary); }

/* --- external-link affordance (portal content only) --- */
.portal-main a[target="_blank"]:not(.repo-btn):not(.card)::after { content: " \2197"; font-size: .82em; opacity: .55; }

/* --- copy button: faintly visible by default (discoverable on touch) --- */
.copy-btn { opacity: .5; }
.code-wrap:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }

/* --- scroll progress bar --- */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60; background: linear-gradient(90deg, var(--blue), var(--violet), var(--cyan)); box-shadow: 0 0 10px rgba(41,98,246,.5); transition: width .08s linear; }

/* --- command palette (⌘K) --- */
.cmdk-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(2,19,62,.6); backdrop-filter: blur(4px); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-overlay.open { display: flex; }
.cmdk { width: min(640px, 92vw); background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--w12); box-shadow: 0 30px 80px -20px rgba(0,0,0,.85); overflow: hidden; }
.cmdk input { width: 100%; padding: 18px 20px; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: #fff; font-size: 1.02rem; font-family: var(--sans); outline: none; }
.cmdk-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--w12); color: var(--text-secondary); text-decoration: none; }
.cmdk-item .k { font-family: var(--mono); font-size: .66rem; color: var(--blue); border: 1px solid var(--border); border-radius: var(--w8); padding: 2px 7px; white-space: nowrap; }
.cmdk-item .t { color: #fff; font-weight: 600; font-size: .92rem; }
.cmdk-item .d { font-size: .8rem; }
.cmdk-item.sel, .cmdk-item:hover { background: rgba(41,98,246,.16); }
.cmdk-item.sel .d, .cmdk-item:hover .d { color: var(--text-secondary); }
.cmdk-item::after { content: none !important; }
.cmdk-empty { padding: 26px; text-align: center; color: #8b95a7; }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: .72rem; }
.cmdk-foot kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--w4); padding: 1px 6px; }
/* search trigger injected into the sub-nav */
.subnav-search { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--w8); padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.subnav-search:hover { color: #fff; border-color: var(--border-light); }
.subnav-search kbd { font-family: var(--mono); font-size: .68rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--w4); padding: 1px 5px; color: var(--text-muted); }

/* --- diff emphasis: highlight added lines in the After view --- */
.ex pre.code .exln { display: block; padding: 0 2px; margin: 0 -2px; }
.ex pre.code .exln.add { background: rgba(29,172,118,.13); box-shadow: inset 3px 0 0 var(--emerald); border-radius: var(--w4); }

/* --- mobile "jump to" menu (integration / reference) --- */
.mobile-toc { display: none; }
.mobile-toc select { width: 100%; padding: 12px 14px; background: var(--surface); color: #fff; border: 1px solid var(--border-light); border-radius: var(--w12); font-family: var(--sans); font-size: .95rem; }
@media (max-width: 900px) { .mobile-toc { display: block; margin: 16px 0 4px; } }

/* --- copied toast --- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 120; background: var(--surface-2); border: 1px solid var(--emerald); color: #5fd3a6; font-size: .85rem; font-weight: 600; padding: 9px 16px; border-radius: var(--w12); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ---------------------------------------------------------------------
   Code surfaces stay dark on the light page — the same treatment
   kobil.com uses for code. Re-point the tokens inside them so nested
   chrome (copy buttons, Before/After toggles) keeps working.
   --------------------------------------------------------------------- */
pre.code, pre.diff, .ex {
  --text: var(--on-dark);
  --text-secondary: var(--on-dark-secondary);
  --text-muted: var(--on-dark-muted);
  --border: var(--border-on-dark);
  --border-light: rgba(255,255,255,0.24);
  --surface: #11244a;
  --surface-2: #16305e;
  --surface-3: #1a2f5e;
  color: var(--on-dark);
}
pre.code code, pre.diff code { color: inherit; }
.ex .ex-file { color: var(--on-dark-secondary); }

/* Flat line icons, kobil.com style — inherit colour, no glow. */
.ic-svg { width: 24px; height: 24px; display: block; }
.ic-inline { display: inline-block; vertical-align: -2px; margin-right: 2px; }
.panel-dark .card .ic { background: rgba(255,255,255,.10); color: var(--shade-cyan); }
.repo-btn .ic-inline, .lock .ic-inline { vertical-align: -2px; }
.lock { display: inline-flex; align-items: center; }

/* The language switch and copy buttons sit on dark chrome, so their idle
   type must come from the on-dark ramp, not the light-page secondary. */
.lang-switch { --text-secondary: var(--on-dark-secondary); }
.lang-switch button { color: var(--on-dark-secondary); }
.copy-btn { color: var(--on-dark-secondary); }

/* Comments in the dark code theme sat at 2.98:1 — lift to clear AA. */
.hljs-comment, .hljs-quote { color: #8d9bb5 !important; }

/* Phase heading + kicker sit on the light field now. */
.phase-head h2 { color: var(--text); }
.phase-kicker { color: var(--cyan-ink); }
.panel-dark .phase-head h2 { color: var(--on-dark); }
.panel-dark .phase-kicker { color: var(--cyan); }
.panel-dark a.inline-link, pre.code a.inline-link { color: var(--cyan); }
/* the language switch is light chrome now, so idle labels use page ink */
.lang-switch { --text-secondary: #4d586e; }
.lang-switch button { color: var(--text-secondary); }
.lang-switch button.active { color: #fff; }

/* ============================================================
   LEFT ICON RAIL — modelled on kobil.com's vertical rail
   Icon-only at rest, exactly like theirs; expands on hover to
   reveal labels, because five doc sections are not reliably
   distinguishable from an icon alone.
   ============================================================ */
.portal-rail {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 45;
  width: 244px;
  display: flex;
  align-items: center;
  background: transparent;
  pointer-events: none;
}
.portal-rail .rail-inner {
  pointer-events: auto;
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 14px 14px;
  margin-left: 8px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 18px 40px -24px rgba(17,36,74,.28);
}
.rail-item {
  display: flex; align-items: center; gap: 12px;
  height: 50px; padding: 0 15px;
  border-radius: var(--w14);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.rail-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; }
.rail-label {
  font-family: var(--sans); font-size: .93rem; font-weight: 600;
  white-space: nowrap;
}
.rail-item:hover { color: var(--text); background: rgba(17,36,74,.05); }
/* active: solid brand blue with a white icon, as on kobil.com */
.rail-item.active { background: var(--blue); color: #fff; }
.rail-item.active:hover { background: var(--blue-hover); color: #fff; }


/* content clears the rail */
/* Offset the content past the rail with a margin, not padding: the
   container is also auto-centred, so a padding offset stacked on top of
   the centring margin and opened a ~210px gap. */
.has-rail .portal-main {
  margin-left: 244px;
  margin-right: auto;
  padding-left: var(--w32);
  padding-right: var(--w32);
  box-sizing: border-box;
  /* the design max-width must account for the rail, otherwise
     244px + 1180px overflows any viewport under ~1430px */
  max-width: min(var(--portal-max, 1080px), calc(100vw - 244px));
}
.has-rail .portal-main.docs-main { --portal-max: 1180px; }
.has-rail .portal-main.narrow    { --portal-max: 960px; }
/* the docs grid itself must be allowed to shrink */
.has-rail .docs { grid-template-columns: minmax(0, 232px) minmax(0, 1fr); }
@media (max-width: 1180px) {
  .has-rail .docs { grid-template-columns: minmax(0, 1fr); gap: var(--w24); }
  .has-rail .docs-side { position: static; }
}
/* the rail is vertically centred and never reaches the header, so the
   header keeps kobil.com's own left padding and logo position */

@media (max-width: 1024px) {
  /* below desktop the rail lies down as a horizontal bar again */
  .portal-rail {
    position: sticky; top: 0; bottom: auto;
    width: 100%; height: auto; align-items: stretch;
    background: rgba(238,241,247,.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
  }
  .portal-rail .rail-inner {
    flex-direction: row; align-items: center; gap: 8px;
    margin: 0; padding: 10px 16px;
    background: transparent; border: 0; box-shadow: none;
    border-radius: 0; overflow-x: auto;
  }
  .has-rail .portal-main { margin-left: 0; padding-left: var(--m16); padding-right: var(--m16); }
}

/* ---- the pipeline diagram reads as data, not code: light sky-blue
   surface, tighter leading, no wasted vertical space ---------------- */
pre.code[data-nocopy] {
  --text: #11244a;
  --text-secondary: #4d586e;
  background: #dbeafe;
  border: 1px solid rgba(41,98,246,.18);
  color: #11244a;
  line-height: 1.45;
  padding: var(--w18) var(--w20);
  margin: var(--w12) 0;
  overflow-x: auto;
}
pre.code[data-nocopy] .hljs-string,
pre.code[data-nocopy] .hljs-keyword,
pre.code[data-nocopy] .hljs-built_in,
pre.code[data-nocopy] .hljs-literal,
pre.code[data-nocopy] .hljs-number { color: inherit; }

/* code blocks scroll inside their own box; a long comment must never
   widen the page */
pre.code, pre.diff, .ex, .code-wrap {
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}
pre.code, pre.diff { white-space: pre; }
.ex pre.code { overflow-x: auto; }

/* ---- tables: keep natural column widths, scroll when the column is
   too narrow. A fixed layout squeezed these four-column tables so hard
   that words broke character-by-character, which was worse than the
   overflow it fixed. --------------------------------------------- */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0;
  border-radius: var(--w12);
}
.table-scroll .p-table { margin: 0; min-width: 620px; }
.p-table th, .p-table td { overflow-wrap: break-word; }
.p-table code { overflow-wrap: break-word; }

/* ---- prose rhythm inside a step -----------------------------------
   Long explanations are broken into a lead line plus a list, so nothing
   reads as a wall. These give the pieces consistent spacing.
   -------------------------------------------------------------------- */
.step p.lead { margin: 16px 0 8px; color: var(--text-secondary); line-height: 1.65; }
.step ul.tight, .step ol.tight { margin: 0 0 16px; padding-left: 22px; }
.step ul.tight li, .step ol.tight li {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 6px 0;
}
.step ul.tight li::marker { color: var(--blue); }
.step ol.tight li::marker { color: var(--blue); font-weight: 700; }
.step p.note,
.checkpoint p.note {
  margin: 10px 0 16px;
  padding-left: 12px;
  border-left: 2px solid var(--border-light);
  color: var(--text-muted);
  font-size: .92rem;
  line-height: 1.6;
}
.callout ul.tight { margin: 8px 0 0; }
.callout ul.tight li { color: inherit; }
/* a little more air between a step's blocks */
.step > p, .step > .ex, .step > .table-scroll, .step > .callout { margin-bottom: 16px; }
/* the What/How intro is now two lines; keep them tight together */
.step .why { margin: 8px 0; }
.step .why + .why { margin-top: 4px; }
.callout .note { border-left-color: rgba(17,36,74,.2); margin-bottom: 0; }

/* ============================================================
   FLOW DIAGRAM — the secured tool-call pipeline
   Five cards joined by arrows, each with a floating icon badge.
   Replaces the monospace ASCII block.
   ============================================================ */
.flow {
  list-style: none;
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 28px 0 10px;
  padding: 32px 16px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.flow-step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 10px 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: var(--w14);
  background: color-mix(in srgb, var(--accent) 4%, #fff);
}
/* the icon badge floats over the card's top edge */
.flow-icon {
  position: absolute;
  top: -21px; left: 50%; transform: translateX(-50%);
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--ink);
}
.flow-head { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.flow-num {
  flex: none;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans); font-size: .72rem; font-weight: 700;
}
.flow-title {
  font-family: var(--display); font-size: .92rem; font-weight: 700;
  color: var(--text); letter-spacing: -.01em;
}
.flow-caption {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  width: 100%;
  font-size: .84rem; line-height: 1.5;
  color: var(--text-secondary);
}
.flow-arrow {
  flex: none;
  display: flex; align-items: center;
  color: var(--text-muted);
  padding: 0;
}

@media (max-width: 860px) {
  /* stack, and turn the arrows to point down */
  .flow { flex-direction: column; align-items: stretch; padding: 26px 16px 16px; }
  .flow-step { min-width: 0; margin-top: 12px; }
  .flow-step:first-child { margin-top: 0; }
  .flow-arrow { justify-content: center; transform: rotate(90deg); padding: 4px 0; }
}

/* ---- portal cards: wider, and no justified rivers -------------------
   .card p inherited text-align: justify from the marketing stylesheet,
   which opened large gaps between words at card width. Cards also packed
   three to a row at 313px each; two per row reads far better.
   -------------------------------------------------------------------- */
.card p, .card li, .card .go { text-align: left; hyphens: manual; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: var(--w24); }
.card { padding: var(--w28); }
.card h3 { font-size: 1.18rem; margin-bottom: 10px; }
.card p { font-size: .95rem; line-height: 1.6; }
@media (max-width: 900px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ---- samples: section headings centred ------------------------------ */
.samples-page .p-section > h2,
.samples-page .p-section > .sub,
.samples-page .group-title {
  text-align: center;
}
.samples-page .p-section > h2 { margin-bottom: 8px; }
.samples-page .group-title { margin: var(--w32) 0 var(--w16); }
.group-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

/* ----- pipeline guarantees (developers) -----
   Three cards under the five-step flow. Each names the step it covers, so the
   pair reads as pipeline-then-guarantee rather than the same point made twice.
   Step 4 has no card on purpose: that step is the caller's own tool code. */
.card-grid.guarantees { grid-template-columns: repeat(3, 1fr); }
.card-step {
  align-self: flex-start;
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--blue-ink);
  background: rgba(41,98,246,.08);
  border: 1px solid rgba(41,98,246,.22);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  margin-bottom: 10px;
}
@media (max-width: 900px) { .card-grid.guarantees { grid-template-columns: 1fr; } }

/* ----- plain-text docs pointer (developer portal) -----
   The filenames are the loudest thing in the block on purpose: a developer who
   knows the convention scans for "llms.txt", and an agent reading the page as
   text meets the names and the URLs together. */
.llms-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin: 0 0 34px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--w12);
}
.llms-copy { flex: 1 1 320px; min-width: 0; }
.llms-callout h2 {
  font-family: var(--display); font-size: 1.02rem; font-weight: 700;
  color: var(--text); margin: 0 0 5px;
}
.llms-callout p {
  color: var(--text-secondary); font-size: .89rem; line-height: 1.55;
  margin: 0; max-width: 62ch;
}
.llms-files {
  flex: 0 1 auto; list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.llms-files li { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.llms-name {
  font-family: var(--mono); font-size: .84rem; font-weight: 600;
  text-decoration: none; color: var(--blue-ink);
  background: rgba(41,98,246,.07); border: 1px solid rgba(41,98,246,.22);
  border-radius: var(--w8); padding: 6px 12px; white-space: nowrap;
  transition: border-color .2s ease, background .2s ease;
}
.llms-name:hover { border-color: var(--blue); background: rgba(41,98,246,.12); }
.llms-desc { flex: 1 1 auto; font-size: .8rem; color: var(--text-muted); min-width: 0; }
.llms-copy-btn {
  font-family: var(--sans); font-size: .78rem; font-weight: 600; white-space: nowrap;
  padding: 6px 12px; border-radius: var(--w8);
  border: 1px solid var(--border-light); background: var(--surface-2);
  color: var(--text-secondary); cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.llms-copy-btn:hover { border-color: var(--blue); color: var(--text); background: var(--surface-3); }
.llms-copy-btn.copied { border-color: var(--emerald); color: var(--green-ink); }
@media (max-width: 720px) {
  .llms-callout { flex-direction: column; align-items: stretch; padding: 18px; }
  .llms-files { width: 100%; }
  .llms-desc { flex-basis: 100%; order: 3; }
}

/* Long unbreakable strings - repo names such as
   aitrust-insurance-agent-openai-python - overflowed their heading on a phone.
   Break them rather than clip them. */
.p-section h2, .card h3, .p-section h3, .rail-label, .step h2 {
  overflow-wrap: anywhere; word-break: break-word;
}

/* The rail stops being a fixed left column below 1024px, but .portal-main kept
   reserving its 244px anyway. At 390px that left the content 146px wide and
   the integration guide effectively unreadable on a phone. Give the width
   back once the rail is no longer beside the content. */
@media (max-width: 1024px) {
  .has-rail .portal-main,
  .has-rail .portal-main.docs-main,
  .has-rail .portal-main.narrow {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
}

/* An unfilled value the reader must supply — the Dashboard's address is not
   public, so the page names the slot rather than inventing a URL. Dashed so it
   never reads as something you can copy and paste. */
code.placeholder {
  border: 1px dashed var(--blue);
  background: transparent;
  color: var(--blue-ink);
  font-style: normal;
}
