/* Base styles and content styles */

:root {
    /* Browser default font-size is 16px, this way 1 rem = 10px */
    font-size: 62.5%;
    color-scheme: var(--color-scheme);
}

html {
    font-family: "Roboto", sans-serif;
    color: var(--fg);
    background-color: var(--bg);
    text-size-adjust: none;
    -webkit-text-size-adjust: none;
}

body {
    margin: 0;
    font-size: 1.6rem;
    overflow: hidden;
}

code {
    font-family: var(--mono-font) !important;
    font-size: var(--code-font-size);
    direction: ltr !important;
    overflow-x: auto;
}

/* make long words/inline code not x overflow */
main {
    overflow-wrap: break-word;
}

/* make wide tables scroll if they overflow */
.table-wrapper {
    overflow-x: auto;
}

/* Don't change font size in headers. */
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
    font-size: unset;
}

.left { float: left; }
.right { float: right; }
.boring { opacity: 0.6; }
.hide-boring .boring { display: none; }
.hidden { display: none !important; }

.header + .header h3,
.header + .header h4,
.header + .header h5 {
    margin-block-start: 1em;
}

h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before {
    display: inline-block;
    content: "»";
    margin-inline-start: -30px;
    width: 30px;
}

/* This is broken on Safari as of version 14, but is fixed
   in Safari Technology Preview 117 which I think will be Safari 14.2.
   https://bugs.webkit.org/show_bug.cgi?id=218076
*/
:target {
    /* Safari does not support logical properties */
    scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}

#page-wrapper {
    flex-grow: 1;
    overflow-x: hidden;
    overflow-y: auto;
}

.page {
    outline: 0;
    padding: var(--page-padding);
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}

.content {
    overflow-y: auto;
    padding: 0 5px 50px 5px;
}

.content p { line-height: 1.45em; }
.content ol { line-height: 1.45em; }
.content ul { line-height: 1.45em; }
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content img, .content video { max-width: 100%; }
.content .header:link,
.content .header:visited {
    color: var(--fg);
}
.content .header:link,
.content .header:visited:hover {
    text-decoration: none;
}
/* TABLE */
.table-wrapper {
    border: var(--border);
    border-radius: var(--radius);
    margin-top: 16px;
    margin-bottom: 16px;

    --radius: 8px;
    --border: 1px solid #c1c7d4;
    --header-color: #f0f4ff;
    --cell-padding: 16px;
}

html.dark .table-wrapper {
    --header-color: #282c34;
    --border: 1px solid var(--sidebar-spacer);
}

table {
    text-align: left;
    border-collapse: collapse;
    width: 100%;
}

tr {
    border-top: var(--border);
    border-bottom: var(--border);
    vertical-align: top;
}

th, td {
    border-left: var(--border);
    border-right: var(--border);
    padding: var(--cell-padding);
}

th:first-child, td:first-child {
    border-left: 0;
}

th:last-child, td:last-child {
    border-right: 0;
}

tr:first-child {
    border-top: 0;
}

thead tr:first-child > td:first-child, thead tr:first-child > th:first-child {
    border-top-left-radius: var(--radius);
}

thead tr:first-child > td:last-child, thead tr:first-child > th:last-child {
    border-top-right-radius: var(--radius);
}

tbody tr:last-child {
    border-bottom: 0;
}

thead tr {
    background: var(--header-color);
}

tr p:first-child {
    margin-top: 0;
}

tr p:last-child {
    margin-bottom: 0;
}

/* TABLE */

.table-wrapper.script-example th {
    width: 190px;
}

/* Style for the first level ordered list */
.content ol {
    counter-reset: section;
}

.content ol > li {
    counter-increment: section;
    list-style: none;
    position: relative;
    margin: 0.5em 0;
}

.content ul > li {
    margin: 0.5em 0;
}

.content ol > li::before {
    content: counters(section, ".") ". ";
    position: absolute;
    left: -1.5em; /* Adjust the value as needed */
}

/* Style for the second level ordered list */
.content ol > li > ol {
    counter-reset: subsection;
    list-style: none;
    padding-left: 1.5em; /* Adjust the padding as needed */
}

.content ol > li > ol > li {
    counter-increment: subsection;
}

.content ol > li > ol > li::before {
    content: counters(section, ".") "" counter(subsection, lower-alpha) ". ";
    position: absolute;
    left: -1.5em; /* Adjust the value as needed */
}

blockquote {
    margin: 20px 0;
    padding: 0 20px;
    color: var(--fg);
    background-color: var(--quote-bg);
    border-block-start: .1em solid var(--quote-border);
    border-block-end: .1em solid var(--quote-border);
}

kbd {
    background-color: var(--table-border-color);
    border-radius: 4px;
    border: solid 1px var(--theme-popup-border);
    box-shadow: inset 0 -1px 0 var(--theme-hover);
    display: inline-block;
    font-size: var(--code-font-size);
    font-family: var(--mono-font);
    line-height: 10px;
    padding: 4px 5px;
    vertical-align: middle;
}

:not(.footnote-definition) + .footnote-definition,
.footnote-definition + :not(.footnote-definition) {
    margin-block-start: 2em;
}
.footnote-definition {
    font-size: 0.9em;
    margin: 0.5em 0;
}
.footnote-definition p {
    display: inline;
}

.tooltiptext {
    position: absolute;
    visibility: hidden;
    color: #fff;
    background-color: #333;
    transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
    left: -8px; /* Half of the width of the icon */
    top: -35px;
    font-size: 0.8em;
    text-align: center;
    border-radius: 6px;
    padding: 5px 8px;
    margin: 5px;
    z-index: 1000;
    font-family: "Roboto", sans-serif;
}
.tooltipped .tooltiptext {
    visibility: visible;
}

.chapter li.part-title {
    color: var(--sidebar-fg);
    margin: 5px 0;
    font-weight: bold;
}

.result-no-output {
    font-style: italic;
}

.content figure {
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: column;
}

.content figure.mac-screenshot img,
.content figure.no-shadow img,
.content figure.diagram img {
    box-shadow: unset;
}

.content figure.diagram img {
    max-width: calc(100% - 30px);
}

html.light .content figure img.dark {
    display: none;
}

html.dark .content figure img.light {
    display: none;
}

.content figure {
    margin: 32px 0;
}

.content figure pre {
    max-width: 800px;
    width: 100%;
}

.content figure.mac-screenshot,
.content figure.mac-screenshot img {
    /* mac screenshots have built-in margin */
    margin: 0;
}

.content figure img {
    max-width: 800px;
    box-shadow: 1px 1px 5px 1px rgb(0, 0, 0, 40%);
}

.content figure img,
.content figure div.tabbed-card {
    margin-bottom: 32px;
}

.content figure p:first-child {
    display: inline;
    margin: 0;
}

.content figure figcaption::before {
    content: "Figure: ";
    font-weight: bold;
}

.content figure figcaption {
    max-width: 600px;
}

.info-box {
    padding: 16px;
    border-left: 5px solid var(--info-box-border, black);
    display: flex;
    flex-direction: row;
    margin: 16px 0;
    gap: 20px;
    align-items: center;
}

.info-box i {
    font-size: 32px;
    color: var(--info-box-border);
}

.info-box.warning {
    --info-box-border: #e6b704;
}

.info-box.info {
    --info-box-border: #023774;
}

html.dark .info-box.info {
    --info-box-border: #096de3;
}

h2, h3 { margin-block-start: 2em; }
h4, h5 { margin-block-start: 2em; }

code.no-code-wrap,
.no-code-wrap code {
    white-space: nowrap;
}
