html {
    font-family:system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
}
body {
    width: 100%;
    height: 100%;
    word-break: break-word;
}

h1, h2, h3 {
    text-wrap: balance;
}

p cite {
    font-size: 10px;
    text-align: right;
    display: block;
}

@media (max-width: 1036px) {
  #panel {
      min-width: 100%;
  }
}

#bookPadding a:active {
    outline-width: 0;
}

section {
    line-height: 1.7;
    font-size: 24px;
    font-weight: 300;
    margin-top: 40px;
}

section.sub,
section.sub p {
    line-height: 1.7;
    font-size: 25px;
    margin-top: 100px;
    padding-bottom: 10px;
    font-weight: 300;
    margin-top: 40px;
}

h1 {
    margin-bottom: 20px;
    margin-top: 80px;
    font-size: 50px;
    line-height: 65px;
    font-weight: 700;
}

h2 {
    font-size: 35px;
    margin-top: 100px;
    padding-bottom: 20px;
    line-height: 1.2;
    border-bottom: 1px solid #ececec;
}

h3 {
    font-size: 25px;
    margin-top: 100px;
    padding-bottom: 10px;
    line-height: 1.2;
    font-weight: bold;
}

h4 {
    margin-top: 30px;
    line-height: 1.2;
    font-weight: bold;
}

#menu h3 {
    font-size: 26px;
    padding: 20px 20px 0 20px;
    line-height: 1.2;
    font-weight: bold;
    margin: 0px;
}

p {
    margin-top: 30px;
    font-size: var(--font-size-base);
    line-height: 1.7;
}

ul {
    margin: 20px 0 20px 40px;
    list-style: initial;
}

ol {
    margin: 20px 0 20px 40px;
}

ol li,
ul li {
    margin: 20px 0 0 0;
    line-height: 1.7;
}


hr {
    border: none;
    height: 20px;
    margin: 75px 0 75px 0;
}

.slideout-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 356px;
    min-height: 100vh;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    z-index: 0;
    display: none;
    background: linear-gradient(90deg, #1f1f1f 0.04%, #101010 100%);
}

.slideout-menu-left {
    left: 0;
}

.slideout-menu-right {
    right: 0;
}

.slideout-panel {
    position: relative;
    z-index: 1;
    will-change: transform;
    /* A background-color is required */
    min-height: 100vh;
}

#bookPadding {
    margin-left: auto;
    margin-right: auto;
    max-width: 1024px;
    padding: 0 5%;
    overflow: hidden;
}

.slideout-open .slideout-panel {
    margin-right: 356px;
}

.slideout-open .slideout-menu {
    display: block;
}

.sticky-bar {
    display: flex;
    justify-content: space-between;
    position: sticky;
    top: 0;
    left: 0;
}

#menuButton {
    background: radial-gradient(closest-side, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    cursor: pointer;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    z-index: 2;
}

#toggler {
    align-items: center;
    display: flex;
    height: 48px;
    justify-content: center;
    width: 48px;
}

#toc {
    padding: 20px 20px;
    font-size: 18px;
}

#toc h6 {
    margin-left: 10px;
    margin: 10px 0 0 10px;
    line-height: 1.8em;
}

#toc h5 {
    margin-top: 30px;
    margin-bottom: 20px;
    line-height: 1.6em;
    font-size: 14pt;
}

p+div.code-toolbar {
    margin-top: 30px;
}

.codesandboxlink,
.codesandboxlinkNotDynamic {
    font-size: 10px;
    margin-top: 15px;
    text-align: right;
    margin-right: 10px;
}

#panel .codesandboxlink a:link,
#panel .codesandboxlinkNotDynamic a:link {
    padding: 0 4px;
}

#panel .codesandboxlink a:active,
#panel .codesandboxlinkNotDynamic a:active {
    outline-width: 0;
}
table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    margin: 30px 0 0 0;
}

