@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-green: #034C2B;
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;

    /* HEADER OFFSET (IMPORTANT) */
    --header-h: 170px;
    --sidebar-gap: 20px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #fff;
    color: var(--text-main);
    scroll-behavior: smooth;
    line-height: 1.6;
}

/* --- Layout --- */
.detail-container {
    padding: 20px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content-row {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

/* =========================
   FIXED SIDEBAR (STABLE STICKY)
========================= */

.sidebar-column {
    flex: 0 0 280px;
    align-self: flex-start;
}

/* 🔥 MAIN FIX HERE */
.sticky-sidebar {
    position: sticky;
    top: calc(var(--header-h) + var(--sidebar-gap));
    
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;

    padding-right: 6px;
    padding-bottom: 20px;

    scrollbar-width: none;
    -ms-overflow-style: none;

    z-index: 10; /* prevents overlap issues */
}

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

/* --- NAV --- */
.nav-card {
    background: #fff;
    padding-bottom: 1.5rem;
}

.sidebar-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

/* --- TOC --- */
.toc-link {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 0;
    display: block;
    border-left: 2px solid transparent;
    transition: 0.2s;
}

.toc-link:hover {
    color: var(--primary-green);
}

.toc-link.active {
    color: var(--primary-green);
    font-weight: 600;
    border-left: 2px solid var(--primary-green);
    padding-left: 10px;
}

/* --- CONTENT --- */
.content-column {
    flex: 1;
    min-width: 0;
}

.guideline-header-block {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.guideline-title-text {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.meta-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- SECTION --- */
.section-block {
    margin-bottom: 3rem;
    scroll-margin-top: calc(var(--header-h) + 40px);
    position: relative;
}

.section-header-main {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* --- BUTTONS --- */
.btn-action-outline {
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    background: #fff;
    transition: 0.2s;
    margin-bottom: 8px;
}

.btn-action-outline:hover {
    background: var(--bg-light);
    color: var(--primary-green);
}

/* --- MOBILE --- */
@media (max-width: 991px) {
    .main-content-row {
        flex-direction: column;
    }

    .sidebar-column {
        position: static;
        width: 100%;
    }

    .sticky-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
    }
}

/* --- PRINT --- */
@media print {
    .no-print {
        display: none !important;
    }
}

/* --- COLLAPSE SYSTEM (CLEAN FIX) --- */
.collapse-content {
    max-height: 140px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.35s ease;
}

.collapse-content.expanded {
    max-height: 5000px;
}

/* fade only when collapsed */
.collapse-content:not(.expanded)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
    pointer-events: none;
}

/* button */
.toggle-section {
    font-weight: 600;
    border-radius: 8px;
    padding: 6px 14px;
}