.guide-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background: #1a0f0a;
    border-right: 1px solid #3e2a1d;
    padding: 40px 20px;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar nav div {
    color: #8b7355;
    padding: 12px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sidebar nav div.active {
    color: #f5deb3;
    background: #241812;
    border: 1px solid #8b7355;
    font-weight: bold;
}

/* --- SUB-ITEM LOGIC --- */
.sub-item {
    display: none !important;
    padding-left: 35px !important;
    font-size: 0.85rem !important;
    border: none !important;
    background: none !important;
    color: #8b7355;
    cursor: pointer;
    margin-top: 8px;
    transition: color 0.2s;
}

#py-main.active ~ .sub-item {
    display: block !important;
}

.sub-item.active {
    color: #f5deb3 !important;
    font-weight: bold !important;
}

.sub-item:hover {
    color: #d2b48c !important;
}

/* --- CONTENT AREA --- */
.content-area {
    flex: 1;
    padding: 60px;
    max-width: 900px;
    min-width: 0;
}

.content-area h2 {
    color: #f5deb3;
    font-size: 2.2rem;
    margin-top: 0;
}

.guide-lead {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #d4c5b3;
    margin-bottom: 40px;
}

/* --- INTERACTIVE PANELS & CODE --- */
.text-content.code-panel,
.image-context-panel,
.video-square {
    background: #0d0806;
    border: 1px solid #36251c;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 100%;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Containers that hold images are clickable */
.image-context-panel,
.video-square {
    cursor: zoom-in;
}

/* Exclude code panels from the zoom cursor */
.text-content.code-panel {
    cursor: default;
}

.image-context-panel:hover,
.video-square:hover {
    border-color: #8b7355;
    box-shadow: 0 0 15px rgba(139, 115, 85, 0.1);
}

.code-header {
    background: #1e1410;
    padding: 10px 16px;
    font-size: 0.75rem;
    color: #a0866a;
    border-bottom: 1px solid #36251c;
}

.code-block {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #d2b48c;
    padding: 30px;
    margin: 0;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* --- IMAGE HANDLING --- */
.image-context-panel img,
.video-square img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
    pointer-events: none; /* Let parent container handle the click/hover */
}

.image-context-panel:hover img,
.video-square:hover img {
    opacity: 0.7;
}

/* Nested video-square inside a context panel (resets) */
.image-context-panel .video-square {
    margin-bottom: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: none !important;
    cursor: inherit;
}

.context-container {
    display: flex;
    gap: 24px;
    width: 100%;
    margin-bottom: 40px;
}

/* --- PANEL CAPTION STYLING --- */
.panel-caption {
    padding: 14px 20px;
    background: #150d0a;
    border-top: 1px solid #36251c;
    font-size: 0.82rem;
    color: #a0866a;
    line-height: 1.6;
    letter-spacing: 0.01em;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.image-context-panel:hover .panel-caption {
    color: #f5deb3;
    background: #1e1410;
    transition: all 0.2s ease;
}

/* --- UI ELEMENTS --- */
.next-section-trigger {
    margin-top: 60px;
    padding: 40px;
    background: #0d0806;
    border: 1px solid #36251c;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.next-section-trigger:hover {
    background: #1e1410;
    border-color: #8b7355;
}

.next-section-label span { color: #8b7355; font-size: 0.8rem; text-transform: uppercase; }
.next-section-label strong { color: #f5deb3; font-size: 1.4rem; display: block; }
.next-arrow { color: #f5deb3; font-size: 1.5rem; transition: transform 0.3s ease; }
.next-section-trigger:hover .next-arrow { transform: translateX(5px); }

/* --- LIGHTBOX --- */
.image-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 8, 6, 0.95);
    backdrop-filter: blur(10px);
    cursor: zoom-out;
    justify-content: center;
    align-items: center;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 1px solid #3e2a1d;
}