/* =================================================================
   SIDEBAR COMPONENT
   Left navigation and intro section
   ================================================================= */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sidebar-gap);
    position: sticky;
    top: var(--page-padding);
    height: fit-content;
    z-index: 100;
}

/* Header (Logo + Toggle) */
.sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.sidebar__logo {
    display: flex;
    align-items: flex-start;
}

.sidebar__logo-mark {
    height: 24px;
    width: auto;
    color: var(--text-primary);
}

/* Menu Toggle Button (Desktop: Hidden) */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    position: relative;
    width: 48px;
    height: 48px;
}

.menu-toggle__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -12px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-toggle__icon--close {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Prevent transitions during resize */
.resize-animation-stopper * {
    animation: none !important;
    transition: none !important;
}

/* When open (parent class on sidebar or body), toggle icons */
.sidebar--open .menu-toggle__icon--menu {
    opacity: 0;
    transform: rotate(90deg);
}

.sidebar--open .menu-toggle__icon--close {
    opacity: 1;
    transform: rotate(0);
}


/* Sidebar Content (Desktop: Normal flow) */
.sidebar__content {
    display: flex;
    flex-direction: column;
    gap: var(--sidebar-gap);
}

/* Navigation */
.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
}

.sidebar__nav-link {
    font-size: var(--font-size-sm);
    color: var(--link-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

/* Divider for Nav Groups */
.nav-divider {
    width: 100%;
    height: 1px;
    background-color: var(--color-divider);
    margin: 8px 0;
}

/* Cursor Dot */
/* Cursor Dot - Disabled for new icon style */
.nav-cursor {
    display: none;
    /* 
    position: absolute;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%);
    transition: top 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease;
    z-index: 10;
    */
}

.sidebar__nav {
    position: relative;
    /* Context for cursor positioning */
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
    width: fit-content;
    /* Ensure container is only as wide as the links */
}

.sidebar__nav-link {
    font-size: var(--font-size-sm);
    color: var(--link-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* Gap text-icon */
    padding: 4px 12px 4px 8px;
    /* Space for background */
    border-radius: 6px;
    margin-left: -8px;
    /* Align icon visually with logo/grid? */
    position: relative;
    transform-origin: left center;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* Specific link colors on hover? */
.sidebar__nav-link--share:hover {
    /* Standard link hover is fine, but we can target if we want specific color */
}

.sidebar__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    /* Lighter than text */
    color: var(--text-secondary);
    /* Thin lines */
    stroke-width: 1.5px;
}

/* Hover Backgrounds */
.sidebar__nav-link:hover {
    color: var(--text-primary);
    background-color: var(--color-neutral-100);
    /* Light mode light gray */
}

[data-theme="dark"] .sidebar__nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    /* Dark mode slightly lighter */
}

/* Active state (pushed by cursor) - Keeping it minimal or removing? 
   User didn't ask to remove dot. 
   If dot exists, maybe we shouldn't have background?
   User SPECIFICALLY asked for background on hover. 
   I will prioritize background.
*/
.sidebar__nav-link.active {
    /* transform: translateX(16px); */
    /* Disabling slide + dot to prefer background style */
    color: var(--text-primary);
}

/* Remove old pseudo-elements */
.sidebar__nav-link::before {
    display: none;
}



/* Introduction */
.sidebar__intro {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.sidebar__intro-block {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
    color: var(--text-primary);
}

.sidebar__intro-block p {
    margin-bottom: var(--space-4);
}

.sidebar__intro-block p:last-child {
    margin-bottom: 0;
}

/* Contact */
.sidebar__contact {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    align-items: flex-start;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.sidebar__contact a {
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.sidebar__contact a::before {
    content: '+';
    display: inline-block;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: width 0.3s ease, margin-right 0.3s ease, opacity 0.3s ease;
}

.sidebar__contact a:hover {
    color: var(--text-primary);
    /* Maintain color */
    text-decoration: none;
}

.sidebar__contact a:hover::before {
    width: 1ch;
    margin-right: 12px;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: auto;
        /* Allow negative margins to expand beyond container */
        position: sticky;
        top: 0;
        gap: 0;
        background: var(--bg-page);
        padding: var(--space-4);
        /* Add padding back for internal content */
        margin-left: calc(var(--space-4) * -1);
        /* Pull to screen edge */
        margin-right: calc(var(--space-4) * -1);
        /* Pull to screen edge */
        margin-top: calc(var(--space-8) * -1);
        border-bottom: 1px solid transparent;
        transition: border-color 0.3s ease;
        z-index: 1000;
    }

    /* Add border/shadow when stuck if we want? User just said sticky white bg. */

    .sidebar__header {
        position: relative;
        z-index: 1002;
        /* Above drawer */
        background: var(--bg-page);
        /* Ensure header stays opaque */
    }

    .menu-toggle {
        display: block;
    }

    /* Burger Menu Drawer */
    .sidebar__content {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        bottom: auto;
        /* Auto height */
        /* Auto height */
        background: var(--bg-page);
        padding: 100px var(--space-4) var(--space-6) var(--space-4);
        /* Top, Right, Bottom, Left */

        transform: translateY(-100%);
        /* Slide from top */
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);

        z-index: 999;
        /* Behind header but above page */

        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding-top: 100px;
        /* Space for header */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

    .sidebar--open .sidebar__content {
        transform: translateY(0);
    }

    /* Masking background for Header */
    .sidebar__header::before {
        content: '';
        position: absolute;
        top: calc(var(--space-4) * -1);
        left: calc(var(--space-4) * -1);
        right: calc(var(--space-4) * -1);
        bottom: -20px;
        background: var(--bg-page);
        z-index: -1;
        box-shadow: none;
        /* User requested no shadow */
    }

    /* Links alignment */
    .sidebar__nav,
    .sidebar__intro,
    .sidebar__contact {
        width: 100%;
        align-items: flex-start;
        /* Aligned to the left as requested */
    }

    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        /* Below sidebar */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar--open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* =================================================================
   FILTER DROPDOWN
   ================================================================= */

.filter-dropdown {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 16px;
}

.filter-dropdown__trigger {
    width: 100%;
    font-family: var(--font-family-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
    color: var(--text-primary);
    background: #1A1A1A;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.filter-label.is-placeholder {
    opacity: 0.7;
    /* Muted but more visible */
}

.filter-label {
    opacity: 1;
    transition: opacity 0.2s ease;
}

[data-theme="dark"] .filter-dropdown__trigger {
    background: #1A1A1A;
}

.filter-dropdown__trigger:hover,
.filter-dropdown.is-open .filter-dropdown__trigger {
    background-color: #222222;
    color: var(--text-primary);
}

[data-theme="light"] .filter-dropdown__trigger {
    background: var(--color-neutral-50);
    color: var(--text-primary);
    border: 1px solid var(--color-neutral-100);
}


[data-theme="light"] .filter-dropdown__trigger:hover {
    background: var(--color-neutral-200);
    color: var(--text-primary);
}

.filter-icon {
    color: var(--text-muted);
    transition: transform 0.2s ease;
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.filter-dropdown.is-open .filter-icon {
    transform: rotate(180deg);
}

.filter-dropdown__menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 8px;
    background: #1A1A1A;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
    padding: 6px;
}

[data-theme="light"] .filter-dropdown__menu {
    background: var(--color-white);
    border-color: var(--color-neutral-200);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.filter-dropdown.is-open .filter-dropdown__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-option {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-option:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .filter-option:hover {
    background: var(--color-neutral-100);
    background: var(--color-neutral-100);
}

.filter-option.is-selected {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

[data-theme="light"] .filter-option.is-selected {
    background: var(--color-neutral-100);
    color: var(--text-primary);
}