th,
td {
    line-height: 130%;
    padding: 0.5rem;
    text-align: left;
}

/* Horizontal bar / call to action */
.FmCta {
    align-items: flex-start;
    background: #000;
    color: #fff;
    display: flex;
    gap: 15px;
    line-height: 2;
    padding: 10px 15px;
    position: relative;
    z-index: 10;
}

.FmCtaLogo svg {
    fill: #c02d28;
    vertical-align: middle;
    width: 25px;
}

.FmCtaLogo:hover svg {
    fill: #dd625e;
}

.FmCtaText {
    display: flex;
    flex: 1;
    gap: 15px;
}

.FmCtaText a {
    color: #ccc;
    font-weight: bold;
}

.FmCtaText a:hover {
    color: #fff;
}


.theme-toggle {
    --size: 2rem;
    background: none;
    border: none;
    padding: 0;
    inline-size: var(--size);
    block-size: var(--size);
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline-offset: 5px;
}

/*** DARK theme ***/

:root {
    --font-size-base: clamp(1rem, .2vw + 1rem, 1.2rem);
    --gray-lightest: #e6e6e6;
    --link: #fc706b;
    --link-hover: #e58480;
    --link-visited: #fc706b;
    --background: #151515;
    --background-light: #545454;
    --body-text: var(--gray-lightest);
}

[data-theme="dark"] .dark-theme {
    display: none;
}

[data-theme="dark"] .light-theme {
    --icon-fill: white;
    fill: var(--icon-fill);
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border: 1px solid var(--background-light);
}

html[data-theme="dark"] body {
    background-color: var(--background);
    color: var(--gray-lightest);
    font-size: var(--font-size-base);
    line-height: 1.7;
}

html[data-theme="dark"] #bookPadding a:link {
    background-color: var(--background);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--link);
}

html[data-theme="dark"] #bookPadding a:hover {
    color: var(--link-hover);
    background-color: black;
}

html[data-theme="dark"] #bookPadding a:visited {
    color: var(--link-visited);
}

html[data-theme="dark"] section {
    color: var(--body-text);
}

html[data-theme="dark"] h1 {
    color: var(--gray-lightest);
}

html[data-theme="dark"] code {
    background: black;
    color: white;
    padding: 3px 5px;
}

html[data-theme="dark"] hr {
    background-color: #ececec;
}

html[data-theme="dark"] .slideout-panel {
    background-color: var(--background);
}

html[data-theme="dark"] #toc a:focus,
html[data-theme="dark"] #toc a:hover {
    background-color: var(--background);
    border-bottom-color: #fff;
    text-decoration: underline;
}

html[data-theme="dark"] #toc a:link,
html[data-theme="dark"] #toc a:active,
html[data-theme="dark"] #toc a:visited {
    color: var(--gray-lightest);
}

html[data-theme="dark"] #panel .codesandboxlink a:link,
html[data-theme="dark"] #panel .codesandboxlinkNotDynamic a:link {
    background-color: rgba(0, 0, 0, 0);
    border-bottom: 1px solid rgba(0, 0, 0, 0);
    color: #1a1a1a;
}

html[data-theme="dark"] #panel .codesandboxlink a:hover,
html[data-theme="dark"] #panel .codesandboxlinkNotDynamic a:hover {
    background-color: #bbeffd;
    border-bottom-color: rgba(0, 0, 0, 0);
}

html[data-theme="dark"] .FmCtaText a {
    color: #ccc;
}

html[data-theme="dark"] .FmCtaText a:hover {
    color: #fff;
}

html[data-theme="dark"] .FmCta {
    background: #000;
    color: #fff;
}

html[data-theme="dark"] .FmCtaLogo svg {
    fill: #c02d28;
}

html[data-theme="dark"] .FmCtaLogo:hover svg {
    fill: #dd625e;
}

html[data-theme="dark"] tbody tr:nth-child(odd) {
    background: black;
}

