html {
    font-size: 1.01rem;
}

body {
    background-color: white;
    max-width: 60rem;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
    cursor: default;
}

body.scroll-cursor {
    cursor: grab;
}

body.scroll-cursor:active {
    cursor: grabbing;
}

article {
    position: relative;
}

a {
    outline: none;
    text-decoration: none;
    text-decoration-color: transparent;
}

a:focus {
    outline: none;
    background-color: #e7a0b0;
    border-radius: 1px;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}

a:hover {
    text-decoration: underline;
    text-decoration-color: #e7a0b0;
}

a img {
    transition: transform 0.2s ease;
}

a:hover img {
    transform: scale(1.25);
}

table th a {
    font-weight: normal;
}

#table-of-contents + p:not([class]):not([id]),
header + p:not([class]):not([id]) {
    display: none;
}

pre {
    line-height: 1.4;
    padding: 1rem 1.4rem;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
}

#nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

#nav a {
    font-family: var(--latex-mono-font);
    margin: 0 0.25em;
    padding: 0.25em 0.5em;
    border: var(--border-width-thin) solid var(--body-color);
    text-decoration: none;
    text-transform: uppercase;
}

#dark-mode-toggle {
    font-family: var(--latex-mono-font);
    margin: 0 0.25em;
    padding: 0.25em 0.5em;
    border: var(--border-width-thin) solid var(--body-color);
    text-decoration: none;
    text-transform: uppercase;
    color: black;
}

.findme {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.findme table {
    width: 100%;
    border-collapse: collapse;
}

.findme th,
.find td {
    text-align: center;
    vertical-align: middle;
}

.findme td {
    height: 60px;
    position: relative;
}

.findme img {
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: var(--border-width-thin) solid var(--body-color);
    font-size: 0.85rem;
}

.copyright-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.pic figure {
    margin: 0;
    max-width: 100%;
    margin: 1rem auto;
}

.pic figure img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

.site_pic figure {
    margin: 0;
    max-width: 100%;
    margin: 1rem auto;
}

.site_pic figure img {
    width: 100%;
    object-fit: contain;
    display: block;
}

time {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

time:hover {
    background: #eaeaea;
    border-color: #d0d0d0;
    transition: all 0.2s ease;
}

.sidenote {
    font-weight: normal;
    font-size: 0.75rem;
    line-height: 1.4em;
    margin-right: -18vw;
    transition: background-color 0.2s ease;
}

.highlight-wrap {
    display: inline;
    transition: background-color 0.2s ease;
}

.sidenote::before {
    transition: background-color 0.2s ease;
}

.sidenote.highlight .highlight-wrap {
    background-color: #ffeb3b;
}

.sidenote.highlight::before {
    background-color: #ffeb3b;
}

.sidenote-number {
    color: var(--link-visited);
}

.sidenote-number ~ .sidenote::before {
    color: var(--link-visited);
}

.sidenote-number::after {
    content: counter(sidenote-counter) "↵";
    color: var(--link-visited);
}

.tags-cell {
    font-size: 11px;
}

.code-caption {
    text-align: left;
    font-size: 0.923em;
    padding: 0.25em 0.25em 0;
    width: 100%;
    margin-left: 0;
    margin-top: 0.5em;
    font-style: italic;
}

.code-caption .caption-text {
    font-weight: bold;
}

.rss-link {
    display: inline-block;
    vertical-align: text-bottom;
}
.rss-icon {
    width: 1.5em;
    height: 1.5em;
    background-image: url("assets/rss.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}
.rss-icon:hover {
    opacity: 1;
}

/* Pastes Index */

.paste-container {
    margin-bottom: 20px;
    padding: 10px;
    color: #333;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.paste-container p {
    margin: 0 0 10px;
}

.paste-container iframe {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.paste-container.active {
    border: 3px solid #e7a0b0;
}

/* Bookmarks */

#yt-playlist {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

#yt-playlist iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 90px;
}

.film-strip {
    width: 100%;
    height: 100%;
    background: url("assets/filmstrip-loader.png") repeat-x;
    animation: jitterFilmStrip 0.1s ease-in-out infinite;
}

@keyframes jitterFilmStrip {
    0% {
        transform: translateX(0); /* Start at original position */
    }
    25% {
        transform: translateX(-4px); /* Slight left shift */
    }
    50% {
        transform: translateX(4px); /* Slight right shift */
    }
    75% {
        transform: translateX(-2px); /* Small left shift */
    }
    100% {
        transform: translateX(2px); /* Small right shift */
    }
}

/* PDfs */

.dl-button-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
}

.download-button {
    display: inline-block;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.download-link {
    display: block;
    padding: 0.5rem 0.5rem;
    border: var(--border-width-thin) solid #e7a0b0;
    border-radius: 3px;
    text-align: left;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--link-visited);
    line-height: 1rem;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.download-button:hover .download-link {
    background-color: #e7a0b0;
    text-decoration: none;
}

#pdf-container {
    width: 100%;
    margin: 0 auto;
}

#pdf-container p {
    margin: 0;
    padding: 0;
    display: contents;
}

#pdf-container canvas {
    border: 1px solid #ddd; /* Thin border around each page (canvas) */
}

canvas {
    will-change: transform;
}

/* 404 page */

.page-404 body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.page-404 #preamble {
    position: relative;
    z-index: 2;
}

.page-404 #content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.page-404 .site_pic {
    flex: 1;
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.page-404 .site_pic figure {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.page-404 .site_pic figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.page-404 #postamble {
    position: relative;
    z-index: 2;
    margin-top: auto;
}

.page-404 footer {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.page-404 .copyright-container {
    justify-content: center;
}

.page-404 .copyright {
    color: rgb(168, 0, 0);
}

/* Dark mode styles */
body.latex-dark {
    background-color: #222;

    time {
        border-color: #404040;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    time:hover {
        background: #333333;
        border-color: #505050;
    }

    a:focus {
        background-color: yellow;
    }

    a:hover {
        text-decoration-color: yellow;
    }

    .download-button:hover .download-link {
        background-color: yellow;
    }

    .paste-container {
        color: #a0b3c5;
        background-color: #1d252c;
    }

    .paste-container iframe {
        border: none;
    }

    .sidenote.highlight .highlight-wrap,
    .sidenote.highlight::before {
        background-color: #454500;
    }
}

@media print {
    .img-scale {
        width: 20%;
        height: auto;
    }
}

@media screen {
    .img-scale {
        width: 30%;
        height: auto;
    }
}

@media (max-width: 768px) {
    #nav {
        flex-direction: column; /* Stack vertically for small screens */
    }
}

@media (max-width: 1200px) {
    label.sidenote-toggle:not(.sidenote-number) {
        display: inline;
    }
    .sidenote {
        display: none;
    }
    .sidenote-toggle:checked + .sidenote {
        display: block;
        margin: 0.5rem 1.25rem 1rem 0.5rem;
        float: left;
        left: 1rem;
        clear: both;
        width: 95%;
    }
    /* tweak indentation of sidenote inside a blockquote */
    blockquote .sidenote {
        margin-right: -25vw;
        width: 16vw;
    }
}
