/* --- CSS Variables --- */
:root {
    /* Terminal Colors - Muted Gruvbox-Inspired Palette */
    --bg-color: #1d2021;
    --text-primary: #ebdbb2;
    --text-secondary: #928374;
    --text-cyan: #88c0d0;
    --accent-amber: #d79921;
    --terminal-border: rgba(235, 219, 178, 0.2);
    --terminal-header-bg: #282828;
    --log-hover-bg: #282828;
    --success-green: #689d6a;
    --warning-amber: #d79921;

    /* Fonts - Monospace */
    --font-primary: 'Fira Code', 'Courier New', 'Monaco', 'Menlo', monospace;
    --font-mono: 'Fira Code', 'Courier New', monospace;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-primary);
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    font-weight: 400;
}


/* --- Skip to Content --- */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1rem 2rem;
    background: var(--text-primary);
    color: var(--bg-color);
    text-decoration: none;
    font-weight: 700;
    border-radius: 0;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
}

/* --- Floating Sidebar Toggle Button --- */
.sidebar-toggle-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    width: 3rem;
    height: 3rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background-color: var(--terminal-header-bg);
    border: 1px solid var(--terminal-border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
    .sidebar-toggle-btn {
        display: flex;
    }
}

.sidebar-toggle-btn:hover {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    background-color: var(--log-hover-bg);
}

.toggle-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: currentColor;
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn.sidebar-collapsed .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon line {
    stroke: var(--accent-amber);
    transition: opacity 300ms ease;
}

.sidebar-toggle-btn:hover .toggle-icon {
    color: var(--text-cyan);
}

.sidebar-toggle-btn.sidebar-collapsed .toggle-icon line {
    opacity: 0;
}

/* --- Main Container --- */
.container {
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (min-width: 1024px) {
    .container {
        display: flex;
        justify-content: space-between;
        gap: 4rem;
        padding: 0 3rem;
        transition: gap 400ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .container.sidebar-collapsed {
        gap: 2rem;
    }
}

/* --- Sidebar (Left Column) --- */
.sidebar {
    padding: 2rem 0;
}

@media (min-width: 1024px) {
    .sidebar {
        position: sticky;
        top: 0;
        max-height: 100vh;
        width: 48%;
        padding: 4rem 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        justify-content: space-between;
        transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar .sidebar-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        /* Ensure content takes full height to allow bottom spacing */
    }

    .sidebar.collapsed .sidebar-content {
        align-items: center;
        /* Center all items horizontally in collapsed mode */
    }

    .sidebar.collapsed {
        width: 80px;
        padding-right: 1rem;
    }

    .sidebar.collapsed .sidebar-content::after {
        content: '';
        position: absolute;
        right: -1rem;
        top: 2rem;
        bottom: 2rem;
        width: 1px;
        background-color: var(--terminal-border);
    }

    .sidebar.collapsed .sidebar-content {
        position: relative;
    }

    .sidebar.collapsed .header-name,
    .sidebar.collapsed .header-title,
    .sidebar.collapsed .header-description,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .nav-indicator {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0s linear 0.2s;
        display: none;
    }

    .sidebar .header-name,
    .sidebar .header-title,
    .sidebar .social-links {
        transition: opacity 0.2s ease-in-out, max-width 0.4s ease-in-out, margin 0.4s ease;
        opacity: 1;
        max-width: 400px;
        white-space: nowrap;
        overflow: hidden;
    }

    .sidebar .header-description {
        transition: opacity 0.2s ease-in-out, max-height 0.4s ease-in-out, margin 0.4s ease;
        opacity: 1;
        max-height: 200px;
        /* Animate height for paragraph instead of width to prevent reflow artifacts */
        white-space: normal;
        overflow: hidden;
    }

    /* Update collapsed state for description */
    .sidebar.collapsed .header-description {
        opacity: 0;
        pointer-events: none;
        max-height: 0;
        margin: 0;
    }

    .sidebar.collapsed .header-name,
    .sidebar.collapsed .header-title,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .nav-indicator {
        opacity: 0;
        pointer-events: none;
        max-width: 0;
        margin: 0;
    }

    .sidebar.collapsed .social-links {
        flex-direction: column;
        gap: 1rem;
        margin-top: auto;
        /* Push to bottom */
        padding: 1rem 0;
        width: auto;
        align-items: center;
    }

    .sidebar.collapsed .nav-menu {
        opacity: 1;
        margin: 0;
        /* Reset margins, let container handle centering */
    }

    .sidebar.collapsed .nav-menu ul {
        width: auto;
        /* Override max-content to allow centering */
    }

    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 1rem 0;
    }

    .sidebar.collapsed .nav-icon {
        display: block;
        width: 1.5rem;
        height: 1.5rem;
        margin: 0;
        /* Remove margin to allow perfect centering */
    }
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* --- Header Info --- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-name a {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 200ms;
}

.header-name a:hover {
    color: var(--text-cyan);
}

@media (min-width: 640px) {
    .header-name a {
        font-size: 3rem;
    }
}

.header-title {
    margin-top: 0.75rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-cyan);
    letter-spacing: 0.025em;
}

@media (min-width: 640px) {
    .header-title {
        font-size: 1.25rem;
    }
}

.header-description {
    margin-top: 1rem;
    max-width: 320px;
    color: var(--text-secondary);
    line-height: 1.625;
}

/* --- Mobile Menu Toggle --- */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 2rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 50;
    transition: transform 200ms;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
}

