:root {
    --bg-color: #1a1a1a;
    --card-bg-color: #222;
    --text-color: #f5f5f5;
    --gray: #888888;

    --font-family-base: "Garamond", "Palatino", "Georgia", "Times New Roman", serif;
    --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
             "Liberation Mono", "Courier New", monospace;
}

[data-theme="light"] {
    --bg-color: #f5f5f5;
    --card-bg-color: #eee;
    --text-color: #1a1a1a;
}

.theme-light {
    display: none;
}

[data-theme="light"] .theme-dark {
    display: none;
}

[data-theme="light"] .theme-light {
    display: inline;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: 22px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1020px;
    margin: 0 auto;
    padding: 40px 20px;
}

nav {
    padding: 20px 0;
    padding-top: 60px;
    display: flex;
    justify-content: space-between;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    font-size: 1.2rem;
}

header {
    margin: 40px 0;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--gray);
}

h1 {
    font-size: 3.6rem;
    font-weight: 400;
    margin-bottom: 12px;
}

header p:first-of-type {
    font-size: 1.6rem;
}

h2 {
    font-size: 2.6rem;
    font-weight: 400;
    margin-bottom: 24px;
}

h3 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 12px;
}

h4 {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 12px;
    color: #888888;
}

p {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.last-updated {
    font-size: 1.1rem;
    color: var(--gray);
}

a {
    color: var(--text-color);
    text-decoration: none;
}

a:hover {
    opacity: 0.7;
}

section {
    margin: 40px 0;
    padding-top: 0;
}

section:not(:last-of-type) {
    border-bottom: 1px solid var(--gray);
    padding-bottom: 40px;
}

.expertise-category {
    margin: 30px 0 12px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem 1rem;
}

.expertise-item {
    width: 100%;
    text-align: center;
}

.expertise-item h4 {
    color: var(--text-color);
}

.expertise-item img {
    margin: 5px 0;
    width: 50px;
    height: 50px;
}

.expertise-item p {
    color: var(--gray);
    font-size: 1.15rem;
    /* max-width: 300px; */
}

.tech-category {
    margin-bottom: 12px;
}

.tech-list {
    display: flex;
    flex-wrap: wrap;
}

.contributions-index {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 30px;
    align-items: center;
}

.index-item {
    position: relative;
    background: none;
    border: 2px solid var(--gray);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.index-item:hover {
    border-color: var(--text-color);
    transform: scale(1.2);
}

.index-item.active {
    background-color: var(--text-color);
    border-color: var(--text-color);
}

.index-item::after {
    content: attr(data-title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-color);
    color: var(--card-bg-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-family-base);
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
}

.index-item:hover::after {
    opacity: 1;
}

.cards-container {
    position: relative;
    width: 100%;
    height: 640px;
    margin-top: 40px;
    margin-bottom: 20px;
    overflow: visible;
}

.cards-stack {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    overflow: visible;
}

.contribution-card {
    position: absolute;
    left: 50%;
    top: 20px;
    width: 80%;
    max-width: 700px;
    height: 550px;
    background-color: var(--card-bg-color);
    border: 1px solid var(--gray);
    padding: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.4s ease, z-index 0s, border-color 0.3s ease;
}

.contribution-card:not(.active) {
    pointer-events: auto;
}

.contribution-card:not(.active) * {
    pointer-events: none;
}

.contribution-card:not(.active)::after {
    content: attr(data-title);
    position: absolute;
    top: 105%;
    right: 10px;
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-family-base);
    font-size: 0.95rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
    z-index: 1000;
}

.contribution-card:not(.active):hover::after {
    opacity: 1;
}

.contribution-card h3 {
    margin-top: 0;
    margin-bottom: 0;
}

.contribution-card p {
    margin-bottom: 16px;
}

.contribution-card span.date {
    font-size: 1rem;
}

.contribution-card span.date::before {
    content: '– ';
    padding-left: 8px;
    padding-right: 5px;
}

.contribution-card .tech-tags {
    font-family: var(--font-family-mono);
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 25px;
}

.contribution-card ul {
    list-style: square;
    padding: 0;
    margin: 0;
    font-size: 1rem;
}

.contribution-card ul::before{
    content: none;
    color: var(--gray);
}

.contribution-card ul.active-example::before{
    content: 'Active examples:';
    color: var(--gray);
}

.contribution-card ul.code::before{
    content: 'Code repos:';
    color: var(--gray);
}

.contribution-card ul li {
    margin-left: 15px;
}

.contribution-card ul li::marker {
    color: var(--gray);
}

.contribution-card ul li a {
    font-size: 1rem;
}

.contribution-card.active {
    z-index: 12;
    transform: translate(calc(-50% - 45px), 0);
}

.contribution-card.stack-position-1 {
    z-index: 11;
    transform: translate(calc(-50% - 20px), 12px);
}

.contribution-card.stack-position-2 {
    z-index: 10;
    transform: translate(calc(-50% + 0px), 22px);
}

.contribution-card.stack-position-3 {
    z-index: 9;
    transform: translate(calc(-50% + 15px), 30px);
}

.contribution-card.stack-position-4 {
    z-index: 8;
    transform: translate(calc(-50% + 30px), 38px);
}

.contribution-card.stack-position-5 {
    z-index: 7;
    transform: translate(calc(-50% + 42px), 46px);
}

.contribution-card.stack-position-6 {
    z-index: 6;
    transform: translate(calc(-50% + 50px), 53px);
}

.contribution-card.stack-position-invisible {
    display: none!important;
}

.card-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 3rem;
    cursor: pointer;
    z-index: 10;
    padding: 20px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.card-nav:hover {
    opacity: 1;
}

.card-nav-left {
    left: 0;
}

.card-nav-right {
    right: 0;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

footer {
    margin-top: 60px;
    padding: 40px 0 20px;
    border-top: 1px solid var(--gray);
    text-align: center;
    color: var(--gray);
    font-size: 1.1rem;
}

.theme-switch {
    position: relative;
    width: 64px;
    height: 34px;
    background-color: var(--gray);
    border-radius: 34px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.theme-switch:hover {
    opacity: 0.8;
}

.switch-circle {
    position: relative;
    top: 4px;
    left: 4px;
    width: 26px;
    height: 26px;
    background-color: var(--text-color);
    background-image: url('images/moon-icon.svg');
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    transition: left 0.3s ease, background-image 0.3s ease;
}

[data-theme="light"] .switch-circle {
    left: 34px;
    background-image: url('images/sun-icon.svg');
}

@media (max-width: 768px) {
    body {
        font-size: 20px;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.6rem;
    }

    nav {
        flex-direction: column;
        padding-top: 0;
    }

    nav ul {
        order: 2;
    }

    nav div.theme-switch {
        margin: 0 auto;
        margin-bottom: 80px;
    }

    nav ul {
        flex-direction: column;
        gap: 12px;
    }
    
    .expertise-category {
        grid-template-columns: repeat(2, 1fr);
    }

    .experience-section {
        display: flex;
        flex-direction: column;
    }

    div.cards-container {
        order: 3;
        margin-top: 15px;
    }
    
    div.contributions-index {
        order: 2;
        margin-top: 15px;
    }

    .contributions-index {
        gap: 12px;
        margin: 15px auto;
    }

    .index-item::after {
        display: none;
    }

    .cards-container {
        height: auto;
    }
    
    .cards-stack {
        padding-top: 10px;
    }
    
    .contribution-card {
        height: auto;
        position: unset;
        width: 90%;
        padding: 30px;
        transform: none!important;
    }

    .contribution-card:not(.active) {
        display: none;
    }

    .card-nav {
        font-size: 2.5rem;
        padding: 0;
    }

    .card-nav-left {
        left: -10px;
    }
    
    .card-nav-right {
        right: -10px;
    }

    .contribution-card span.date {
        display: block;
        margin-bottom: 15px;
    }

    .contribution-card span.date::before {
        content: none;
        padding: 0;
    }
}
