/* Layout */
html,
body {
    height: 100vh;
}

body > header {
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    box-shadow: var(--pico-card-box-shadow);
}

body > footer {
    position: sticky;
    top: 100vh;
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    box-shadow: var(--pico-card-box-shadow);
}

nav {
    flex-wrap: wrap;
}

main.container {
    margin-inline: auto;
}

blockquote {
    margin-left: var(--pico-spacing);
}

blockquote > p {
    margin-bottom: 0;
}

/* Sticky TOC */
.col-xl-3 aside,
.col-md-2 aside {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

.col-xl-3 aside nav,
.col-md-2 aside nav {
    width: 100%;
    max-width: 100%;
}

/* Links in h elements */
h1 > a,
h2 > a,
h3 > a,
h4 > a,
h5 > a,
h6 > a {
    --pico-color: inherit;
    --pico-underline: inherit;
}

/* Table of contents */
details.toc > summary {
    margin-bottom: calc(var(--pico-nav-element-spacing-vertical) * 0.5);
}

/* Hugo TOC styles */
details.toc nav#TableOfContents ul {
    margin-left: 5px;
    padding-left: 15px;
    border-left: var(--pico-border-width) solid var(--pico-muted-border-color);
    width: 100%;
    box-sizing: border-box;
}

details.toc nav#TableOfContents ul li {
    margin: 0;
    padding: calc(var(--pico-nav-element-spacing-vertical) * 0.25) 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

details.toc nav#TableOfContents a {
    text-decoration: none;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* notice */
.notice {
    border-width: 2px 5px;
    border-style: solid;
    border-radius: 6px;
    padding: 1em 1.2em;
    margin: 1.2em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    background: var(--pico-background-color);
}

.notice > div {
    margin: 0;
}

/* codeblock titles */
div.highlight[title]::before {
    content: attr(title);
    border-bottom: 2px solid var(--pico-primary-border);
    font-style: italic;
    padding: 0px 5px;
    margin-left: 10px;
}

/* ad block */
aside.ad-block {
    margin: 2rem 0;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #f9f9f9;
}

aside.ad-block .ad-content p {
    margin: 0;
    color: #666;
    text-align: center;
}

/* tech-playground */
tech-playground > .tech-playground-controls {
    display: inline-block;
    margin-bottom: 10px;
}

tech-playground > .tech-playground-controls > * {
    margin-right: 5px;
    margin-bottom: 3px;
}

tech-playground > .tech-playground-controls > .loading-indicator,
tech-playground > .tech-playground-controls > .powered-by-indicator {
    font-style: italic;
}

tech-playground > .tech-playground-output.boxed > details {
    border-top: 3px solid var(--pico-muted-border-color);
    border-right: 2px solid var(--pico-muted-border-color);
    border-bottom: 3px solid var(--pico-muted-border-color);
    border-left: 7px solid var(--pico-muted-border-color);
    border-radius: 2px;
    margin-bottom: 12px;
}

tech-playground > .tech-playground-output.boxed > details > summary {
    border-bottom: 2px solid var(--pico-primary-border);
    font-style: italic;
    padding: 3px 5px;
}

tech-playground > .tech-playground-output.boxed > details > pre {
    margin: unset;
}

/* footer */
footer .legal {
    display: flex;
    justify-content: space-between;
}

footer .legal > span {
    font-size: 0.9em;
}

#pagefind {
    --pagefind-ui-scale: 1;
    --pagefind-ui-text: var(--pico-color);
    --pagefind-ui-background: var(--pico-background-color);
    --pagefind-ui-border: var(--pico-primary-border);
    --pagefind-ui-tag: var(--pico-secondary-background);
    --pagefind-ui-border-width: 2px;
    --pagefind-ui-border-radius: 8px;
    --pagefind-ui-image-border-radius: 8px;
    --pagefind-ui-image-box-ratio: 3 / 2;
}
