body {
    box-sizing: border-box;
    overflow-x: clip;
    overflow-clip-margin: 8px;
    -webkit-text-size-adjust: 100%;
    background-color: whitesmoke; /* #f5f7ff; */
    color: black;
    font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.33;
    margin: 0;
    padding: 0;
}

header {
    background-color: #f5f7ff;
    border: 0.05rem solid lightgrey;
    padding: 0.3125rem 1.25rem;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.5s;
}

header:hover {
    background-color: #e4e8ff; /* #adb9fd; */
    /*  border: 0.05rem solid lightgrey;  */
}

header h1 {
    font-size: 1.3em;
    margin: 0;
    padding: 0;
}

h2 {
    font-size: 1.4em;
    text-align: center;
}

h3 {
    font-size: 1.2em;
}

h4 {
    font-size: 1em;
}

.inline {
    background-color: #f5f5f5;
    color: #383A42;
    padding: 2px 4px;
    border-radius: 3px;
}

.styled-quote {
    font-style: italic;
    text-align: center;
    color: black;
}

.quote-description {
    text-align: center;
    color: black;
}

.container {
    max-width: 62.5rem;
    margin: 3.125rem auto 1rem;
    padding: 1.25rem;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.card {
    flex: 0 0 46%;
    display: block;
    background-color: white; /* #e4e8ff; */
    color: black;
    margin: 0.625rem 0;
    padding: 0.5rem 1rem 0.5rem 1rem;
    text-decoration: none;
    transition: all 0.3s;
    border: 0.05rem solid lightgrey;
    border-radius: 0.625rem;
    /* Initial shadow in rem */
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: scale(1.03);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.2);
}

.card h2 {
    font-size: 1.2em;
    color: black;
}

.chapter-card {
    width: 80%;
    display: block;
    text-align: justify;
    background-color: white;
    border: 0.05rem solid lightgrey;
    border-radius: 0.625rem;
    padding: 2rem 5rem 2rem 5rem;
    margin: 1.5rem auto 1.5rem;
}

pre, .hljs {
    border: none !important;
    border-radius: 0.5rem;
}

.center {
    text-align: center;
}

.run-button, .toggle-button {
    display: inline-block;
    padding: 0.42rem 1rem;
    margin-bottom: 1rem;
    background-color: whitesmoke; /* #e4e8ff; */
    color: black;
    border: 0.05rem solid lightgrey;
    border-radius: 0.42rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.run-button:hover {
    background-color: #e4e8ff; /* #2a2d31; */
    border: 0.05rem solid grey;
}

.back-button {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.625rem 1.25rem;
    background-color: whitesmoke; /* #e4e8ff; */
    color: black;
    border: 0.05rem solid lightgrey;
    border-radius: 0.625rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: #e4e8ff; /* #2a2d31; */
    border: 0.05rem solid grey;
}

.tabs {
    display: flex;
    margin-bottom: 1rem;
}

/* Responsive adjustments for mobile devices (UPDATED) */
@media (max-aspect-ratio: 1/1.4) {
    .body {
        box-sizing: border-box;
        overflow-x: clip;
        -webkit-text-size-adjust: 100%;
    }

    .card {
        flex: 1 1 100%; /* Force cards to be full width on smaller screens */
        margin: 0.625rem 0; /* Adjust margin */
    }

    .chapter-card {
        flex: 1 1 80%; /* Force to be full width on smaller screens */
    }

    body {
        font-size: 1rem; /* Larger font size for better readability */
    }

    header h1 {
        font-size: 1.5em; /* Larger header font size on small screens */
    }
}

/* EXTRA media query to ensure container and chapter-card match screen width on small devices */
@media (max-width: 600px) {
    .container {
        max-width: 100% !important;
        margin: 1rem auto;
        padding: 1rem;
    }

    .chapter-card {
        width: 100% !important;
        margin: 1rem auto;
        padding: 1rem;
    }
}

.prompt {
    display: block;
    overflow-x: auto;
    font-size: 0.9rem;
    border-radius: 0.42rem;
    padding: 0.7em;
    background: #2E3440;
    color: #D8DEE9;
    font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    margin: 1em 0;
}


/* Python/CPP Tabs */

.tablink {
    flex: 1;
    padding: 0.5em;
    cursor: pointer;
    background-color: #f5f7ff;
    border: none;
    text-align: center;
    transition: background-color 0.3s;
    border-radius: 0.625rem 0.625rem 0 0;
}

.tablink:hover {
    background-color: #e4e8ff;
}

.tablink.active {
    background-color: white;
}

/* Custom Light Monokai theme for Highlight.js - Python */

.hljs {
    display: block;
    overflow-x: auto;
    font-size: 0.9rem;
    padding: 0.5em;
    background: #F8F8F8;
    color: #383A42;
}

/* Keywords, built-ins */
.hljs-keyword,
.hljs-built_in {
    color: #A626A4;
}

/* Strings */
.hljs-string {
    color: seagreen; /* #50A14F */
}

/* Functions and classes */
.hljs-function,
.hljs-class .hljs-title {
    color: #4078F2;
}

/* Numbers */
.hljs-number {
    color: darkgoldenrod; /* #C18401 */
}

/* Comments */
.hljs-comment {
    color: slategrey; /* #A0A1A7 */
}

/* Decorators */
.hljs-meta {
    color: #A626A4;
}

/* Highlighted background (for search results etc.) */
.hljs-highlight {
    background-color: #FFCC00;
    color: #383A42;
}

/* If you're also highlighting built-in modules or exceptions */
.hljs-built_in,
.hljs-literal {
    color: #D73A49;
}

.code-container {
}

.code-output {
    display: block;
    overflow-x: auto;
    font-size: 0.9rem;
    border-radius: 0.42rem;
    padding: 0.5em;
    background: #F8F8F8;
    color: #383A42;
}

.hidden {
    display: none;
}

.toggle-button:hover {
    background-color: #e4e8ff; /* #2a2d31; */
    border: 0.05rem solid grey;
}

.footer {
    text-align: center;
    padding: 1rem 0;
    color: #333;
    font-size: 14px;
}

.footer a {
    color: #333;
    text-decoration: none;
}


/* The main nav bar */
.nav-container {
    display: flex;
    justify-content: space-between; /* left, center, right */
    align-items: center;
    margin-top: 2rem;
}

/* Each "slot" is just a flex item.
   We can center, left-align, or right-align within each slot. */
.nav-slot {
    flex: 1; /* so each slot can expand */
    text-align: center; /* default to center, or override below */
}

/* You can left-align the left slot if you prefer */
.nav-left {
    text-align: left;
}

.nav-middle {
    text-align: center;
}

.nav-right {
    text-align: right;
}

/* Existing button styling: tweak as desired */
.nav-button {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background-color: whitesmoke;
    color: black;
    border: 0.05rem solid lightgrey;
    border-radius: 0.625rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    margin: 0 0.5rem;
}

.nav-button:hover {
    background-color: #e4e8ff;
    border: 0.05rem solid grey;
}
