@import url('./css/colors.css');

/* ******* */
/* GLOBAL */
/* ******* */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    background: var(--background);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* **** */
/* PAGE */
/* **** */

main {
    margin-left: 440px;
    padding: 48px 32px 20px;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    box-sizing: border-box;
}

main h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
}

main h2 {
    font-size: 20px;
    font-weight: 600;
}

main p, main ul {
    font-size: 14px;
    color: var(--secondary-text);
}

main img {
    width: 100%;
    height: auto;
    margin-top: 16px;
    border-radius: 4px;
}

.site-footer {
    text-align: center;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-color);
    margin-top: 48px;
    font-size: 0.8rem;
    color: var(--secondary-text);
}

.site-footer p {
    margin: 2px 0;
}

/* Back to Top Button */
#back-to-top {
    color: var(--text-color);
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    display: none;
    font-size: 16px;
    z-index: 1000;
    transition: opacity 0.3s;
}

#back-to-top:hover {
    background: var(--sidebar-hover);
}

html {
    scroll-behavior: smooth;
}

/* Light-Dark theme toggle */
.theme-toggle {
    position: fixed;
    top: 48px;
    right: 48px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    color: var(--text-color);
    transition: color 0.3s, top 0.3s ease;
}

.theme-toggle:hover {
    color: var(--accent-color);
}

/* ******* */
/* SIDEBAR */
/* ******* */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar-bg);
    color: var(--text-color);
    padding: 20px;
    box-sizing: border-box;
    font-size: 14px;
}

.sidebar-header {
    margin-bottom: 20px;
}

.sidebar-header h1 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}

.home-link {
    color: inherit;
    text-decoration: none;
}

.menu, .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu li, .sub-menu li {
    margin-bottom: 8px;
}

.menu a, .sub-menu a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: none;
}

.menu a:hover, .sub-menu a:hover {
    background: var(--sidebar-hover);
}

.menu li.active a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.menu i, .sub-menu i {
    margin-right: 8px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.link a::after {
    content: ' →';
    margin-left: auto;
    color: var(--secondary-text);
    font-size: 12px;
}

.section-title {
    font-size: 14px;
    color: var(--text-color);
    margin: 24px 0 8px 0;
    font-weight: 400;
}

.sub-menu li.active a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sub-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 14px;
}

.sub-item i {
    margin-right: 8px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--sidebar-bg);
    color: var(--text-color);
    padding: 12px 16px;
    box-sizing: border-box;
    z-index: 1001;
    align-items: center;
    justify-content: space-between;
}

.mobile-name {
    font-size: 16px;
    font-weight: 600;
}

.mobile-menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.mobile-menu-toggle:hover {
    color: var(--accent-color);
}

/* ********* */
/* UNIVERSAL */
/* ********* */

.main-content {
    max-width: 860px;
    padding: 20px 0 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
}

.section-read-more {
    font-size: 14px;
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.2s;
    margin: auto 0px;
}

.section-read-more:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.pin-icon {
    font-size: 14px;
}

.bio-text {
    flex: 1;
}

.bio-text p {
    font-size: 15px;
    color: var(--secondary-text);
    line-height: 1.6;
    margin-bottom: 16px;
}

.bio-text p:last-child {
    margin-bottom: 0;
}

.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
    color: var(--accent-color);
}

.item-list a {
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
    padding: 0 20px;
}

.item-title {
    font-size: 16px;
    font-weight: 600;
    margin-right: 16px;
}

.item-subtitle {
    font-size: 14px;
    color: var(--secondary-text);
    flex-grow: 1;
}

.item-arrow {
    font-size: 14px;
    color: var(--text-color);
    margin-left: auto;
}

.item-list li:hover .item-arrow {
    color: var(--accent-color);
}

/* Timeline */
.timeline {
    position: relative;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    margin-bottom: 32px;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0px;
}

.timeline-dot {
    position: absolute;
    left: -27px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
}

.timeline-content h3 {
    font-size: 18px;
    margin: 0 0 4px;
    color: var(--text-color);
}

.timeline-date {
    font-size: 14px;
    color: var(--secondary-text);
    display: block;
    margin-bottom: 12px;
}

.timeline-content p {
    font-size: 15px;
    color: var(--secondary-text);
    line-height: 1.5;
    margin: 0;
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.grid-item {
    background: var(--background);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.grid-item i {
    font-size: 32px;
    color: var(--accent-color);
    margin-bottom: 12px;
    display: block;
}

.grid-item h3 {
    font-size: 16px;
    margin: 0 0 8px;
    color: var(--text-color);
}

.grid-item p {
    font-size: 14px;
    color: var(--secondary-text);
    margin: 0;
    line-height: 1.5;
}

/* Home-Specific */
.intro-container {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    padding: 20px 0 0;
    margin-bottom: 24px;
}

.intro-content {
    flex: 1;
    max-width: 600px;
}

.intro-content p {
    margin: 0px auto;
}

.intro-content p:last-child {
    margin-bottom: 12px;
}

.info {
    display: flex;
    justify-content: space-between;
}

.job {
    color: var(--text-color);
    margin-top: -3px;
}

.job-title {
    font-size: 14px;
}

.info-location {
    font-size: 14px;
    margin: auto 8px !important;
}

.highlighted-link {
    color: inherit;
    text-decoration: underline 1px;
    text-underline-offset: 1.5px;
    transition: color 0.2s, text-decoration 0.2s;
}

.highlighted-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.introduction p {
    color: var(--text-color);
    font-size: 15px;
    margin: 0px auto;
}

.socials-container {
    display: flex;
    gap: 14px;
}

.social-link {
    color: var(--secondary-text) !important;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: color 0.2s, text-decoration 0.2s;
    margin-top: 20px;
}

.social-link i {
    margin-right: 8px;
}

.social-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.intro-image {
    position: relative;
    width: 240px;
    aspect-ratio: 1/1;
    flex-shrink: 0;
    perspective: 1000px;
    border-radius: 50%;
    margin-top: auto;
    margin-bottom: auto;
}

.flipper {
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
}

.intro-image:hover .flipper {
    transform: rotateY(180deg);
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 50%;
    clip-path: circle(50%);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 8px var(--shadow-color));
}

.back {
    transform: rotateY(180deg);
}

/* Markdown post content */
#post-content {
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-color);
}