.mobile-menu-toggle:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 4px;
}

@media (min-width: 1024px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 300ms ease;
    transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Navigation Menu --- */
.nav-menu {
    display: none;
}

.nav-menu.mobile-active {
    display: block;
    margin-top: 2rem;
    animation: slideDown 300ms ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 1024px) {
    .nav-menu {
        display: block;
        margin-top: 4rem;
    }

    .nav-menu.mobile-active {
        animation: none;
    }
}

.nav-menu ul {
    list-style: none;
    width: max-content;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 200ms;
}

.nav-indicator {
    display: block;
    width: 2rem;
    height: 2px;
    margin-right: 1rem;
    background-color: var(--terminal-border);
    transition: all 200ms;
}

.nav-link:hover .nav-indicator,
.nav-link.active .nav-indicator {
    width: 4rem;
    background-color: var(--text-primary);
}

.nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    color: var(--text-secondary);
    transition: color 200ms;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--text-primary);
}

.nav-text {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 200ms;
}

.nav-link:hover .nav-text,
.nav-link.active .nav-text {
    color: var(--text-primary);
}

/* --- Social Links --- */
.social-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
    list-style: none;
    flex-wrap: wrap;
}

@media (min-width: 1024px) {
    .social-links {
        margin-top: auto;
        flex-shrink: 0;
    }
}

.social-links a {
    color: var(--text-secondary);
    transition: all 200ms;
    text-decoration: none;
}

.social-links a:hover {
    color: var(--text-primary);
}

.social-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* --- Collapsed Sidebar Info --- */
.collapsed-sidebar-info {
    display: none;
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: rgba(29, 32, 33, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--terminal-border);
    padding: 1.25rem 1.5rem;
    margin: -4rem -1.5rem 2rem -1.5rem;
}

@media (min-width: 1024px) {
    .sidebar-collapsed .collapsed-sidebar-info {
        display: block;
        animation: slideDown 300ms ease-out;
    }
}

.collapsed-info-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.collapsed-info-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

/* .collapsed-info-name::before {
    content: '> ';
    color: var(--text-cyan);
} */

.collapsed-info-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-cyan);
    letter-spacing: 0.025em;
}

.collapsed-info-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Main Content (Right Column) --- */
.main-content {
    padding: 2rem 0;
}

@media (min-width: 1024px) {
    .main-content {
        width: 52%;
        padding: 4rem 0;
        transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .main-content {
        width: calc(100% - 80px - 2rem);
    }
}

/* --- Section Styling --- */
.section {
    margin-bottom: 4rem;
    scroll-margin-top: 4rem;
}

@media (min-width: 768px) {
    .section {
        margin-bottom: 6rem;
    }
}

@media (min-width: 1024px) {
    .section {
        margin-bottom: 9rem;
        scroll-margin-top: 6rem;
    }
}

/* --- Mobile Section Headers --- */
.section-header-mobile {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: -1.5rem -1.5rem 1rem;
    padding: 1.25rem 1.5rem;
    background-color: rgba(12, 12, 12, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--terminal-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 200ms;
}

.section-header-mobile:hover {
    background-color: rgba(40, 40, 40, 0.95);
}

.section-header-mobile:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: -2px;
}

@media (min-width: 768px) {
    .section-header-mobile {
        margin: -3rem -3rem 1rem;
        padding: 1.25rem 3rem;
    }
}

@media (min-width: 1024px) {
    .section-header-mobile {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: 0 0 2rem 0;
        padding: 1.25rem 1.5rem;
        background-color: rgba(29, 32, 33, 0.95);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--terminal-border);
        opacity: 1;
        pointer-events: auto;
        transition: all 300ms ease;
    }
}

.section-title-mobile {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.section-title-mobile::before {
    content: '> ';
    color: var(--text-cyan);
}

.collapse-indicator {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-primary);
    font-weight: 300;
    transition: transform 200ms, color 200ms;
    min-width: 1.5rem;
    text-align: center;
}

.section-header-mobile:hover .collapse-indicator {
    color: var(--text-cyan);
}

/* --- Section Content --- */
.section-content {
    font-size: 0.875rem;
    line-height: 1.7;
    max-height: 10000px;
    overflow: hidden;
    transition: max-height 400ms ease, opacity 300ms ease, margin 300ms ease;
    opacity: 1;
}

.section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.section-content p {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* --- Terminal Window (About Section) --- */
.terminal-window {
    border: 1px solid var(--terminal-border);
    border-radius: 0;
    background: rgba(26, 26, 26, 0.5);
    padding: 0;
    margin-bottom: 1rem;
}

.terminal-header {
    background: var(--terminal-header-bg);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--terminal-border);
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 0;
    border: 1px solid var(--terminal-border);
    cursor: pointer;
    transition: transform 100ms ease;
}

