@charset "UTF-8";

/* Styles for PEPs */

/*
 * `initial` works like undefined variables, so `var(initial, x)` will resolve to `x`.
 * A space means an empty value, so `var( , x) y` will resolve to `y`.
 */
@media (prefers-color-scheme: dark) {
   :root {
    --light: ;
    --dark: initial;
  }
}

@media (prefers-color-scheme: light) {
   :root {
    --dark: ;
    --light: initial;
  }
}

:root[data-colour_scheme="dark"] {
  --light: ;
  --dark: initial;
}

:root[data-colour_scheme="light"] {
  --dark: ;
  --light: initial;
}

/* Set master colours */
:root {
    --colour-background: var(--light, white) var(--dark, #111);
    --colour-background-accent-strong: var(--light, #ccc) var(--dark, #444);
    --colour-background-accent-medium: var(--light, #ddd) var(--dark, #333);
    --colour-background-accent-light: var(--light, #eee) var(--dark, #222);
    --colour-text: var(--light, #333) var(--dark, #ccc);
    --colour-text-strong: var(--light, #222) var(--dark, #ddd);
    --colour-links: var(--light, #069) var(--dark, #8bf);
    --colour-links-light: var(--light, #057) var(--dark, #acf);
    --colour-scrollbar: var(--light, #ccc) var(--dark, #333);
    --colour-rule-strong: var(--light, #888) var(--dark, #777);
    --colour-rule-light: var(--light, #ddd) var(--dark, #222);
    --colour-inline-code-bg: var(--light, #eee) var(--dark, #333);
    --colour-inline-code-text: var(--light, #222) var(--dark, #ccc);
    --colour-error: var(--light, #faa) var(--dark, #800);
    --colour-warning: var(--light, #fca) var(--dark, #840);
    --colour-caution: var(--light, #ffa) var(--dark, #550);
    --colour-attention: var(--light, #bdf) var(--dark, #045);
    --colour-tip: var(--light, #bfc) var(--dark, #041);
}

img.invert-in-dark-mode {
    filter: var(--dark, invert(1) hue-rotate(.5turn));
}

/* Set master rules */
* {box-sizing: border-box}
:root {color-scheme: light dark}
html {
    overflow-y: scroll;
    line-height: 1.5;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
}
body {
    margin: 0;
    color: var(--colour-text);
    background-color: var(--colour-background);
}
section#pep-page-section {
    padding: 0.25rem;
}

/* This is likely very close to the browser default, but we make it a variable
 * so it can be used in other rules. */
:root {
    --paragraph-margin-vertical: 1em;
}
p {
    margin: var(--paragraph-margin-vertical) 0;
}

/* Header rules */
h1 {
    font-size: 2rem;
    font-weight: bold;
}
h2 {
    font-size: 1.6rem;
    font-weight: bold;
}
h3 {
    font-size: 1.4rem;
    font-weight: normal;
}
h4 {
    font-size: 1.2rem;
    font-weight: normal;
}
h5,
h6 {
    font-size: 1rem;
    font-weight: bold;
}

/* Anchor link rules */
a,
a:active,
a:visited {
    color: var(--colour-links);
    display: inline;
    overflow-wrap: anywhere;
    text-decoration-color: var(--colour-background-accent-strong);
}
a:hover,
a:focus {
    text-decoration-color: var(--colour-rule-strong);
}

/* Blockquote rules */
blockquote {
    font-style: italic;
    border-left: 1px solid var(--colour-rule-strong);
    padding: .5rem 1rem;
}
blockquote em {
    font-style: normal;
}

cite {
    font-style: italic;
}

/* Code rules (code literals and Pygments highlighting blocks) */
code,
pre {
    font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
    font-size: 0.875rem;
    -webkit-hyphens: none;
    hyphens: none;
}
code {
    overflow-wrap: anywhere;
}
code.literal {
    background-color: var(--colour-inline-code-bg);
    color: var(--colour-inline-code-text);
    font-size: .8em;
    padding: 1px 2px 1px;
}
pre {
    overflow-x: auto;
    padding: .5rem .75rem;
    white-space: pre;
}

.good pre {
  border-left: 3px solid rgba(74, 182, 93, 1);
}
.bad pre {
  border-left: 3px solid rgb(244, 76, 78);
}
.maybe pre {
  border-left: 3px solid rgb(244, 227, 76);
}

/* Contents rules */
details > summary {
    cursor: pointer;
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 1em;
}
details > summary:hover {
    text-decoration: underline;
}

/* Definition list rules */
dl dt {
    font-weight: bold;
}
dl dd {
    margin-bottom: 0.5rem;
}

/* Horizontal rule rule */
hr {
    border: 0;
    border-top: 1px solid var(--colour-rule-light);
}
/* Image rules */
img {
    max-width: 100%;
}
a img {
    display: block;
    margin: 0 auto;
}

/* List rules */
ol.loweralpha {list-style: lower-alpha}
ol.upperalpha {list-style: upper-alpha}
ol.lowerroman {list-style: lower-roman}
ol.upperroman {list-style: upper-roman}

/* We can't express this as a single rule using `not(.simple)`, because when a
 * simple list is nested inside another simple list, the inner list is not given
 * a class. So instead we use two rules, one more specific than the other. */
#pep-content ol li,
#pep-content ul li {
    margin: var(--paragraph-margin-vertical) 0;
}
#pep-content ol.simple li,
#pep-content ul.simple li {
    margin: 0 0;
}

/* Maths rules */
sub,
sup {
    font-size: .75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}
sup {top: -0.5em}
sub {bottom: -0.25em}

/* Table rules */
div.table-wrapper {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--colour-background-accent-strong);
}
table caption {
    margin: 1rem 0 .75rem;
}
table thead tr {
    background-color: var(--colour-background-accent-medium);
    color: var(--colour-text-strong);
}
table tbody tr {
    border-top: 1px solid var(--colour-background-accent-strong);
}
table th,
table td {
    text-align: left;
    padding: 0.25rem 0.5rem 0.2rem;
}
table.pep-zero-table tr td:nth-child(1),
table.pep-zero-table tr td:nth-child(2) {
    white-space: nowrap;
}
table th + th,
table td + td {
    border-left: 1px solid var(--colour-background-accent-strong);
}
/* Common column widths for PEP status tables  */
table.pep-zero-table tr td:nth-child(1) {
    width: 5%;
}
table.pep-zero-table tr td:nth-child(2) {
    width: 7%;
}
table.pep-zero-table tr td:nth-child(3),
table.pep-zero-table tr td:nth-child(4){
    width: 41%;
}
table.pep-zero-table tr td:nth-child(5) {
    width: 6%;
}
/* Authors & Sponsors table */
#authors-owners table td,
#authors-owners table th {
    width: 50%;
}

/* Numerical index */
article:has(> section#numerical-index) {
    float: unset !important;
    width: 90% !important;
    max-width: 90% !important;
}

/* Breadcrumbs rules */
section#pep-page-section > header {
    border-bottom: 1px solid var(--colour-rule-light);
}
section#pep-page-section > header > h1 {
    font-size: 1.1rem;
    margin: 0;
    display: inline-block;
    padding-right: .6rem;
    border-right: 1px solid var(--colour-rule-strong);
}
ul.breadcrumbs {
    margin: 0;
    padding: .5rem 0 .5rem .4rem;
    list-style: none;
    display: inline-block;
}
ul.breadcrumbs li {
    display: inline;
}
ul.breadcrumbs a {
    text-decoration: none;
}

/* Dark mode toggle rules */
#colour-scheme-cycler {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 1.2rem;
    height: 1.2rem;
    float: right;
    transform: translate(0, 50%);
}
#colour-scheme-cycler svg {
    color: var(--colour-rule-strong);
    height: 1.2rem;
    width: 1.2rem;
    display: none;
}
:root[data-colour_scheme="auto"] #colour-scheme-cycler svg.colour-scheme-icon-when-auto {display: initial}
:root[data-colour_scheme="dark"] #colour-scheme-cycler svg.colour-scheme-icon-when-dark {display: initial}
:root[data-colour_scheme="light"] #colour-scheme-cycler svg.colour-scheme-icon-when-light {display: initial}

/* Admonitions rules */
div.admonition {
    background-color: var(--colour-background-accent-medium);
    margin-bottom: 1rem;
    margin-top: 1rem;
    padding: 0.5rem 0.75rem;
}
div.admonition a {
    color: var(--colour-links-light);
}

div.danger,
div.error {
    background-color: var(--colour-error);
}
div.warning {
    background-color: var(--colour-warning);
}
div.attention,
div.caution {
    background-color: var(--colour-caution);
}
div.important {
    background-color: var(--colour-attention);
}
div.hint,
div.tip {
    background-color: var(--colour-tip);
}

p.admonition-title {
    font-weight: bold;
}

/* PEP Header / references rules */
dl.rfc2822,
dl.footnote {
    display: grid;
    grid-template-columns: fit-content(30%) auto;
    width: 100%;
}
dl.footnote {
    border-top: 1px solid var(--colour-rule-strong);
    line-height: 1.875;
}
dl.rfc2822 > dt,
dl.rfc2822 > dd {
    padding: .1rem .3rem .1rem;
}
dl.footnote > dt,
dl.footnote > dd {
    padding: .25rem .5rem .2rem;
    border-bottom: 1px solid var(--colour-rule-strong);
}
dl.rfc2822 > dt {
    text-align: right;
}
dl.footnote > dt {
    font-weight: normal;
    border-right: 1px solid var(--colour-background);
}
dl.rfc2822 > dd,
dl.footnote > dd {
    margin: 0;
}

/* Sidebar formatting */
#pep-sidebar {
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}
#pep-sidebar > h2 {
    font-size: 1.4rem;
}
#contents ol,
#contents ul,
#pep-sidebar ol,
#pep-sidebar ul {
    padding: 0;
    margin: 0 0 0 1.5rem;
}
#pep-sidebar ul {
    font-size: .9rem;
    margin-left: 1rem;
}
#pep-sidebar ul a {
    text-decoration: none;
}
#source {
    padding-bottom: 2rem;
    font-weight: bold;
}
/* Pagefind search styling (custom, no default CSS) */
.pagefind-ui {
    --pagefind-ui-primary: var(--colour-links);
    --pagefind-ui-text: var(--colour-text);
    --pagefind-ui-background: var(--colour-background);
    --pagefind-ui-border: var(--colour-background-accent-strong);
    font-family: inherit;
    width: 100%;
}

/* Search form */
.pagefind-ui__form {
    position: relative;
}

/* Search icon */
.pagefind-ui__form::before {
    background-color: var(--pagefind-ui-text);
    width: 14px;
    height: 14px;
    top: 8px;
    left: 8px;
    content: "";
    position: absolute;
    display: block;
    opacity: 0.5;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.7549 11.255H11.9649L11.6849 10.985C12.6649 9.845 13.2549 8.365 13.2549 6.755C13.2549 3.165 10.3449 0.255005 6.75488 0.255005C3.16488 0.255005 0.254883 3.165 0.254883 6.755C0.254883 10.345 3.16488 13.255 6.75488 13.255C8.36488 13.255 9.84488 12.665 10.9849 11.685L11.2549 11.965V12.755L16.2549 17.745L17.7449 16.255L12.7549 11.255ZM6.75488 11.255C4.26488 11.255 2.25488 9.245 2.25488 6.755C2.25488 4.26501 4.26488 2.255 6.75488 2.255C9.24488 2.255 11.2549 4.26501 11.2549 6.755C11.2549 9.245 9.24488 11.255 6.75488 11.255Z' fill='%23000000'/%3E%3C/svg%3E%0A");
    mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.7549 11.255H11.9649L11.6849 10.985C12.6649 9.845 13.2549 8.365 13.2549 6.755C13.2549 3.165 10.3449 0.255005 6.75488 0.255005C3.16488 0.255005 0.254883 3.165 0.254883 6.755C0.254883 10.345 3.16488 13.255 6.75488 13.255C8.36488 13.255 9.84488 12.665 10.9849 11.685L11.2549 11.965V12.755L16.2549 17.745L17.7449 16.255L12.7549 11.255ZM6.75488 11.255C4.26488 11.255 2.25488 9.245 2.25488 6.755C2.25488 4.26501 4.26488 2.255 6.75488 2.255C9.24488 2.255 11.2549 4.26501 11.2549 6.755C11.2549 9.245 9.24488 11.255 6.75488 11.255Z' fill='%23000000'/%3E%3C/svg%3E%0A");
    -webkit-mask-size: 100%;
    mask-size: 100%;
    z-index: 9;
    pointer-events: none;
}

/* Search input */
.pagefind-ui__search-input {
    height: 30px;
    padding: 4px 28px 4px 28px;
    background-color: var(--pagefind-ui-background);
    border: 1px solid var(--pagefind-ui-border);
    border-radius: 3px;
    font-size: 0.875rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    box-sizing: border-box;
    color: var(--pagefind-ui-text);
}
.pagefind-ui__search-input:focus {
    outline: none;
    border-color: var(--pagefind-ui-primary);
}
.pagefind-ui__search-input::placeholder {
    color: var(--pagefind-ui-text);
    opacity: 0.5;
}

/* Clear button - fixed position relative to input (30px height, center button) */
.pagefind-ui__search-clear {
    position: absolute;
    top: 5px;
    right: 4px;
    padding: 2px 6px;
    color: var(--pagefind-ui-text);
    font-size: 0.75rem;
    cursor: pointer;
    background-color: var(--pagefind-ui-background);
    border: none;
    opacity: 0.6;
}
.pagefind-ui__search-clear:hover {
    opacity: 1;
}

/* Results container */
.pagefind-ui__results-area {
    margin-top: 0.5rem;
}

/* Results list */
#pep-sidebar .pagefind-ui__results {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual result */
.pagefind-ui__result {
    padding: 0.5rem 0 0.5rem 0.5rem;
    border-bottom: 1px solid var(--colour-rule-light);
}
.pagefind-ui__result:last-child {
    border-bottom: none;
}

/* Result link */
.pagefind-ui__result-link {
    font-weight: bold;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--colour-links);
}
.pagefind-ui__result-link:hover {
    text-decoration: underline;
}

/* Result title */
.pagefind-ui__result-title {
    margin: 0;
}

/* Result excerpt/snippet */
.pagefind-ui__result-excerpt {
    font-size: 0.8rem;
    color: var(--colour-text);
    margin: 0.25rem 0 0;
    line-height: 1.4;
}

/* Highlight matches in results */
.pagefind-ui__result-excerpt mark,
mark.pagefind-ui__highlight {
    background-color: var(--colour-caution);
    color: inherit;
    padding: 0 2px;
}

/* Message when no results */
.pagefind-ui__message {
    font-size: 0.85rem;
    color: var(--colour-text);
    padding: 0.5rem 0;
}

/* Loading state */
.pagefind-ui__loading {
    font-size: 0.85rem;
    color: var(--colour-text);
    opacity: 0.7;
}

/* Sub-results (nested) */
.pagefind-ui__result-nested {
    margin-left: 1rem;
    padding: 0.25rem 0;
}
.pagefind-ui__result-nested .pagefind-ui__result-link {
    font-weight: normal;
    font-size: 0.85rem;
}

/* Button styling */
.pagefind-ui__button {
    background: var(--colour-background-accent-light);
    border: 1px solid var(--colour-background-accent-strong);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--colour-text);
    margin-top: 0.5rem;
}
.pagefind-ui__button:hover {
    background: var(--colour-background-accent-medium);
}

/* Drawer (expandable results container) */
.pagefind-ui__drawer {
    overflow: hidden;
}

/* Suppress unused pagefind elements */
.pagefind-ui__suppressed {
    display: none;
}

.reference.external > strong {
    font-weight: normal;  /* Fix strong links for :pep: and :rfc: roles */
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: polygon(0px 0px, 0px 0px,0px 0px, 0px 0px) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Sticky banners */
/* Default styles, sticky for larger screens */
.sticky-banner {
  top: 0;
  position: sticky;
  z-index: 1;
}

/* Override for smaller screens, non-sticky */
@media (max-width: 600px) {
  .sticky-banner {
    position: static;
    padding: 5px;
    font-size: 12px;
  }
}

.close-button {
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.5em;
  font-size: 1.5em;
  border: none;
  background: transparent;
  color: inherit;
  margin-top: 0;
}
