
dl.citation > dt.label {
    width: 100%;
}

dl.citation span.brackets {
    padding-right: .8em;
}

a.copybtn {
    position: absolute;
    top: 12px;
    right: 24px;
    width: 1.2em;
    height: 1.2em;
    padding: 0 0 0 10px;
    opacity: .4;
    transition: opacity 0.5s;
    background-color: rgba(0, 0, 0, 0.02);
}

div.highlight  {
    position: relative;
}

.highlight:hover .copybtn {
	opacity: 1;
}

.o-tooltip--left {
    position: relative;
}

.o-tooltip--left:after {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    content: attr(data-tooltip);
    padding: 2px 10px;
    top: -2px;
    left: 0;
    background: #666;
    font-size: 1rem;
    color: white;
    white-space: nowrap;
    z-index: 2;
    border-radius: 2px;
    transform: translateX(-102%) translateY(0);
    transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
}

.o-tooltip--left:hover:after {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateX(-100%) translateY(0);
    transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
}

pre.output {
  max-height: 400px;
  overflow-y: scroll;
}
div[class^="output"] {
    margin-bottom: 1em;
}

div.mdl-tabs__tab-bar { justify-content: left; }

.mdl-tabs .mdl-tabs__tab {
    font-size: 13px;
    height: 32px;
    line-height: 32px;
    border-radius: 4px 4px 0 0;
    letter-spacing: .5px;
}

.mdl-tabs .mdl-tabs__tab-bar {
    height: 32px;
}

.mdl-tabs .mdl-tabs__tab-bar.text {
    margin-bottom: .5em;
}

.mdl-tabs .mdl-tabs__tab-bar.code {
    margin-bottom: -1em;
}

.mdl-tabs__tab.is-active {
    background: rgb(0,0,0,.09);
}
/* Google Fonts (Noto Sans JP) is loaded asynchronously via the HTML <link> tag
   injected by optimize_pagespeed.py to avoid render-blocking @import. */

/* Override font-family to use Noto Sans JP (Japanese) before Noto Sans SC Sliced (Chinese).
   The mxtheme bundles Noto Sans SC Sliced which claims Japanese Unicode ranges via unicode-range
   but fails to render characters like な (U+306A), ー (U+30FC), ッ (U+30C3), etc. */
body {
    font-family: Roboto, 'Noto Sans JP', 'Noto Sans SC Sliced', sans-serif !important;
    font-size: 17px !important;
}
h1, h2, h3, h4, h5, h6,
a.download > code.download,
blockquote,
span.mdl-layout-title,
.mdl-layout__drawer > .mdl-layout-title .title-text,
.page-content pre:hover:before {
    font-family: Roboto, 'Noto Sans JP', 'Noto Sans SC Sliced', sans-serif !important;
}

.globaltoc ul:first-of-type li.toctree-l1 .link-wrapper>a {
    padding-left: 18px;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

html {
    background-color: #fafafa;
}

/* ==========================================================================
   Sidebar Drawer — Logo & Title (match d2l.ai)
   ========================================================================== */

/* Symmetric vertical padding around the logo, vertically centered */
.mdl-layout__drawer > .mdl-layout-title {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px 4px !important;
    min-height: 140px !important;
    box-sizing: border-box;
}

.mdl-layout__drawer > .mdl-layout-title .title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mdl-layout__drawer > .mdl-layout-title .title > img.logo {
    width: auto !important;
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
    margin: 0 auto;
}

/* ==========================================================================
   Minimal Responsive Fixes (conservative — preserve d2l.ai look)
   Only fix actual overflow/usability issues, don't change desktop look.
   ========================================================================== */

/* --- Math/MathJax overflow fix (mobile) --- */
.MathJax_Display,
.MathJax,
.page-content .math,
.page-content mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* --- Tables: ensure horizontal scroll on small screens --- */
.page-content .section {
    overflow-x: auto;
}

/* --- Mobile-only fixes (≤768px) --- */
@media (max-width: 768px) {
    /* Slightly smaller code font on mobile for readability */
    .page-content .highlight pre,
    .page-content pre {
        font-size: 85% !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* Tighter padding for more content space */
    .document .page-content {
        padding: 0 3% !important;
    }

    /* Compact pagination */
    .pagenation {
        height: auto !important;
        min-height: 60px;
    }

    .pagenation-text {
        font-size: 14px !important;
    }
}

/* --- Mobile Floating ToC Button --- */
.mobile-toc-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #1565c0;
    color: #fff;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    font-size: 22px;
    cursor: pointer;
    z-index: 999;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    line-height: 1;
}

.mobile-toc-btn:hover {
    background-color: #0d47a1;
    transform: scale(1.1);
}

.mobile-toc-btn:active {
    transform: scale(0.95);
}

@media (max-width: 1199px) {
    .mobile-toc-btn {
        display: flex;
    }
}

/* --- Print styles --- */
@media print {
    .mdl-layout__header,
    .mdl-layout__drawer,
    .side-doc-outline,
    .pagenation,
    .mobile-toc-btn,
    .giscus-container {
        display: none !important;
    }

    .document .page-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* ==========================================================================
   Bibliography (References Page) — match d2l.ai professional style
   ========================================================================== */

/* Each bibliography entry */
.page-content .citation {
    margin-bottom: 1.2em;
    padding-left: 2em;
    text-indent: -2em;
    line-height: 1.6;
}

/* Citation label (e.g. [Zhang et al., 2023]) — bold and block */
.page-content .citation > .label,
.page-content .citation > span:first-child {
    font-weight: 700;
    display: block;
    text-indent: 0;
    margin-bottom: 0.2em;
}

/* Paragraph within citation */
.page-content .citation p {
    margin: 0;
    text-indent: 0;
}
