/* GLOBAL BODY & TEXT */
body {
    font-family: 'Lato', sans-serif;
    color: #1A3D7C; /* navy blue */
    line-height: 1.8;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fdfdfd;
}

/* HEADINGS */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: #1A3D7C;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    border-left: 6px solid #B3D9FF; /* baby blue accent */
    padding-left: 12px;
}

/* PARAGRAPHS */
p {
    margin-bottom: 1.8rem;
    font-size: 1.1rem;
}

/* FIGURES & IMAGES */
figure {
    display: block;
    margin: 1.5rem 0;
}

figure img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* FLOAT ALIGNMENTS */
figure.align-left {
    float: left;
    margin-right: 2rem;
    margin-bottom: 1.5rem;
    max-width: 50%;
}

figure.align-right {
    float: right;
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    max-width: 50%;
}

figure.align-center {
    float: none;
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 90%;
}

/* CLEAR FLOATS AFTER FIGURES */
figure + p {
    clear: both;
}

/* TIPS & FUN FACT */
.tips {
    background-color: #B3D9FF; /* baby blue */
    border-left: 5px solid #1A3D7C;
    padding: 0.8rem 1.2rem;
    margin-top: 0.3rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
}

.fun-fact {
    background-color: #FFF9C4; /* pale yellow */
    border-left: 5px solid #1A3D7C;
    padding: 0.8rem 1.2rem;
    margin-top: 0.3rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
}

/* WRAPPER */
.sidebar-wrapper {
    position: relative;
}

/* TOGGLE BUTTON */
#sidebar-toggle {
    display: none; /* hidden on desktop */
    background-color: #1A3D7C;
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

#sidebar-toggle:hover {
    background-color: #B3D9FF;
    color: #1A3D7C;
}

/* SIDEBAR */
.toc {
    position: sticky;
    top: 20px;
    max-width: 300px;
    background: linear-gradient(160deg, #B3D9FF, #E0F7FF);
    border: 2px solid #1A3D7C;
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toc.collapsed {
    transform: translateX(-320px);
    opacity: 0;
    pointer-events: none;
}

/* TOC CONTENT */
.toc h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1A3D7C;
    margin-bottom: 1rem;
    border-bottom: 2px solid #1A3D7C;
    padding-bottom: 0.5rem;
}

.toc ul {
    list-style: none;
    padding-left: 0;
}

.toc ul li {
    margin-bottom: 0.6rem;
    position: relative;
    padding-left: 12px;
}

.toc ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #1A3D7C;
    font-size: 1.2rem;
}

.toc ul li a {
    color: #1A3D7C;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.2s ease;
}

.toc ul li a:hover {
    color: #FFF9C4;
    transform: translateX(4px);
}

/* SUBLIST */
.toc ul li ul {
    padding-left: 1rem;
    margin-top: 0.3rem;
}

.toc ul li ul li::before {
    content: "–";
    font-size: 1rem;
    left: 0;
    color: #1A3D7C;
}

/* RESPONSIVE COLLAPSIBLE */
@media (max-width: 1024px) {
    #sidebar-toggle {
        display: block;
    }

    .toc {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-320px);
        z-index: 999;
        overflow-y: auto;
        padding-top: 3rem;
    }

    .toc.open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    figure.align-left, figure.align-right, figure.align-center {
        float: none !important;
        max-width: 95%;
        margin: 1.5rem auto;
    }
}
