/* =============================================================================
   MCP+ Blog / GitHub Pages
   ============================================================================= */

:root {
    /* Content width: sections (About, Demo, Installation) and header use this. Increase px or vw for a wider layout. */
    --page-max-width: min(1600px, 100vw);
    --section-spacing: 3rem;
    --header-color: #032d60;
    --header-color-hover: #0a3d7a;
}

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

html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: clip;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: clip;
    background-color: #ffffff;
    color: #1e293b;
    font-size: 1.125rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    /* no overflow-x here: it breaks position:sticky on .page-header */
}

.page-header {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    z-index: 10;
}

.page-header-inner {
    max-width: var(--page-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--header-color);
    font-weight: 700;
    font-size: 1.25rem;
}

.page-logo__icon {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.page-logo__text {
    letter-spacing: -0.02em;
}

.hero {
    /* Hero (title, blurb, buttons) width. Can match --page-max-width or stay narrower. */
    max-width: min(1000px, 95vw);
    margin: 0 auto;
    padding: 3.5rem 0 4rem;
    text-align: center;
}

.hero__title {
    margin: 0 0 1.25rem 0;
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.2;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.hero__description {
    margin: 0 0 2rem 0;
    font-size: 1.15rem;
    color: #475569;
    line-height: 1.6;
    max-width: 42em;
    margin-left: auto;
    margin-right: auto;
}

.hero__buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.hero__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 9rem;
    padding: 0.6rem 1.25rem;
    background: #085CAB;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: background 0.2s, transform 0.1s;
}

.hero__btn:hover {
    background: #064a8a;
    transform: translateY(-1px);
}

button.hero__btn {
    border: none;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

button.hero__btn:focus-visible {
    outline: 2px solid #085CAB;
    outline-offset: 2px;
}

.hero__quickstart-terminal {
    margin-top: 1.25rem;
    width: 100%;
    text-align: left;
}

.hero__quickstart-terminal[hidden] {
    display: none;
}

.hero__btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.hero__meta {
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.hero__authors {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: #334155;
}

.hero__asterisk {
    color: #64748b;
    font-weight: 400;
}

.hero__affiliation {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #64748b;
}

.hero__contact {
    margin: 0;
    font-size: 0.9rem;
}

.hero__contact a {
    color: #2563eb;
    text-decoration: none;
}

.hero__contact a:hover {
    text-decoration: underline;
}

.main-content {
    flex: 1 0 auto;
    min-width: 0;
    width: 100%;
    text-align: left;
    max-width: 100%;
    overflow-x: hidden;
    padding: 0 2rem 60px;
}

.main-content > section {
    max-width: min(var(--page-max-width), 100%);
    width: 100%;
    margin: 0 auto;
    padding: var(--section-spacing) 0;
    min-width: 0;
    overflow-x: hidden;
    text-align: left;
}

section h2 {
    margin: 0 0 1rem 0;
    font-weight: 600;
    color: var(--header-color);
    font-size: 1.5rem;
    text-align: left;
}

section h3 {
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    color: var(--header-color);
    font-size: 1.25rem;
    text-align: left;
}

section h4 {
    text-align: left;
}

section p, section ul {
    margin: 0 0 1rem 0;
    color: #334155;
    text-align: left;
}

section code {
    background: #f1f5f9;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

nav.primary {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
}

nav.primary a {
    color: var(--header-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.35em 0.9em;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

nav.primary a:hover {
    color: var(--header-color-hover);
    background: rgba(3, 45, 96, 0.06);
}

nav.primary a.active {
    background: #e8ecf1;
    color: var(--header-color);
}

.chart-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    background: #fafafa;
    padding: 25px;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Force chart SVGs and any Plot wrapper to fill the container */
.chart-container > * {
    width: 100% !important;
    max-width: 100% !important;
}

.chart-container svg {
    width: 100% !important;
    height: auto !important;
    display: block;
}

/* Performance accuracy table (above bar chart) */
.perf-table-wrap {
    width: 100%;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.perf-table-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--header-color);
}

.chart-title {
    margin-top: 1.5rem;
}

.perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.perf-table th,
.perf-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
}

.perf-table thead th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--header-color);
}

.perf-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.perf-table tbody tr:hover {
    background: #f8fafc;
}

.perf-table__domain-header {
    font-weight: 600;
    color: var(--header-color);
    background: #e2e8f0 !important;
}

.perf-table__model-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.perf-table__logo {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.perf-table__spacer td {
    height: 0.75rem;
    padding: 0;
    border: none;
    background: transparent !important;
}

.perf-table__delta--pos {
    color: #166534;
    font-weight: 500;
}

.perf-table__delta--neg {
    color: #991b1b;
    font-weight: 500;
}

.article-figure {
    margin: 2rem 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.article-figure .chart-container {
    margin-bottom: 0.5rem;
}

.page-footer {
    flex-shrink: 0;
    padding: 0.5rem 1.5rem 0.75rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    text-align: left;
}

.page-footer__attribution {
    margin: 0;
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.4;
}

.page-footer__attribution a {
    color: #475569;
    text-decoration: none;
}

.page-footer__attribution a:hover {
    text-decoration: underline;
    color: #0f172a;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

.chart-container .chart-legend {
    margin: 0.5rem 0 1.25rem 0;
}

.chart-facet-plot-wrap {
    position: relative;
    display: inline-block;
}

.chart-x-icons-overlay {
    position: absolute;
    bottom: 20px;
    left: 68px;
    right: 16px;
    height: 28px;
    pointer-events: none;
}

.chart-x-icon-wrap {
    position: absolute;
    top: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-x-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chart-legend__swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.chart-legend__swatch--mcp {
    background: #70bf75;
}

.chart-legend__swatch--savings {
    background: #a2372d;
}

.article-figure figcaption {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.5rem;
    text-align: center;
}

.placeholder-image {
    min-height: 80px;
    background: #f8fafc;
    border: 2px dashed #c5d0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.9rem;
    margin: 1.5rem 0;
}

.video-figure {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #f1f5f9;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-figure figcaption {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.5rem;
    text-align: center;
}

.terminal-window {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
}

.terminal-titlebar {
    background: #323232;
    color: #ccc;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: ui-monospace, Monaco, monospace;
}

.terminal-body {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 1.25rem 1.5rem;
    font-family: ui-monospace, Monaco, Consolas, monospace;
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.terminal-window--expandable .terminal-body {
    padding: 0.2rem 0.75rem 0.35rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-body .prompt {
    color: #7ec699;
}

.terminal-body .comment {
    color: #6a9955;
}

/* Expandable terminal: show ~5–6 lines by default, full content when expanded */
.terminal-body__scroll-wrap {
    display: block;
    text-align: left;
}

.terminal-body__scroll-wrap > .comment {
    display: block;
    margin: 0;
}

.terminal-body__scroll-wrap pre {
    margin: 0;
    white-space: pre;
}

/* No gap between comment and data in expandable terminal */

/* Collapsed: fixed height so 5–6 lines of content + summary line visible */
#raw-output-terminal .terminal-body__scroll-wrap {
    height: 18rem;
    overflow: hidden;
    line-height: 1.5;
}

.terminal-window--expandable .terminal-body__scroll-wrap {
    height: 18rem;
    overflow: hidden;
    line-height: 1.5;
}

.terminal-window--expandable.is-expanded .terminal-body__scroll-wrap,
#raw-output-terminal.is-expanded .terminal-body__scroll-wrap {
    height: auto;
    max-height: 80vh;
    overflow: auto;
}

.terminal-window--expandable .terminal-expand-btn {
    margin-top: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.terminal-expand-btn {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #323232;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.terminal-expand-btn:hover {
    background: #404040;
    color: #fff;
}

[class*="plot-tip"],
.plot-tip {
    color: #1e293b !important;
    background: white !important;
    font-weight: 500;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

g[aria-label="tip"] text {
    fill: #1e293b !important;
}
