@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* ROOT ELEMENTS */
html {
    scroll-padding-top: clamp(2.667rem, 13vw, 3.556rem);
    font-size: 18px;
}

body {
    font-family: 'Source Sans 3';
    margin: 0 clamp(3%, 2vw, 5%);
    background-color: var(--body-bg-color);
    color: var(--body-text-color);
}

/* LAYOUT */
#page {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 5%;
}

#navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: clamp(2.667rem, 13vw, 3.556rem);
    background-color: var(--body-bg-color);
    width: 100%;
    z-index: 1;
}

#navbar div {
    font-size: clamp(1.125rem, 5.1vw, 1.5rem);
    font-weight: 700;
}

.sticky {
    position: fixed;
    max-width: min(clamp(94%, 2vw, 96%), 720px);
    top: 0;
}

#content {
    z-index: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#content p {
    line-height: 133%;
    margin-top: 0.75rem;
}

/* HEADER */
header {
    height: clamp(3.333rem, 16vw, 5.556rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--body-bg-color);
    z-index: 1;
}

header img {
    width: clamp(3.333rem, 16vw, 5.556rem);
}

header .text {
    font-size: clamp(1.667rem, 8.5vw, 3.333rem);
    font-weight: 900;
}

header .mediumtext {
    font-size: clamp(1.111rem, 5.6vw, 2.222rem);
    font-weight: 900;
}

/* HAMBURGER MENU - Keep original simple approach */
#hamburger {
    position: fixed;
    display: none;
    top: 0;
    z-index: 1;
    height: 100%;
    width: 100%;
    background-color: var(--body-bg-color);
}

#hamburger h1 {
    margin: 1.25rem 0 0 0;
}


/* TYPOGRAPHY */
h1 {
    font-weight: 900;
    font-size: clamp(1.167rem, 5.5vw, 1.778rem);
    margin: 40px 0;
}

h2 {
    font-weight: 700;
    font-size: clamp(1.056rem, 5.5vw, 1.556rem);
    margin: 30px 0;
}

h3 {
    font-weight: 600;
    font-size: clamp(0.944rem, 5.5vw, 1.333rem);
    margin: 20px 0;
}

p {
    font-size: 1.0625rem;
    display: block;
}

meta-post {
    font-size: 1.0625rem;
    display: block;
    margin-top: 0.8rem;
}

strong {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1rem, 4.3vw, 1.167rem);
}

/* TITLE CONTAINER */
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-container h1 {
    margin: 0;
}

.title-container a {
    text-decoration: none;
    height: 1rem;
    width: auto;
}

/* LINKS */
a {
    color: var(--link-color);
    font-weight: 600;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

strong a {
    font-weight: 700;
}

a.uncolored {
    font-weight: inherit;
    color: inherit;
    text-decoration: none;
}

a.preview {
    color: inherit;
    text-decoration: none;
    margin-left: 0.5rem;
    font-weight: 900;
}

a.cur_active {
    font-weight: inherit;
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 3px;
}

/* UTILITY CLASSES */
.text-colored {
    color: var(--body-text-color);
}

.highlight {
    text-decoration: underline;
    text-underline-offset: 2pt;
    text-decoration-thickness: 1.5pt;
}

.shadowed {
    margin: 0 0 1rem 0;
    padding: 0.8rem;
    background: var(--shadow-bg-color);
    box-shadow: 0 0.25rem 0.5rem 0 rgba(0, 0, 0, 0.2), 0 0.4rem 1.1rem 0 rgba(0, 0, 0, 0.19);
}

/* FIGURES AND IMAGES */
figure {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 2px solid;
    border-bottom: 2px solid;
    padding: 1rem 0;
    margin: 0.6rem 0 1.2rem 0;
    overflow: hidden;
}

figure img, figure svg {
    max-width: 95%;
    height: auto;
    display: block;
    margin: 0 auto;
}

figcaption {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--body-text-color);
    opacity: 0.8;
}

/* For particularly large images */
figure img.large {
    max-height: 70vh;
    object-fit: contain;
}

/* TABLES */
table {
    width: 100%;
    margin: 2rem 0 3rem 0;
}

th {
    font-weight: 500;
}

/* GALLERY */
.row {
    display: flex;
    flex-wrap: wrap;
    padding: 0 4px;
}

.column {
    flex: 32%;
    max-width: 33%;
    padding: 0 4px;
}

.column img {
    margin-top: 8px;
    vertical-align: middle;
    width: 100%;
}

/* VIDEO */
iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video_wrapper {
    position: relative;
    padding-bottom: 66.66%;
    margin-bottom: 20px;
}

.video_wrapperHD {
    position: relative;
    padding-bottom: 56.25%;
    margin-bottom: 20px;
}

.video_border {
    box-shadow: 0 0.25rem 0.5rem 0 rgba(0, 0, 0, 0.2), 0 0.4rem 1.1rem 0 rgba(0, 0, 0, 0.19);
    margin: 2rem auto;
    width: 87%;
}

.animation {
    overflow: hidden;
    box-shadow: 0 0.25rem 0.5rem -0.1rem rgba(0, 0, 0, 0.2), 0 0.4rem 1.1rem -0.2rem rgba(0, 0, 0, 0.19);
    margin-bottom: 1rem;
    max-width: 95%;
}

