/* Import an exquisite serif font */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap');

html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Disable native scrollbars */
    width: 100vw;
    height: 100vh;
    font-family: 'Merriweather', serif;
}

:root {
    --p-font-size: 1rem;
    --content-width: 61vw;
    --nav-button-width: 6.5vw;
}


p,
.math,
ul {
    text-align: justify;
    box-sizing: border-box;
}

.panel-caption,
caption,
.figure-caption {
    font-size: calc(0.85 * var(--p-font-size));
    text-align: center;
}


/* Avoid unwanted column breaks on headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-left: 3px;
    break-inside: avoid-column;
    break-after: avoid;
    page-break-after: avoid;
    font-weight: 600;
}

/* Also prevent a break between a heading and the paragraph immediately after it */
h1+p,
h2+p,
h3+p,
h4+p,
h5+p,
h6+p {
    break-inside: avoid-column;
}

/* Scale headers relative to the base paragraph font size */
h1 {
    font-size: calc(2 * var(--p-font-size));
    margin-top: calc(2.1 * var(--p-font-size));
    margin-bottom: calc(0.5 * 2 * var(--p-font-size));
}

h2 {
    font-size: calc(1.5 * var(--p-font-size));
    margin-top: calc(1.8 * var(--p-font-size));
    margin-bottom: calc(0.5 * 1.5 * var(--p-font-size));
}

h3 {
    font-size: calc(1.2 * var(--p-font-size));
    margin-top: calc(1.35 * var(--p-font-size));
    margin-bottom: calc(0.5 * 1.2 * var(--p-font-size));
}

h4,
h5,
h6 {
    font-size: calc(1.0 * var(--p-font-size));
    margin-top: calc(1.15 * var(--p-font-size));
    margin-bottom: calc(0.5 * 1.0 * var(--p-font-size));
}


p:has(+ ul) {
    margin-bottom: calc(0.5 * var(--p-font-size));
}

li p {
    margin-bottom: calc(0.5 * var(--p-font-size));
}

p,
.table,
.math,
ul {
    font-size: var(--p-font-size);
    margin-right: 3px;
    margin-left: 3px;
    margin-bottom: calc(0.8 * var(--p-font-size));
}

p+p {
    margin-bottom: calc(0.8 * var(--p-font-size));
}

.quarto-figure {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    max-width: 60%;
    max-height: 30%;
}


.figure-img {
    margin-bottom: 0;
    margin-top: 0;
}

.sourceCode {
    width: 95%;
    overflow: hidden;
}

table,
.table {
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
    display: block;
    width: 95%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    text-align: left;
}

th {
    border-top: 1px solid #9ba5ae;
    border-bottom: 1px solid #9ba5ae;
    text-align: left;
}

p .math.display {
    margin-top: -0.25rem;
    margin-bottom: -0.25rem;
}

p:has(.math.display) {
    margin-bottom: 0rem;
}

p:has(+ p .math.display) {
    margin-bottom: -0.25rem;
}

p+p .math.display {
    margin-bottom: inherit;
}

.math.display {
    display: block;
    margin-left: auto;
    max-width: 95%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* optional, for smoother scrolling on mobile */
}

.math.display mjx-table {
    vertical-align: 0;
}

.math.inline {
    margin: 0;
}

/* Default: Portrait Mode */
/* Content occupies 80% of viewport width with 15vh padding top and bottom */
#content {
    top: var(--header-height);
    position: relative;
    width: var(--content-width);
    column-width: 80vw;
    height: 100vh;
    margin: 0 auto;
    padding-top: 0vh;
    padding-bottom: 8vh;
    overflow: hidden;
    /* Use CSS columns to flow content into pages */
    column-gap: 0.0px;
    column-fill: auto;
}


