﻿.layout-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}



.toc-sidebar {
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 30px 15px;
    border-radius: 4px;
    height: fit-content;
    position: sticky;
    top: 80px;
}



    .toc-sidebar h3 {
        margin-top: 0;
        font-size: 1.2rem;
        color: #2c3e50;
        border-bottom: 2px solid #3498db;
        padding-bottom: 5px;
        margin-bottom: 15px;
    }

.toc-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

    .toc-list li {
        margin-bottom: 12px;
    } 

    .toc-list details > summary {
        list-style: none;
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    .toc-list details > summary::marker { display: none; }

    .toc-list details > summary::before {
        content: "▶";
        display: inline-block;
        font-size: 0.7rem;
        margin-right: 8px;
        color: #3498db;
        transition: transform 0.2s ease;
    }

    .toc-list details[open] > summary::before {
        transform: rotate(90deg);
    }

.toc-sidebar a {
    text-decoration: none;
    font-size: 1.05rem;
    color: steelblue;
    transition: color 0.2s ease;
}



    .toc-sidebar a:hover {
        color: #2980b9;
        text-decoration: underline;
    }



.sub-toc {
    list-style-type: none !important;
    padding-left: 18px !important;
    margin: 6px 0 0 0 !important;
}



    .sub-toc li {
        margin-bottom: 6px;
    }



    .sub-toc a {
        font-size: 0.95rem;
        color: #555;
    }



        .sub-toc a:hover {
            color: #3498db;
        }

.content-section {
    padding: 20px;
    border-radius: 6px;
    border: 2px solid transparent;
    scroll-margin-top: 80px;
}



    .content-section:target {
        animation: smoothHighlightFade 4s ease-in-out forwards;
    }



@media screen and (max-width: 768px) {

    .layout-container {
        grid-template-columns: 1fr;
    }



    .toc-sidebar {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        position: static;
    }
}



.avila-3d-stage {
    width: 100%;
    max-width: 1400px;
    height: 340px;
    margin: 40px auto;
    perspective: 1400px;
    overflow: hidden;
    position: relative;
    transform: translateZ(0);
}



.avila-3d-track {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
}



.avila-card {
    position: absolute;
    width: 70%;
    height: 100%;
    left: 15%;
    top: 0;
    background: transparent;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.35);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}



    .avila-card img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 40px;
        background: transparent;
        image-rendering: pixelated;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-font-smoothing: antialiased;
    }



    .avila-card.center {
        transform: translate3d(0, 0, 0) rotateY(0deg) scale(1.0);
        z-index: 3;
        opacity: 1;
    }



    .avila-card.right {
        transform: translate3d(45%, 0, -100px) rotateY(-25deg) scale(0.9);
        z-index: 2;
        opacity: 0.45;
    }



    .avila-card.left {
        transform: translate3d(-45%, 0, -100px) rotateY(25deg) scale(0.9);
        z-index: 2;
        opacity: 0.45;
    }



.highlight-box {
    background-color: rgba(52, 152, 219, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 5px;
}

#scrollMenu, .page {
    position: relative;
    z-index: 100 !important;
}

/* Apply transitions to all content images; avila-card images are overridden below */
.content-section img {
    transition: width 0.4s ease, margin 0.4s ease, box-shadow 0.4s ease;
    transition-delay: 0s;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transform: none !important;
    will-change: auto;
}

.content-section img:hover {
    transition-delay: 0.5s;
    width: 120% !important;
    height: auto !important;
    margin-left: -10%;
    box-shadow: 0px 12px 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 5;
}

/* Ensure avila-card images are unaffected by the above hover/transition */
.avila-card img {
    transition: none !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    margin-left: 0 !important;
    box-shadow: none !important;
    z-index: 1 !important;
}

html, body, .page, #scrollMenu {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

ul li {
    margin-bottom: 20px; /* Adjust spacing between list items */
}

/* Container positioned fixed on the right side */

.vertical-progress-container {
    position: fixed;
    right: 25px;
    top: 100px; /* Below navigation header */

    height: calc(100vh - 140px); /* Adjust height to fit screen */

    width: 3px;
    background-color: #e0e0e0; /* Track light background */

    z-index: 99;
}



/* The black progress bar that fills down */

.vertical-progress-bar {
    width: 100%;
    height: 0%; /* JS updates this on scroll */

    background-color: #000000;
    transition: height 0.1s linear;
}



/* Chapter / Section Markers styling */

.progress-marker {
    position: absolute;
    right: -3px; /* Center dot on track */
    display: flex;
    align-items: center;
    justify-content: center; /* Keep marker centered */
    cursor: default;
    transform: translateY(-50%);
    width: 9px; /* Match base marker-dot width */
    height: 9px; /* Match base marker-dot height */
}


.marker-dot {
    width: 9px;
    height: 9px;
    background-color: #888888;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}



/* Progress marker text default state */

.marker-title {
    position: absolute;
    right: 18px;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: normal;
    color: #777777;
    opacity: 0.5;
    transition: all 0.2s ease;
    pointer-events: none;
}



/* Active state: Bolds and scales up when heading is reached */

.progress-marker.reached .marker-title {
    font-weight: 800 !important;
    color: #000000 !important;
    opacity: 1 !important;
    transform: scale(1.08);
}



.progress-marker.reached .marker-dot {
    background-color: #000000 !important;
    transform: scale(1.3);
}

/* Chapter / Section Markers styling - Base Dot */
.marker-dot {
    position: relative;
    width: 9px;
    height: 9px;
    background-color: #888888;
    border-radius: 50%;
    transition: background-color 0.2s ease, border-radius 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Base state for the checkmark (hidden and unformed) */
    .marker-dot::after {
        content: '';
        position: absolute;
        box-sizing: border-box;
        width: 4px;
        height: 8px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg) scale(0);
        opacity: 0;
        transition: transform 0.2s ease, opacity 0.2s ease;
        /* Adjust position slightly to center-align the checkmark */
        top: 1px;
    }

/* Active state: Dot turns green, square, and reveals the white checkmark */
.progress-marker.reached .marker-dot {
    background-color: #2ecc71 !important; /* Beautiful Emerald Green */
    border-radius: 4px; /* Rounded square look for the icon background */
    transform: scale(1.6); /* Scaled up slightly more to fit the checkmark */
}

    .progress-marker.reached .marker-dot::after {
        opacity: 1;
        transform: rotate(45deg) scale(1.1);
    }



/* Hide progress bar on smaller screens to prevent overlap */

@media screen and (max-width: 900px) {

    .vertical-progress-container {
        display: none;
    }
}



@media screen and (max-width: 700px) {

    .avila-3d-stage {
        height: 180px;
    }



    .avila-card {
        width: 75%;
        left: 12.5%;
        border-radius: 12px;
    }



        .avila-card img {
            border-radius: 12px;
        }



        .avila-card.center {
            transform: translate3d(0, 0, 0) rotateY(0deg) scale(1.0);
        }



        .avila-card.right {
            transform: translate3d(32%, 0, -60px) rotateY(-15deg) scale(0.85);
        }



        .avila-card.left {
            transform: translate3d(-32%, 0, -60px) rotateY(15deg) scale(0.85);
        }
}
