diff --git a/assets/styles/layouts/_api-code-samples.scss b/assets/styles/layouts/_api-code-samples.scss index 0ce7fc2f8..f4dbe6ecc 100644 --- a/assets/styles/layouts/_api-code-samples.scss +++ b/assets/styles/layouts/_api-code-samples.scss @@ -13,10 +13,11 @@ } .api-code-sample-header { + display: flex; + align-items: center; + justify-content: space-between; margin: 0; padding: $api-spacing-sm $api-spacing-md; - font-size: 0.85rem; - font-weight: 600; background: rgba(0, 0, 0, 0.03); border-bottom: 1px solid rgba(0, 0, 0, 0.1); @@ -24,14 +25,19 @@ background: rgba(255, 255, 255, 0.03); border-bottom-color: rgba(255, 255, 255, 0.1); } + + .api-code-sample-title { + font-size: 0.85rem; + font-weight: 600; + } } pre.api-code-block { margin: 0; padding: $api-spacing-md; overflow-x: auto; - background: #1e1e2e; - color: #cdd6f4; + background: $article-code-bg; + color: $article-code; font-size: 0.8rem; line-height: 1.5; border-radius: 0; @@ -46,25 +52,14 @@ pre.api-code-block { } } -.api-code-sample-footer { - display: flex; - justify-content: flex-end; - padding: $api-spacing-sm $api-spacing-md; - background: rgba(0, 0, 0, 0.03); - border-top: 1px solid rgba(0, 0, 0, 0.1); - - .dark-theme & { - background: rgba(255, 255, 255, 0.03); - border-top-color: rgba(255, 255, 255, 0.1); - } -} - .api-code-ask-ai { - font-size: 0.9rem; + font-size: 0.8rem; + font-weight: 400; text-decoration: none; color: $article-link; opacity: 0.7; transition: opacity 0.2s; + white-space: nowrap; &:hover { opacity: 1; diff --git a/assets/styles/layouts/_api-layout.scss b/assets/styles/layouts/_api-layout.scss index 3d998ecca..2515b00e1 100644 --- a/assets/styles/layouts/_api-layout.scss +++ b/assets/styles/layouts/_api-layout.scss @@ -9,11 +9,14 @@ // Content wrapper becomes flex container when used with API content // Override overflow:hidden from _content-wrapper.scss to enable sticky positioning +// Widen to compensate for the API TOC so article content matches regular pages .content-wrapper.api-content { display: flex; flex-direction: row; align-items: flex-start; overflow: visible; // Required for sticky TOC to work + width: calc(75% + 200px); + max-width: calc(100% - 2rem); } // Main API content area (center column) @@ -727,6 +730,7 @@ @include media(large) { .content-wrapper.api-content { flex-direction: column; + width: 75%; // Reset to default when TOC is hidden } .api-toc { @@ -770,9 +774,12 @@ } } -// Match sidebar responsive widths -@media (min-width: 801px) and (max-width: 1200px) { +// Compressed layout: narrower TOC, drop border to reduce visual clutter +// TOC is hidden at ≤1280px (large breakpoint), so this targets the +// narrow window where the TOC is visible but space is tight. +@media (min-width: 1281px) and (max-width: 1535px) { .api-toc { width: 180px; + border-left: none; } } diff --git a/assets/styles/layouts/_api-operations.scss b/assets/styles/layouts/_api-operations.scss index 9bf538681..12ccc3653 100644 --- a/assets/styles/layouts/_api-operations.scss +++ b/assets/styles/layouts/_api-operations.scss @@ -34,6 +34,11 @@ $status-server-error: #9b2aff; padding-top: $api-spacing-xl; border-top: 2px solid $nav-border; + // Keep inline code proportional to surrounding text + code { + font-size: inherit; + } + &:first-child { border-top: none; padding-top: 0; @@ -183,7 +188,6 @@ $status-server-error: #9b2aff; .api-param-description { margin-top: 0.25rem; - font-size: 0.9rem; color: $article-text; line-height: 1.5; @@ -323,7 +327,6 @@ $status-server-error: #9b2aff; .api-schema-property-description { margin-top: 0.25rem; - font-size: 0.9rem; color: $article-text; line-height: 1.5; @@ -358,22 +361,34 @@ $status-server-error: #9b2aff; // Schema Example Block .api-schema-example { margin-top: $api-spacing-md; - padding: $api-spacing-md; - background: $article-code-bg; + border: 1px solid rgba(0, 0, 0, 0.1); border-radius: $api-border-radius; + overflow: hidden; + + .dark-theme & { + border-color: rgba(255, 255, 255, 0.1); + } } .api-schema-example-title { - margin: 0 0 $api-spacing-sm; + display: block; + margin: 0; + padding: $api-spacing-sm $api-spacing-md; font-size: 0.85rem; font-weight: 600; - color: rgba($article-text, 0.6); + background: rgba(0, 0, 0, 0.03); + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + + .dark-theme & { + background: rgba(255, 255, 255, 0.03); + border-bottom-color: rgba(255, 255, 255, 0.1); + } } -.api-schema-example-code { +pre.api-schema-example-code { margin: 0; - padding: 0; - background: transparent; + padding: $api-spacing-sm $api-spacing-md; + background: $article-code-bg; overflow-x: auto; code { @@ -425,7 +440,6 @@ $status-server-error: #9b2aff; } .api-response-description { - font-size: 0.9rem; color: $article-text; } diff --git a/layouts/partials/api/code-sample.html b/layouts/partials/api/code-sample.html index bad575827..c8787de74 100644 --- a/layouts/partials/api/code-sample.html +++ b/layouts/partials/api/code-sample.html @@ -222,14 +222,14 @@ {{/* --- Render --- */}}
diff --git a/layouts/partials/api/schema.html b/layouts/partials/api/schema.html index e820c1c0c..29d1eb704 100644 --- a/layouts/partials/api/schema.html +++ b/layouts/partials/api/schema.html @@ -110,7 +110,7 @@ {{/* Show example at schema level */}} {{ if and $example (eq $level 0) }}{{ jsonify (dict "indent" " ") $example }}