/* Navigation buttons styling */
#prevButton,
#nextButton,
#pageNumber {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-family: 'Arial', 'Helvetica', sans-serif;
    font-size: 2.5em;
    /* Increase arrow size */
    height: 1.5em;
    /* Same fixed height for both */
    width: 1.5em;
    /* Same fixed width for both */
    padding: 0px 12.5px;
    /* Increase clickable area */
    display: inline-flex;
    /* Or 'flex' if you prefer a block-level container */
    align-items: center;
    /* Vertically center contents */
    justify-content: center;
    /* Horizontally center contents */
    cursor: pointer;
    z-index: 1000;
}


/* Place navigation buttons relative to the content container's edge */
#prevButton {
    left: calc(((100vw - var(--content-width) - 1vw) / 2 - var(--nav-button-width)) / 1.5);
}

#nextButton {
    right: calc(((100vw - var(--content-width) - 1vw) / 2 - var(--nav-button-width)) / 1.5);
}


#pageNumber {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: rgba(0, 0, 0, 0.0);
    color: rgba(0, 0, 0, 0.7);
    font-size: calc(1.5 * var(--p-font-size));
    line-height: 6vh;
    position: fixed;
    bottom: 0;
    top: auto;
    height: 6vh;
    width: 100%;
    text-align: center;
    vertical-align: middle;
    line-height: normal;
    cursor: auto;
}

/* Landscape mode */
/* Content occupies 60% of viewport width (with same 15vh vertical padding) and is centered */
@media (orientation: landscape) {
    :root {
        --content-width: 65vw;
    }

    #content {
        width: var(--content-width);
        column-width: calc(var(--content-width) - 1vw);
        padding-top: 0vh;
        padding-bottom: 20vh;
        margin-left: auto;
        margin-right: auto;
        column-gap: 0px;
    }
}


@media (orientation: portrait) {
    :root {
        --content-width: 81vw;
    }

    #quarto-margin-sidebar {
        display: none;
    }

    #content {
        width: calc(var(--content-width));
        column-width: calc(var(--content-width) - 1vw);
        padding-bottom: 18vh;
        column-gap: 0.0px;
        /* No gap between columns */
        overscroll-behavior: none;
        /* Prevent rubber-banding on modern browsers */
        -webkit-overflow-scrolling: auto;
        /* Disable iOS inertia scrolling */
    }

    .quarto-figure {
        max-width: 70%;
    }

    #prevButton,
    #nextButton {
        /* bottom: 0;
        top: 97vh; */
        height: calc(var(--nav-button-width));
        width: calc(var(--nav-button-width));
    }
}

/* Hide navigation buttons only if in portrait AND pointer is coarse (touch). */
@media (orientation: portrait) and (pointer: coarse) {
    #quarto-margin-sidebar {
        display: none;
    }

    :root {
        --p-font-size: 0.8rem;
        --content-width: 86vw;
    }

    #content {
        width: calc(var(--content-width));
        column-width: calc(var(--content-width) - 1vw);
        padding-top: 0vh;
        padding-bottom: 20vh;
        column-gap: 0.0px;
    }

    .quarto-figure {
        max-width: 90%;
    }

    #prevButton,
    #nextButton {
        display: flex;
        /* Ensure they're displayed */
        position: fixed;
        /* Position near the bottom */
        /* bottom: 0;
        top: 97vh; */
        /* Remove any top positioning */
        width: calc(var(--nav-button-width));
        height: calc(var(--nav-button-width));
        align-items: center;
        /* Vertically center the arrow */
        justify-content: center;
        /* Horizontally center the arrow */
        font-size: 2em;
        background: rgba(0, 0, 0, 0.5);
        color: #fff;
        border: none;
        cursor: pointer;
        box-sizing: border-box;
    }

    #pageNumber {
        font-size: calc(1.75 * var(--p-font-size));
    }
}


.notes {
    width: 95%;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 1rem;
    margin: 1rem auto;
}

.notes p {
    margin-bottom: 1rem;
    margin-top: 1rem;
}



