/* SPDX-License-Identifier: GPL-2.0 */
/*
 * CSS tweaks for the Alabaster theme
 */

/* Shrink the headers a bit */
div.body h1 { font-size: 180%; }
div.body h2 { font-size: 150%; }
div.body h3 { font-size: 130%; }
div.body h4 { font-size: 110%; }

/* toctree captions are styled like h2 */
div.toctree-wrapper p.caption[role=heading] { font-size: 150%; }

/* Tighten up the layout slightly */
div.body { padding: 0 15px 0 10px; }
div.sphinxsidebarwrapper { padding: 1em 0.4em; }
div.sphinxsidebar { font-size: inherit;
		    max-height: 100%;
		    overflow-y: auto; }
/* Tweak document margins and don't force width */
div.document {
    margin: 20px 10px 0 10px;
    width: auto;
}

/* Size the logo appropriately */
img.logo {
    width: 104px;
    margin-bottom: 20px;
}

/* The default is to use -1em, wich makes it override text */
li { text-indent: 0em; }

/*
 * Parameters for the display of function prototypes and such included
 * from C source files.
 */
dl.function, dl.struct, dl.enum { margin-top: 2em; background-color: #ecf0f3; }
/* indent lines 2+ of multi-line function prototypes */
dl.function dt { margin-left: 10em; text-indent: -10em; }
dt.sig-object { font-size: larger; }
div.kernelindent { margin-left: 2em; margin-right: 4em; }

/*
 * Parameters for the display of function prototypes and such included
 * from Python source files.
 */
dl.py { margin-top: 2em; background-color: #ecf0f3; }
dl.py.class { margin-left: 2em; text-indent: -2em; padding-left: 2em; }
dl.py.method, dl.py.attribute { margin-left: 2em; text-indent: -2em; }
dl.py li, pre { text-indent: 0em; padding-left: 0 !important; }

/*
 * Tweaks for our local TOC
 */
div.kerneltoc li.toctree-l1 { font-size: smaller;
		text-indent: -1em;
		margin-left: 1em; }
div.kerneltoc li.current > a {font-weight: bold; }
div.kerneltoc li.toctree-l2,li.toctree-l3 { font-size: small;
		text-indent: -1em;
		margin-left: 1em;
		list-style-type: none;
	      }
div.kerneltoc li.current ul { margin-left: 0; }
div.kerneltoc { background-color: #eeeeee; }
div.kerneltoc li.current ul { background-color: white; }

/*
 * The CSS magic to toggle the contents on small screens.
 */
label.kernel-toc-title { display: none; }
label.kernel-toc-title:after {
    content: "[Hide]";
}
input[type=checkbox]:checked ~ label.kernel-toc-title:after {
    content: "[Show]";
}
/* Hide the toggle on large screens */
input.kernel-toc-toggle { display: none; }

/*
 * Show and implement the toggle on small screens.
 * The 875px width seems to be wired into alabaster.
 */
@media screen and (max-width: 875px) {
    label.kernel-toc-title { display: inline;
			     font-weight: bold;
			     font-size: larger; }
    input[type=checkbox]:checked ~ div.kerneltoc {
	display: none;
    }
    h3.kernel-toc-contents { display: inline; }
    div.kerneltoc a { color: black; }
}

/* Language selection menu */

div.admonition {
    /*
     * Make sure we don't overlap notes and warnings at the top of the
     * document.
     */
    clear: both;
}

div.language-selection {
    background: #eeeeee;
    border: 1px solid #cccccc;
    margin-bottom: 1em;
    padding: .5em;

    position: relative;
    float: right;
}

div.language-selection a {
    display: block;
    padding: 0.5em;
    color: #333333;
    text-decoration: none;
}

div.language-selection ul {
    display: none;
    position: absolute;

    /* Align with the parent div */
    top: 100%;
    right: 0;
    margin: 0;

    list-style: none;

    background: #fafafa;
    border: 1px solid #cccccc;

    /* Never break menu item lines */
    white-space: nowrap;
}

div.language-selection:hover ul {
    display: block;
}

div.language-selection ul li:hover {
    background: #dddddd;
}

/* Make xrefs more universally visible */
a.reference, a.reference:hover {
    border-bottom: none;
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

/* Slightly different style for sidebar links */
div.sphinxsidebar a { border-bottom: none; }
div.sphinxsidebar a:hover {
    border-bottom: none;
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

a.manpage {
	font-style: normal;
	font-weight: bold;
	font-family: "Courier New", Courier, monospace;
}

/* Keep the quick search box as-is and add a secondary advanced search link. */
div.sphinxsidebar p.search-advanced-link {
    margin: 0.5em 0 0 0;
    font-size: 0.95em;
}

/*
 * The enhanced search page keeps the stock GET workflow but adds
 * filter controls and grouped results.
 */
form.kernel-search-form {
    margin-bottom: 2em;
}

/* Search bar layout: query input and submit action row. */
div.kernel-search-query-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: end;
}

div.kernel-search-query-field {
    flex: 1 1 26em;
}

div.kernel-search-query-field label,
div.kernel-search-field label,
fieldset.kernel-search-kind-filters legend {
    display: block;
    font-weight: bold;
    margin-bottom: 0.35em;
}

div.kernel-search-query-field input[type="text"],
div.kernel-search-field select {
    width: 100%;
    box-sizing: border-box;
}

div.kernel-search-query-actions {
    display: flex;
    align-items: center;
    gap: 0.75em;
}

span.kernel-search-progress {
    min-height: 1.2em;
    color: #666;
}

/* Collapsible advanced-filter panel. */
details.kernel-search-advanced {
    margin-top: 1em;
    padding: 0.75em 1em 1em 1em;
    border: 1px solid #cccccc;
    background: #f7f7f7;
}

details.kernel-search-advanced summary {
    cursor: pointer;
    font-weight: bold;
}

/* Responsive grid for advanced search filters. */
div.kernel-search-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
    gap: 1em 1.25em;
    margin-top: 1em;
}

fieldset.kernel-search-kind-filters {
    margin: 0;
    padding: 0;
    border: none;
}

label.kernel-search-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    margin-bottom: 0.35em;
}

/* Tabbed result shell, cards, and lazy-loaded page summaries. */
div.kernel-search-results {
    margin-top: 1.5em;
}

p.kernel-search-status {
    margin-bottom: 1.5em;
}

div.kernel-search-results-shell {
    display: flex;
    flex-direction: column;
    max-height: min(78vh, 56rem);
    border: 1px solid #d8d8d8;
    border-radius: 0.75rem;
    background: #fbfbfb;
    overflow: hidden;
}

div.kernel-search-tab-strip {
    position: relative;
    flex: 0 0 auto;
    border-bottom: 1px solid #dddddd;
    background: #ffffff;
}

div.kernel-search-tab-strip::before,
div.kernel-search-tab-strip::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease-in-out;
    z-index: 2;
}

div.kernel-search-tab-strip::before {
    left: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

div.kernel-search-tab-strip::after {
    right: 0;
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

div.kernel-search-tab-strip.has-left-shadow::before,
div.kernel-search-tab-strip.has-right-shadow::after {
    opacity: 1;
}

div.kernel-search-tab-scroller {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.85rem 1rem 0;
    scrollbar-width: thin;
}

button.kernel-search-tab {
    appearance: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0.6rem 0.6rem 0 0;
    background: transparent;
    color: #444444;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    margin: 0;
    padding: 0.7rem 0.95rem 0.65rem;
    white-space: nowrap;
}

button.kernel-search-tab:hover {
    background: #f3f3f3;
}

button.kernel-search-tab:focus-visible {
    outline: 2px solid #1f6feb;
    outline-offset: 2px;
}

button.kernel-search-tab.is-active {
    background: #fbfbfb;
    border-color: #d8d8d8;
    color: #111111;
    font-weight: bold;
}

span.kernel-search-tab-label {
    line-height: 1.2;
}

span.kernel-search-tab-count {
    color: #666666;
    font-size: 0.95em;
}

div.kernel-search-panels {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

section.kernel-search-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 1rem 1rem;
}

section.kernel-search-panel[hidden] {
    display: none;
}

ol.kernel-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

li.kernel-search-result {
    padding: 0.9em 0;
    border-top: 1px solid #dddddd;
}

li.kernel-search-result:first-child {
    border-top: none;
}

div.kernel-search-result-heading {
    font-weight: bold;
}

div.kernel-search-path,
div.kernel-search-meta,
p.kernel-search-summary {
    margin-top: 0.3em;
    color: #555555;
}

div.kernel-search-path,
div.kernel-search-meta {
    font-size: 0.95em;
}

p.kernel-search-summary {
    margin-bottom: 0;
}

p.kernel-search-summary-status {
    font-style: italic;
}

p.kernel-search-summary-status.is-error {
    color: #8b0000;
}

/* Responsive layout adjustments for narrow and wide screens. */
@media screen and (max-width: 65em) {
    div.kernel-search-query-actions {
        width: 100%;
        justify-content: flex-start;
    }

    div.kernel-search-results-shell {
        max-height: 70vh;
    }
}

@media screen and (min-width: 65em) {
    div.kernel-search-result-heading,
    div.kernel-search-path,
    div.kernel-search-meta,
    p.kernel-search-summary {
        margin-left: 2rem;
    }
}
