/*
  Copyright (c) 2025 ADBC Drivers Contributors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

/***********************************************************************
 * General styles
 ***********************************************************************/
:root {
    --columnar: #434343;
}

/* Fixes for questionable choices in Material Design */

/* Header and drawer */
.md-header__button.md-logo {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.md-header__button.md-logo img {
    height: 2.4rem;
}

.md-header {
    background-color: var(--columnar) !important;
}

.md-hero__inner {
    margin: 0 auto;
    padding: 0 1rem;
}

.md-hero__inner p {
    color: white;
    display: inline-block;
}

.md-typeset__table {
    width: 100%;
}

.md-typeset table.data:not(.plain) {
    /* I cannot imagine why Material *doesn't* do this. */
    display: table;
}

/* Make sphinx-design and sphinx-immaterial play better */
.sd-card-text .sd-btn {
    font-size: inherit;
    padding: 0;
}

/* Fix text wrapping in highlighted code blocks. Very long, unbroken strings
   will break out of their box without this.
*/
.md-typeset pre {
    overflow-x: auto;
}

/* Let the site title wrap in the drawer. Otherwise our long site title
   truncates.
*/
[for=__drawer].md-nav__title {
    text-wrap: inherit;
    line-height: inherit;
}

/***********************************************************************
 Custom shields.io style badges. See conf.py. sphinx-design badges are too
 simple and this lets us customize our badges exactly as we need.

 - Supports light+dark mode
 - Available styles: primary, secondary, success, warning, danger, info
 ***********************************************************************/

/* Base badge styles */
.custom-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 0.3rem;
    overflow: hidden;
    font-size: 75%;
    line-height: 1rem;
    vertical-align: middle;
    white-space: nowrap;
}

/* Badge label (left part) */
.custom-badge .custom-badge-label {
    padding: 0.25em 0.5em;
    font-weight: 600;
}

/* Badge value (right part) */
.custom-badge .custom-badge-value {
    padding: 0.25em 0.5em;
}

/* primary material-blue-800 */
.custom-badge-primary .custom-badge-label {
    background-color: #0277BD;
    color: #ffffff;
}

.custom-badge-primary .custom-badge-value {
    background-color: #B3E5FC;
    color: #0d47a1;
}

[data-md-color-scheme="slate"] .custom-badge-primary .custom-badge-value {
    background-color: #1e3a5f;
    color: #90caf9;
}

/* secondary */
.custom-badge-secondary .custom-badge-label {
    background-color: #616161;
    color: #ffffff;
}

.custom-badge-secondary .custom-badge-value {
    background-color: #eeeeee;
    color: #424242;
}

[data-md-color-scheme="slate"] .custom-badge-secondary .custom-badge-value {
    background-color: #424242;
    color: #e0e0e0;
}

/* success */
.custom-badge-success .custom-badge-label {
    background-color: #2e7d32;
    color: #ffffff;
}

.custom-badge-success .custom-badge-value {
    background-color: #e8f5e9;
    color: #1b5e20;
}

[data-md-color-scheme="slate"] .custom-badge-success .custom-badge-value {
    background-color: #1b4d20;
    color: #a5d6a7;
}

/* warning */
.custom-badge-warning .custom-badge-label {
    background-color: #ef6c00;
    color: #ffffff;
}

.custom-badge-warning .custom-badge-value {
    background-color: #fff3e0;
    color: #e65100;
}

[data-md-color-scheme="slate"] .custom-badge-warning .custom-badge-value {
    background-color: #4d2c00;
    color: #ffcc80;
}

/* danger */
.custom-badge-danger .custom-badge-label {
    background-color: #c62828;
    color: #ffffff;
}

.custom-badge-danger .custom-badge-value {
    background-color: #ffebee;
    color: #b71c1c;
}

[data-md-color-scheme="slate"] .custom-badge-danger .custom-badge-value {
    background-color: #4d1a1a;
    color: #ef9a9a;
}

/* info */
.custom-badge-info .custom-badge-label {
    background-color: #616161;
    color: #ffffff;
}

.custom-badge-info .custom-badge-value {
    background-color: #bdbdbd80;
    color: #424242;
}

[data-md-color-scheme="slate"] .custom-badge-info .custom-badge-value {
    background-color: #bdbdbd47;
    color: #edededa0;
}

/*
  Hack because I couldn't figure out how to override og-title on the index page.

  We want the header logo to be at the top and we don't want an actual, visible
  <h1> with the site title.

  The first thing I tried was eval-rst with the documented sphinx-opengraph
  override for :og:title: but it doesn't work at all and the content gets
  rendered literally and not processed. The second thing I tried was to add a
  top level heading but hide it with CSS but sphinx-opengraph includes the class
  in the result.

  So this is slightly more complicated than that. Apparently Sphinx turns the
  top level header into an id so as long as on other page has the exact same title this should work.

  From: https://www.tpgi.com/the-anatomy-of-visually-hidden/
*/
#adbc-driver-foundry-documentation>h1 {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}