.animation video {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: bottom;
}

/* MATHEMATICAL CONTENT */
.math {
    overflow-x: auto;
    overflow-y: hidden;
    display: block;
}

.MathJax {
    font-size: 1em !important;
}

sup {
    color: var(--highlight-color);
}

/* CONTENT BLOCKS */
.thm, .mcq, .lem, .exmp, .defn, .prop, .cor, .proof, .rmk, .exer, .axiom {
    margin: 1.5rem 0;
    padding: 0.6rem 1.1rem 0.8rem 1.1rem;
    border-radius: 0.3rem;
    background: var(--thm-bg-color);
}

.thm p, .lem p, .exmp p, .defn p, .exer p, .cor p, .rmk p, .prop p, .proof p, .axiom p {
    margin: 0;
    padding: 0;
}

.mcq {
    background: var(--mcq-bg-color);
}

.mcq ul {
    list-style: none;
    margin-left: 0.5rem;
    padding: 0;
}

.rmk {
    background: var(--rmk-bg-color);
}

.exmp {
    background: var(--exmp-bg-color);
}

.defn {
    background: var(--defn-bg-color);
}

.proof {
    background: var(--proof-bg-color);
}

.exer {
    background: var(--exer-bg-color);
}

.axiom {
    background: var(--axiom-bg-color);
}

/* EXERCISE NUMBERING */
.exer ol {
    counter-reset: list;
}

.exer ol > li {
    list-style: none;
}

.exer ol li p {
    display: inline;
}

.exer ol > li:before {
    content: "(" counter(list, lower-alpha) ") ";
    counter-increment: list;
}

/* TRUE/FALSE */
.true, .false {
    margin-left: 0.5rem;
    padding: 0.1rem;
}

/* CAMERA ICON */
.camera {
    float: right;
    margin: 0;
    padding: 0.333rem clamp(0.417rem, 2vw, 1.111rem) clamp(0.417rem, 2vw, 1.111rem) clamp(0.417rem, 2vw, 1.111rem);
    height: clamp(1.333rem, 7vw, 2rem);
    width: clamp(1.333rem, 7vw, 2rem);
}

/* LINK LISTS */
.linklist h3 {
    font-weight: 700;
    margin: 1.25rem 0 0.25rem 0;
}

.linklist h4 {
    font-size: 1.111rem;
    font-weight: 400;
    margin: 0 0 0.25rem 0;
}

.linklist em {
    font-weight: 600;
}

/* MODULE LISTS */
.modulelist h1 {
    margin: 2rem 0 0 0;
}

.modulelist h2 {
    margin: 1.6rem 0 0 0;
}

.modulelist h3 {
    font-weight: 700;
    margin: 1.2rem 0 1rem 0;
}

.modulelist a {
    font-weight: 600;
    margin: 0.8rem 0 0 0;
}

/* INTERACTIVE ELEMENTS */
.accordion {
    border: none;
    cursor: pointer;
    outline: none;
    transition: 0.4s;
}

div.panel {
    display: none;
    margin-top: 30px;
}

div.panel.show {
    display: block;
}

.soltitle {
    cursor: pointer;
    transition: 0.4s;
}

div.sol {
    display: none;
}

div.sol.show {
    display: block;
}

.solex {
    border-top: 2px solid;
    padding: 0;
    margin: 0 0 20px 0;
}

/* POPUPS */
span.preview {
    display: initial;
    cursor: pointer;
    color: var(--link-color);
    font-weight: 700;
}

div.popup {
    display: none;
    margin-left: clamp(3%, 2vw, 5%);
}

div.popup.show {
    display: block;
    background: var(--popup-bg-color);
    border-radius: 6px;
    transition: 0.4s;
    position: absolute;
    width: 100%;
    max-width: min(clamp(80vw, 2vw, 84vw), 645px);
    z-index: 1;
    padding: 0.6rem 1.1rem 0.8rem 1.1rem;
    box-shadow: 0 0.25rem 0.5rem 0 rgba(0, 0, 0, 0.2), 0 0.4rem 1.1rem 0 rgba(0, 0, 0, 0.19);
}

/* MATH PREVIEW */
.math-preview-popup {
    min-width: 250px;
    width: 100%;
    max-width: clamp(16.667rem, 84vw, 36.667rem);
    background-color: var(--popup-bg-color);
    color: var(--body-text-color);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 0.25rem 0.5rem 0 rgba(0, 0, 0, 0.2), 0 0.4rem 1.1rem 0 rgba(0, 0, 0, 0.19);
    font-size: clamp(0.778rem, 3.5vw, 0.889rem);
    line-height: 1.33;
    transition: opacity 0.2s ease-in-out;
}

.math-preview-content {
    max-height: 410px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 5px;
}

.math-preview-nav-inline {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--link-color);
    cursor: pointer;
    padding: 0;
    margin-left: 0.4rem;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    transition: background-color 0.2s ease;
    vertical-align: top;
    line-height: 1;
}

.math-preview-nav-inline:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.math-preview-popup.loading .math-preview-content {
    min-height: 60px;
}

.math-preview-popup .MathJax {
    font-size: 1em !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .math-preview-popup {
        max-width: 90vw;
        font-size: 0.778rem;
    }
    
    .math-preview-content {
        max-height: 300px;
    }
}