#post-content p {
    margin-bottom: 16px;
}

#post-content a {
    color: var(--secondary-color);
    text-decoration: underline 1px;
    text-underline-offset: 1.5px;
    transition: color 0.2s;
}

#post-content a:hover {
    color: var(--accent-color);
    text-decoration: underline 2px;
}

#post-content ul, #post-content ol {
    margin-bottom: 16px;
    padding-left: 20px;
}

#post-content li {
    margin-bottom: 8px;
}

#post-content h1, #post-content h2, #post-content h3, #post-content h4, #post-content h5, #post-content h6 {
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
}

#post-content h1 {
    font-size: 24px;
}

#post-content h2 {
    font-size: 20px;
}

#post-content h3 {
    font-size: 18px;
}

#post-content h4 {
    font-size: 16px;
}

#post-content h5 {
    font-size: 14px;
}

#post-content h6 {
    font-size: 12px;
}

#post-content li {
    margin-bottom: 0px;
}

#post-content code {
    background: var(--border-color);
    color: var(--accent-color);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

#post-content pre {
    background: var(--sidebar-bg);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
}

#post-content pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
}

/* ************* */
/* MEDIA QUERIES */
/* ************* */

@media (max-width: 1400px) and (min-width: 1296px) {
    main {
        margin-left: calc(280px + 160px);
        margin-right: 160px;
        padding: 48px 32px 20px;
        max-width: 800px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
    }
}

@media (max-width: 1295px) and (min-width: 1232px) {
    main {
        margin-left: calc(280px + 128px);
        margin-right: 128px;
        padding: 48px 32px 20px;
        max-width: 800px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
    }
}

@media (max-width: 1231px) and (min-width: 1168px) {
    main {
        margin-left: calc(280px + 96px);
        margin-right: 96px;
        padding: 48px 32px 20px;
        max-width: 800px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
    }
}

@media (max-width: 1167px) and (min-width: 1145px) {
    main {
        margin-left: calc(280px + 64px);
        margin-right: 64px;
        padding: 48px 32px 20px;
        max-width: 800px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
    }
}

@media (max-width: 1144px) and (min-width: 865px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        padding: 16px;
        display: none; /* Hidden by default */
    }

    .sidebar.open {
        display: block; /* Shown when open */
        transform: translateY(48px);
    }

    .mobile-header {
        display: flex;
    }

    main {
        margin-left: 32px;
        margin-right: 32px;
        padding: 80px 32px 20px;
        max-width: 800px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
    }

    .intro-container {
        flex-direction: row;
        gap: 32px;
    }

    .intro-image {
        width: 200px;
        aspect-ratio: 1/1;
        flex-shrink: 0;
    }
}

@media (max-width: 864px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        padding: 16px;
        display: none; /* Hidden by default */
    }

    .sidebar.open {
        display: block; /* Allow sidebar to show when open */
        transform: translateY(48px);
    }

    .intro-container {
        flex-direction: column;
    }

    .theme-toggle {
        right: 10.5px;
    }

    .info-location {
        white-space: nowrap;
    }

    .socials-container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .social-link i {
        margin-right: 4px;
    }

    .intro-image {
        width: 200px;
        aspect-ratio: 1/1;
        margin-bottom: 32px;
        margin-left: auto;
        margin-right: auto;
    }

    .intro-image:active .flipper {
        transform: rotateY(180deg);
    }

    .intro-image .flipper {
        transform: rotateY(0deg);
    }

    main {
        margin-left: 16px;
        margin-right: 16px;
        padding: 80px 32px 20px;
        width: calc(100vw - 32px);
        max-width: none;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .main-content {
        gap: 32px;
    }

    .item-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-list a {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 16px;
    }

    .item-title {
        margin-right: 0;
        margin-bottom: 4px;
    }

    .item-subtitle {
        margin-bottom: 8px;
        margin-right: 32px;
    }

    .item-arrow {
        margin-top: 8px;
        margin-right: 32px;
        padding: 0;
    }

    .timeline {
        margin-left: 0;
        padding-left: 20px;
        border-left: 2px solid var(--border-color);
    }

    .timeline-dot {
        left: -27px;
        top: 7px;
    }

    .timeline-item {
        margin-bottom: 32px;
    }

    .grid-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

