/* =================================================================
   SIDEBAR COMPONENT
   ================================================================= */

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

.sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.sidebar__logo-img {
    height: 36px;
    width: auto;
    display: none;
    transition: transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.sidebar__logo:hover .sidebar__logo-img {
    transform: rotate(360deg);
}

.sidebar__logo-name {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: 0em;
    transition: color 0.35s ease, letter-spacing 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.sidebar__logo:hover .sidebar__logo-name {
    color: var(--link-color);
    letter-spacing: 0.1em;
}

/* Light mode: show light.png */
.sidebar__logo-img--light {
    display: block;
}

/* Dark mode: swap to dark.png */
[data-theme="dark"] .sidebar__logo-img--light {
    display: none;
}

[data-theme="dark"] .sidebar__logo-img--dark {
    display: block;
}

.sidebar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.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;
    width: 24px;
    height: 24px;
}

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

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

.resize-animation-stopper * {
    animation: none !important;
    transition: none !important;
}

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

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

.sidebar__content {
    display: flex;
    flex-direction: column;
    gap: var(--sidebar-gap);
    flex: 1;
}

.sidebar__identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
}

.sidebar__identity-name,
.sidebar__identity-email {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.sidebar__identity-name {
    color: var(--text-secondary);
    font-weight: var(--font-weight-regular);
}

.sidebar__identity-email {
    color: var(--text-secondary);
}

.sidebar__identity-link {
    margin-top: var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--link-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    position: relative;
    transition: color 0.2s ease;
}

.sidebar__identity-link::after {
    content: "\2192";
    margin-left: 0.2em;
    transition: margin-left 0.2s ease;
}

.sidebar__identity-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

.sidebar__identity-link--svg::after {
    content: none;
}

.sidebar__identity-link-text {
    position: relative;
}

.sidebar__identity-link-text::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.sidebar__identity-link:hover .sidebar__identity-link-text::after {
    width: 100%;
}

.sidebar__identity-link--svg svg {
    margin-left: 0.2em;
    flex-shrink: 0;
    transition: margin-left 0.2s ease;
}

.sidebar__identity-icon--left {
    margin-left: 0;
    margin-right: 0.4em;
    flex-shrink: 0;
}

.sidebar__handshake-logo {
    display: inline-block;
    height: 13px;
    width: 9px;
    background: currentColor;
    -webkit-mask: url('../../images/handshake-logo.png') center / contain no-repeat;
    mask: url('../../images/handshake-logo.png') center / contain no-repeat;
    margin-left: 0.2em;
    margin-right: 0.4em;
    flex-shrink: 0;
    transition: margin-left 0.2s ease;
}

.sidebar__identity-link--svg:hover svg,
.sidebar__identity-link--svg:hover .sidebar__handshake-logo,
.sidebar__identity-link--svg:focus-visible svg,
.sidebar__identity-link--svg:focus-visible .sidebar__handshake-logo {
    margin-left: 0.38em;
}

.sidebar__identity-link:hover::after,
.sidebar__identity-link:focus-visible::after {
    margin-left: 0.38em;
}

.sidebar__clock {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.sidebar__availability {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 5px;
}

.sidebar__availability-dot {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar__availability-dot::after {
    content: '';
    display: block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px 1px rgba(34, 197, 94, 0.9), 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: avail-pulse 1.8s ease-out infinite;
}

@keyframes avail-pulse {
    0%   { box-shadow: 0 0 6px 1px rgba(34, 197, 94, 0.9), 0 0 0 0   rgba(34, 197, 94, 0.7); }
    70%  { box-shadow: 0 0 6px 1px rgba(34, 197, 94, 0.9), 0 0 0 9px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 6px 1px rgba(34, 197, 94, 0.9), 0 0 0 0   rgba(34, 197, 94, 0); }
}

.sidebar__copy-email {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.sidebar__copy-icon--check { display: none; }

.sidebar__copy-email.is-copied .sidebar__copy-icon--copy  { display: none; }
.sidebar__copy-email.is-copied .sidebar__copy-icon--check { display: block; }

.sidebar .theme-toggle {
    position: relative;
    bottom: auto;
    left: auto;
    margin-top: auto;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        width: auto;
        height: auto;
        position: sticky;
        top: 0;
        gap: 0;
        background: var(--bg-page);
        padding: var(--space-4);
        margin-left: calc(var(--space-4) * -1);
        margin-right: calc(var(--space-4) * -1);
        margin-top: calc(var(--space-8) * -1);
        border-bottom: 1px solid transparent;
        transition: border-color 0.3s ease;
        z-index: 1000;
    }

    .sidebar__header {
        position: relative;
        z-index: 1002;
        background: var(--bg-page);
    }

    .menu-toggle {
        display: block;
        margin-right: -8px;
    }

    .sidebar__content {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--bg-page);
        padding: 100px var(--space-4) var(--space-6) var(--space-4);
        transform: translateY(-100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 999;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

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

    .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;
    }

    .sidebar__nav,
    .sidebar__identity,
    .sidebar__intro,
    .sidebar__contact {
        width: 100%;
        align-items: flex-start;
    }

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

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