/*** LIGHT theme ***/

html[data-theme="light"] {
    --gray-lightest: #d0d0d0;
    --link: black;
    --link-hover: #d4312b;
    --link-visited: #A82723;
    --link-background: black;
    --background-color: white;
    --body-text: black;
}

[data-theme="light"] .light-theme {
    display: none;
}

[data-theme="light"] .dark-theme {
    --icon-fill: var(--link);
    fill: var(--icon-fill);
}

html[data-theme="light"] #menuButton {
    background: none;
}

html[data-theme="light"] th,
html[data-theme="light"] td {
    border: 1px solid var(--background-light);
}

html[data-theme="light"] body {
    background-color: var(--background-color);
    color: var(--body-text);
    font-size: var(--font-size-base);
    line-height: 1.7;
}

html[data-theme="light"] #bookPadding a:link {
    background-color: var(--background-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--link);
}

html[data-theme="light"] #bookPadding a:hover {
    color: var(--link-hover);
    background-color: var(--link-background);
}

html[data-theme="light"] #bookPadding a:visited {
    color: var(--link-visited);
}

html[data-theme="light"] section {
    color: var(--body-text);
}

html[data-theme="light"] h1 {
    color: var(--body-text);
}

html[data-theme="light"] code {
    background: black;
    color: white;
    padding: 3px 5px;
}

html[data-theme="light"] hr {
    background-color: #ececec;
}

html[data-theme="light"] .slideout-menu {
    background: var(--background-color);
}

html[data-theme="light"] .slideout-panel {
    background-color: var(--background-color);
}


html[data-theme="light"] #toc a:focus,
html[data-theme="light"] #toc a:hover {
    background-color: var(--background-color);
    border-bottom-color: #fff;
    text-decoration: underline;
}

html[data-theme="light"] #toc a:link,
html[data-theme="light"] #toc a:active,
html[data-theme="light"] #toc a:visited {
    color: var(--body-text);
}

html[data-theme="light"] #panel .codesandboxlink a:link,
html[data-theme="light"] #panel .codesandboxlinkNotDynamic a:link {
    background-color: rgba(0, 0, 0, 0);
    border-bottom: 1px solid rgba(0, 0, 0, 0);
    color: #1a1a1a;
}

html[data-theme="light"] #panel .codesandboxlink a:hover,
html[data-theme="light"] #panel .codesandboxlinkNotDynamic a:hover {
    background-color: #bbeffd;
    border-bottom-color: rgba(0, 0, 0, 0);
}

html[data-theme="light"] .FmCtaText a {
    color: #ccc;
}

html[data-theme="light"] .FmCtaText a:hover {
    color: #fff;
}

html[data-theme="light"] .FmCta {
    background: #000;
    color: #fff;
}

html[data-theme="light"] .FmCtaLogo svg {
    fill: #c02d28;
}

html[data-theme="light"] .FmCtaLogo:hover svg {
    fill: #dd625e;
}

html[data-theme="light"] tbody tr:nth-child(odd) {
    background: var(--gray-lightest);
}


/* Print styles */
@media print {
    body {
        padding: 12pt;
    }

    hr {
        margin: 20pt 0;
    }

    #menuButton {
        display: none;
    }

    .slideout-menu {
        overflow-y: hidden;
        position: static;
        width: auto;
    }

    .slideout-open .slideout-panel {
        margin: 0;
        transform: none !important;
    }

    #bookPadding {
        margin: 0;
        max-width: none;
        padding: 0;
        width: auto;
    }

    #bookPadding img {
        display: block;
        margin: 0 auto;
    }
}

@media only screen and (max-width: 700px) {
    
    th, td {
        padding: 6px;
        font-size: 12px;
    }
    thead {
        display: none;
    } 
    tbody, tr, td {
        display: block;
        width: 100%;
    }
    td {
        text-align: left;
        margin-bottom: 10px;
    }
}
