/* MCP integrations (docs/mcp-servers.html, 11 Nov 2026): a directory under
   its own docs tab. A filter column (category, status, the checked-on note),
   a search bar, and a grid of tiles; a tile opens the side panel with the
   server address and login. The body is generated by
   tools/build-mcp-servers-page.py; js/mcp-servers.js does the search, the
   filters, the panel and the copy buttons. Colours come from the docs
   palette, so the dark theme follows on its own; the few literal colours
   are redefined at the end. */

/* the page: full width, the header left-aligned over the directory */
.mi-page { justify-items: stretch; }
.mi-page .docs-main { max-width: none; }
.mi-hero { display: block; }
.mi-hero-l { min-width: 0; max-width: 760px; }
.mi-page .docs-body { margin-top: 36px; }

/* the how-to lives in the panel; the Markdown reads it first */
.docs-body .mi-how { display: none; }

.mi-dir { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 40px; align-items: start; }

/* --- filter column --------------------------------------------------------- */
.mi-filters { position: sticky; top: 142px; max-height: calc(100vh - 160px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.docs-body .mi-fh {
    margin: 0 0 8px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.mi-fl { display: grid; gap: 2px; margin-bottom: 22px; }
.mi-f {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left;
    font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--body); cursor: pointer;
}
.mi-f small { font-size: 0.75rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mi-f:hover { background: var(--soft); color: var(--ink); }
/* the active category: a soft grey fill and bold text, as on integrations.html (Dom, 11 Nov 2026) */
.mi-f.is-on, .mi-f.is-on:hover { background: #EDE6E3; color: var(--ink); font-weight: 700; }
.mi-f.is-on small { color: var(--ink); }
.mi-f:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.mi-note {
    display: flex; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    font-size: 0.75rem; line-height: 1.5; color: var(--muted);
}
.mi-note svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.docs-body .mi-note p { margin: 0; }

/* --- search bar -------------------------------------------------------------- */
.mcps-ui { display: flex; gap: 10px; align-items: center; }
@media (min-width: 900px) {
    .mcps-ui { position: sticky; top: 119px; z-index: 5; padding: 14px 0 10px; background: var(--cream); }
}
.mcps-search {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; height: 46px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.mcps-search:focus-within { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(76, 107, 238, 0.16); }
.mcps-search svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.mcps-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--ink); }
.mcps-search input::placeholder { color: var(--muted); }
.mcps-search kbd {
    padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--cream);
    font: 600 0.75rem/1.5 inherit; color: var(--muted);
}
.docs-body .mcps-count { margin: 6px 0 0; font-size: 0.8125rem; color: var(--muted); }
.docs-body .mcps-empty { margin: 24px 0; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--body); }

/* --- "connect any MCP server": a tile in the list (js/mcp-servers.js places it) -- */
.docs-body .mi-anytile {
    position: relative; display: flex; flex-direction: column; min-height: 156px; padding: 16px 16px 15px; cursor: pointer;
    border: 1px solid #E9D3EE; border-radius: 16px;
    background: radial-gradient(120% 90% at 100% 0%, #F3EDFF 0%, transparent 60%), linear-gradient(160deg, #FFF3FF 0%, #F6F1FF 55%, #EEF3FF 100%);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.docs-body .mi-anytile:hover { border-color: #D9B6E0; box-shadow: 0 14px 30px -20px rgba(161, 42, 161, 0.45); transform: translateY(-2px); }
.docs-body .mi-anytile:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.mi-logo--any { border-color: transparent; background: var(--surface); color: var(--brand-magenta); box-shadow: 0 6px 16px -10px rgba(161, 42, 161, 0.5); }
.mi-logo--any svg { width: 24px; height: 24px; }
.docs-body .mi-anytile-h { margin: 14px 0 0; font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.docs-body .mi-anytile-p { margin: 4px 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--body); }
.mi-anytile-link { margin-top: auto; padding-top: 10px; font-size: 0.8125rem; font-weight: 700; color: var(--brand-magenta); }
.mi-anytile-link::after { content: " \2192"; }

/* --- the grid ---------------------------------------------------------------- */
.mi-ghead { margin: 38px 0 14px; scroll-margin-top: 200px; }
.docs-body .mi-ghead h2 { margin: 0; padding: 0; border: 0; font-size: 1.1875rem; font-weight: 750; letter-spacing: -0.01em; color: var(--ink); scroll-margin-top: 200px; }
.docs-body .mi-ghead .mi-gsub { margin: 3px 0 0; font-size: 0.875rem; color: var(--muted); }
.mi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.docs-body .mi-tile {
    position: relative; display: flex; flex-direction: column; gap: 0; min-height: 156px;
    padding: 16px 16px 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
/* an arrow in the corner on hover: the tile opens its panel */
.docs-body .mi-tile::after {
    content: ""; position: absolute; top: 18px; right: 16px; width: 16px; height: 16px; opacity: 0; transition: opacity .15s, transform .15s;
    background: var(--muted); transform: translateX(-3px);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.docs-body .mi-tile:hover { border-color: #D9CFD6; box-shadow: 0 14px 30px -20px rgba(22, 18, 26, 0.4); transform: translateY(-2px); }
.docs-body .mi-tile:hover::after { opacity: 1; transform: none; }
.docs-body .mi-tile:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.docs-body .mi-tile.is-open { border-color: var(--brand-magenta); }
.mi-logo {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden;
}
.mi-logo img { width: 26px; height: 26px; object-fit: contain; }
.mi-logo--brand { border-color: transparent; background: var(--b); }
.mi-logo--brand img { width: 22px; height: 22px; }
.mi-logo--l { border-color: transparent; background: var(--t); font-size: 0.9375rem; font-weight: 800; letter-spacing: -0.02em; color: #2B2430; }
.docs-body .mi-tile h3 {
    margin: 14px 0 0; font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; scroll-margin-top: 200px;
}
.docs-body .mi-tile .mi-desc {
    margin: 4px 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--body);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* the category and the tags show in the panel only */
.docs-body .mi-tile .mcps-tags, .docs-body .mi-tile .mcps-f { display: none; }
.mi-cat { font-size: 0.75rem; color: var(--muted); }
/* the popular row, made by js/mcp-servers.js from copies of the tiles */
.mi-pop-group .mi-ghead { margin-top: 26px; }

.mcps-tag {
    display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
    background: var(--soft); font-size: 0.6875rem; font-weight: 700; line-height: 1.6; color: var(--body); white-space: nowrap;
}
.mcps-tag--ready { background: #E6F5EC; color: #1F6B49; }
.mcps-tag--app { background: #EAEEFE; color: #3A54C4; }
.mcps-tag--approval { background: #FFF1E4; color: #A34D16; }
.mcps-tag--builtin { background: var(--pink-wash); color: #A12AA1; }
.mcps-tag--no { background: #FDEBEB; color: #B42318; }
.mcps-tag--none { background: var(--soft); color: var(--muted); }

/* --- the side panel ------------------------------------------------------------ */
.mi-drawer {
    position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); max-width: 100%; height: 100dvh; max-height: none;
    margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--cream); color: var(--body);
    box-shadow: -24px 0 60px -30px rgba(22, 18, 26, 0.45);
}
.mi-drawer::backdrop { background: rgba(22, 18, 26, 0.28); }
.mi-drawer[open] { animation: mi-in .22s ease-out; }
@keyframes mi-in { from { transform: translateX(24px); opacity: 0; } }
.mi-d { display: flex; flex-direction: column; height: 100%; }
.mi-d-head {
    display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.mi-d-head .mi-logo { grid-row: auto; width: 52px; height: 52px; border-radius: 14px; }
.mi-d-head .mi-logo img { width: 30px; height: 30px; }
.mi-d-head h2 { margin: 0; font-size: 1.25rem; font-weight: 750; line-height: 1.25; color: var(--ink); }
.mi-d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 0; }
.mi-d-tags .mi-cat { flex: 0 0 100%; }
.mi-d-tags .mi-d-desc { flex: 0 0 100%; margin: 0 0 4px; font-size: 0.875rem; line-height: 1.5; color: var(--body); }
.mi-d-x {
    align-self: start; display: grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.mi-d-x svg { width: 18px; height: 18px; }
.mi-d-x:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.mi-d-body { flex: 1; overflow: auto; padding: 8px 24px 28px; overscroll-behavior: contain; }
.mi-d-body ul.mcps-f { margin: 0; padding: 0; list-style: none; }
.mi-d-body ul.mcps-f > li { display: grid; gap: 4px; margin: 0; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; line-height: 1.55; }
.mi-d-body ul.mcps-f > li > b { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mi-d-body ul.mcps-f > li > ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.mi-d-body ul.mcps-f > li::before, .mi-d-body ul.mcps-f > li > ul > li::before { content: none; }
.mi-d-body ul.mcps-f > li:first-child { padding-top: 14px; }
.mi-d-body ul.mcps-f > li:has(+ li.mi-before) { border-bottom: 0; }
/* the server address, in its own box, first */
.mi-d-body ul.mcps-f > li.mi-addr { margin: 16px 0 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.mi-d-body ul.mcps-f > li.mi-addr code.mcps-url { background: transparent; padding: 0; font-size: 0.9375rem; }
.mi-d-body ul.mcps-f > li.mi-addr:has(+ li.mi-before) { margin-bottom: 0; }
/* the vendor's docs and website, as buttons at the end */
.mi-d-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.mi-d-body a.mi-d-link {
    position: relative; display: grid; gap: 1px; padding: 12px 40px 12px 14px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
}
.mi-d-body a.mi-d-link:hover { border-color: var(--muted); }
.mi-d-link span { font-size: 0.875rem; font-weight: 700; }
.mi-d-link small { margin: 0; font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-d-link svg { position: absolute; top: 50%; right: 14px; width: 16px; height: 16px; margin-top: -8px; color: var(--muted); }
@media (max-width: 520px) { .mi-d-links { grid-template-columns: minmax(0, 1fr); } }
.mi-d-body code { padding: 1px 5px; border-radius: 6px; background: #F1EFF5; font-size: 0.85em; color: var(--ink); overflow-wrap: anywhere; }
.mi-d-body code.mcps-url { padding: 3px 7px; font-size: 0.875rem; font-weight: 600; }
.mi-d-body code.mcps-url--old { font-weight: 400; color: var(--muted); text-decoration: line-through; }
.mi-d-body small { margin-left: 4px; font-size: 0.75rem; color: var(--muted); }
.mi-d-body small.mi-tech { display: block; margin: 4px 0 0; font-size: 0.8125rem; line-height: 1.5; }
.mi-d-body a { color: var(--brand-blue); text-decoration: none; border-bottom: 1px solid rgba(76, 107, 238, 0.35); }
.mi-d-body ul.mcps-f > li.mi-before { margin: 10px 0; padding: 12px 14px; border: 1px solid #F6D5B8; border-radius: 12px; background: #FFF6EC; }
.mi-d-body ul.mcps-f > li.mi-before + li { border-top: 0; }
.mi-d-body ul.mcps-f > li.mi-before > b { color: #A34D16; }
/* the steps under each tool, and the How to connect panel */
.mi-d-steps { margin-top: 22px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.mi-d-steps h3 { margin: 0 0 10px; font-size: 0.9375rem; font-weight: 700; color: var(--ink); }
.mi-d-steps ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 0.875rem; line-height: 1.5; }
.mi-d-how h2 { margin: 18px 0 10px; font-size: 1.125rem; font-weight: 750; color: var(--ink); }
.mi-d-how h3 { margin: 22px 0 8px; font-size: 1rem; font-weight: 700; color: var(--ink); }
.mi-d-how p, .mi-d-how li { font-size: 0.9rem; line-height: 1.6; }
.mi-d-how ol, .mi-d-how ul { padding-left: 20px; display: grid; gap: 8px; }
.mi-d-how ol + p, .mi-d-how ul + p { margin-top: 14px; }
/* the numbered steps: room under the paragraph above, and under step 4 */
.mi-d-how ol.docs-steps { margin: 20px 0 6px; }

.mcps-copy {
    display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; vertical-align: 1px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
    font: inherit; font-size: 0.75rem; font-weight: 600; color: var(--body); cursor: pointer;
}
.mcps-copy:hover { border-color: var(--muted); color: var(--ink); }
.mcps-copy:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.mcps-copy svg { width: 13px; height: 13px; }
.mcps-copy.is-done { color: #1F6B49; border-color: #BFE5CB; }

/* --- narrow screens: the filters become two rows of chips over the grid -------- */
@media (max-width: 860px) {
    .mi-dir { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .mi-filters { position: static; max-height: none; overflow: visible; padding: 0; }
    .docs-body .mi-fh { display: none; }
    .mi-fl { display: flex; gap: 6px; margin: 0 0 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .mi-fl::-webkit-scrollbar { display: none; }
    .mi-f { flex: none; width: auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.8125rem; }
    .mi-f.is-on, .mi-f.is-on:hover { background: #EDE6E3; border-color: #D9CFCB; color: var(--ink); }
    .mi-f.is-on small { color: var(--ink); }
    .mi-note { margin-top: 6px; }
}
@media (max-width: 520px) {
    .mi-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    /* compact tiles on phones: the logo beside the name and the line */
    .docs-body .mi-tile { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 12px; align-items: center; min-height: 0; padding: 12px 36px 12px 12px; }
    .docs-body .mi-tile .mi-logo { grid-row: 1 / 3; }
    .docs-body .mi-tile h3 { margin: 0; align-self: end; }
    .docs-body .mi-tile .mi-desc { margin-top: 2px; align-self: start; -webkit-line-clamp: 2; }
    .docs-body .mi-tile::after { top: 50%; margin-top: -8px; opacity: .5; transform: none; }
    .docs-body .mi-anytile { min-height: 0; }
    .mcps-search kbd { display: none; }
    .mi-d-head { padding: 18px 16px 14px; }
    .mi-d-body { padding: 4px 16px 24px; }
}

/* --- dark theme: the literal colours above ------------------------------------ */
html[data-theme="dark"] .mi-logo { background: #F6F2F5; border-color: transparent; }
html[data-theme="dark"] .mi-f.is-on, html[data-theme="dark"] .mi-f.is-on:hover { background: #2E2637; border-color: #3D3347; }
html[data-theme="dark"] .mi-logo--brand { background: var(--b); }
html[data-theme="dark"] .docs-body .mi-anytile { border-color: #4A2A4C; background: linear-gradient(160deg, #2B1D2E 0%, #221D33 55%, #1B2033 100%); }
html[data-theme="dark"] .mi-logo--any { background: #151119; box-shadow: none; }
html[data-theme="dark"] .mi-logo--l { background: var(--t); }
html[data-theme="dark"] .docs-body .mi-tile:hover { border-color: #4A3F55; box-shadow: none; }
html[data-theme="dark"] .mi-drawer { box-shadow: none; }
html[data-theme="dark"] .mi-drawer::backdrop { background: rgba(0, 0, 0, 0.55); }
html[data-theme="dark"] .mi-d-body code { background: #2A2334; }
html[data-theme="dark"] .mi-d-body ul.mcps-f > li.mi-before { background: #2A1D12; border-color: #5C3B1E; }
html[data-theme="dark"] .mi-d-body ul.mcps-f > li.mi-before > b { color: #FFB086; }
html[data-theme="dark"] .mcps-tag--ready { background: #12261B; color: #86E3B0; }
html[data-theme="dark"] .mcps-tag--app { background: #171B33; color: #A9B8FF; }
html[data-theme="dark"] .mcps-tag--approval { background: #2A1D12; color: #FFB086; }
html[data-theme="dark"] .mcps-tag--builtin { color: #FF8CFF; }
html[data-theme="dark"] .mcps-tag--no { background: #2C1416; color: #FF9B94; }
html[data-theme="dark"] .mcps-copy.is-done { color: #86E3B0; border-color: #1F4A33; }