.terminal-button:hover {
    transform: scale(1.1);
}

.terminal-window.collapsed .terminal-body {
    display: none;
}

.terminal-window.collapsed {
    border-bottom: 1px solid var(--terminal-border);
    margin-bottom: 2rem;
}

.terminal-window.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    margin: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
}

.terminal-window.fullscreen .terminal-body {
    flex: 1;
    font-size: 1.1rem;
    overflow-y: auto;
}

.terminal-window.closed {
    display: none;
}

.terminal-button.close {
    background: #cc241d;
}

.terminal-button.minimize {
    background: #d79921;
}

.terminal-button.maximize {
    background: #689d6a;
}

.terminal-title {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.terminal-body {
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--text-secondary);
    min-height: 200px;
}

.terminal-prompt {
    color: var(--text-primary);
    margin-right: 0.5rem;
}

#typed-text {
    color: var(--text-secondary);
}

.cursor {
    display: none;
    /* Hidden by default, shown by JS when typing starts */
    width: 0.6em;
    height: 1.2em;
    background-color: var(--text-primary);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

.cursor.visible {
    display: inline-block;
}

@keyframes blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

/* --- Experience & Project Cards (Log Entry Style) --- */
.experience-list {
    list-style: none;
}

.experience-item {
    margin-bottom: 1.5rem;
}

.experience-card {
    position: relative;
    padding: 1rem 1.5rem;
    border: 1px solid var(--terminal-border);
    border-radius: 0;
    background: transparent;
    transition: all 200ms;
    cursor: pointer;
}

.experience-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--success-green);
    opacity: 0;
    transition: opacity 200ms;
}

.experience-card:hover {
    background: var(--log-hover-bg);
    border-color: var(--text-primary);
}

.experience-card:hover::before {
    opacity: 1;
}

.experience-header {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.experience-header::before {
    content: '[';
    color: var(--terminal-border);
    margin-right: 0.25rem;
}

.experience-header::after {
    content: ']';
    color: var(--terminal-border);
    margin-left: 0.25rem;
}

.experience-content {
    position: relative;
    z-index: 10;
}

.experience-title {
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.experience-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 200ms;
}

.experience-link:hover {
    color: var(--text-cyan);
}

.link-arrow {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.25rem;
    flex-shrink: 0;
    transition: transform 200ms;
    translate: 0 1px;
}

.experience-link:hover .link-arrow {
    transform: translate(4px, -4px);
}

.company-name {
    color: var(--text-cyan);
    transition: color 200ms;
}

.experience-link:hover .company-name {
    color: var(--accent-amber);
}

.company-logo {
    height: 1.6em;
    width: auto;
    vertical-align: text-bottom;
    margin-right: 0.4em;
}

.experience-description {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.experience-description::before {
    content: '$ ';
    color: var(--text-cyan);
}

/* --- Tech Stack Tags --- */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    list-style: none;
}

.tech-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: transparent;
    border: 1px solid var(--terminal-border);
    border-radius: 0;
    transition: all 200ms;
}

.tech-tag:hover {
    border-color: var(--text-primary);
    background-color: rgba(104, 157, 106, 0.1);
}

/* --- Projects List (Same Log Style) --- */
.projects-list {
    list-style: none;
}

.project-item {
    margin-bottom: 1.5rem;
}

.project-card {
    position: relative;
    padding: 1rem 1.5rem;
    border: 1px solid var(--terminal-border);
    border-radius: 0;
    background: transparent;
    transition: all 200ms;
    cursor: pointer;
}

.project-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--text-cyan);
    opacity: 0;
    transition: opacity 200ms;
}

.project-card:hover {
    background: var(--log-hover-bg);
    border-color: var(--text-cyan);
}

.project-card:hover::before {
    opacity: 1;
}

.project-content {
    position: relative;
    z-index: 10;
}

.project-title {
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.project-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 200ms;
}

.project-link:hover {
    color: var(--text-cyan);
}

.project-link:hover .link-arrow {
    transform: translate(4px, -4px);
}

.project-description {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.project-description::before {
    content: '$ ';
    color: var(--text-cyan);
}

/* --- Link Overlay for Clickable Cards --- */
.link-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 0;
}

/* --- Footer --- */
.footer {
    max-width: 28rem;
    padding-bottom: 4rem;
    padding-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--terminal-border);
    margin-top: 4rem;
}

@media (min-width: 640px) {
    .footer {
        padding-bottom: 0;
    }
}

.footer p {
    line-height: 1.5;
}

.footer p::before {
    content: '> ';
    color: var(--text-primary);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1023px) {

    .experience-card,
    .project-card {
        padding: 1rem;
    }
}

/* --- Smooth Transitions --- */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* --- Focus Visible Styles --- */
a:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 4px;
    border-radius: 0;
}

/* --- Selection Styles --- */
::selection {
    background-color: rgba(104, 157, 106, 0.3);
    color: var(--text-primary);
}

/* --- Strong/Bold Text --- */
strong {
    color: var(--text-primary);
    font-weight: 600;
}