/* -------------------------------------------------------------
   1. Root & Global Styles
------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
    /* Brand / accent color */
    --brand-color: #4f46e5;
    /* A rich, modern purple */
    --background-color: #ffffff;
    /* Main background */
    --text-color: #1f1f1f;
    /* Primary text color */
    --secondary-text-color: #555;

    /* Sizing & spacing */
    --header-height: 60px;
    --content-width: 80vw;

    /* Typography */
    --base-font: 'Inter', system-ui, sans-serif;
    /* --base-font-size: 16px; */
    --heading-font-weight: 600;

    /* Subtle shadows, corners, transitions */
    --box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* Base reset & box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    /* width: 100%;
  height: 100%; */
    overflow: hidden;
    /* As you already have horizontal "pages" */
    font-family: var(--base-font);
    /* font-size: var(--base-font-size); */
    color: var(--text-color);
    background: var(--background-color);
}

/* -------------------------------------------------------------
   2. Header / Navbar
------------------------------------------------------------- */
header .navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--brand-color);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    transition: background var(--transition-speed);
}

header .navbar .navbar-title {
    font-size: 1.2rem;
    font-weight: 600;
}

header .navbar a.navbar-link {
    color: #fff;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: opacity var(--transition-speed);
}

header .navbar a.navbar-link:hover {
    opacity: 0.8;
}

/* -------------------------------------------------------------
   3. Main Content Container
------------------------------------------------------------- */
/* 
   If you have a horizontally scrollable #content, 
   ensure the top is padded below the header.
*/
/* #content {
  position: relative;
  top: var(--header-height);
  display: flex;
  height: calc(100vh - var(--header-height));
  /* 
     If you're using columns or flex pages, 
     you can keep your existing styles here. 
     Just ensure the user sees some padding/space. 
  */
/* } */
*/

/* Example "page" styling if you are using .page elements */
.page {
    flex: 0 0 100vw;
    height: 100%;
    padding: 3rem 5vw;
    overflow-y: auto;
    /* Let each page scroll if needed */
    scroll-snap-align: start;
    background: var(--background-color);
    transition: background var(--transition-speed);
}

/* -------------------------------------------------------------
   4. Typography
------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--heading-font-weight);
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

p,
ul {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--secondary-text-color);
    text-align: justify;
}

strong,
b {
    color: var(--text-color);
    font-weight: 600;
}

/* Links */
a {
    color: var(--brand-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: #3f3ac9;
    /* Slightly darker shade of brand color */
}

/* -------------------------------------------------------------
   5. Code Blocks & Tables
------------------------------------------------------------- */
pre,
code {
    font-family: 'Source Code Pro', monospace;
    background: #f5f5f5;
    color: #333;
}

pre {
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
}

/* Center tables, add subtle styling */
.table-container {
    text-align: center;
}

.table-container table {
    margin: 1rem auto;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table-container th,
.table-container td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ddd;
}

.table-container th {
    background: #f0f0f0;
    font-weight: 600;
}

/* -------------------------------------------------------------
   6. Navigation Buttons (Prev / Next) 
------------------------------------------------------------- */
.nav-button {
    position: fixed;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: var(--brand-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: var(--box-shadow);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    transition: opacity var(--transition-speed), background var(--transition-speed);
    touch-action: manipulation;
}

.nav-button:hover {
    background: #3f3ac9;
}

/* Hide or show in portrait, etc. as you wish with media queries. */

/* -------------------------------------------------------------
   7. Page Number
------------------------------------------------------------- */
#pageNumber {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.3rem 0.6rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: var(--box-shadow);
    transition: background var(--transition-speed);
    z-index: 1000;
}

/* -------------------------------------------------------------
   8. Subtle Fade-in Animation on Page Load
------------------------------------------------------------- */
.fade-in {
    opacity: 0;
    animation: fadeIn var(--transition-speed) ease-in forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.next-link {
    display: block;
    text-align: center;
    font-weight: bold;
    padding: 1rem;
    margin-top: 2rem;
}