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

:root,
[data-theme="dark"] {
    --bg: #0d0d12;
    --surface: #18181d;
    --surface-hover: #24242b;
    --text: #ededef;
    --text-secondary: #8b8b95;
    --accent: #818cf8;
    --accent-dim: rgba(129, 140, 248, 0.1);
    --border: #2a2a32;
    --radius: 10px;
    --max-width: 680px;
}

[data-theme="light"] {
    --bg: #f2f2f5;
    --surface: #ffffff;
    --surface-hover: #ebebf0;
    --text: #1a1a2e;
    --text-secondary: #6b6b80;
    --accent: #6366f1;
    --accent-dim: rgba(99, 102, 241, 0.08);
    --border: #d4d4dc;
    --radius: 10px;
    --max-width: 680px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: #fff;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    text-align: center;
    padding: 3rem 0 2.5rem;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    margin-bottom: 1.25rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 1.2rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.social-links a:hover,
.social-links a:focus-visible {
    background: var(--accent-dim);
    color: var(--accent);
    transform: translateY(-2px);
}

.social-links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-top: 1rem;
}

.theme-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch .fa-sun {
    font-size: 1rem;
    color: var(--accent);
    transition: color 0.25s;
}

.theme-switch .fa-moon {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: color 0.25s;
}

.theme-switch .slider {
    position: relative;
    width: 44px;
    height: 22px;
    background: var(--border);
    border-radius: 22px;
    transition: background 0.25s;
}

.theme-switch .slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
}

.theme-switch input:checked ~ .fa-sun {
    color: var(--text-secondary);
}

.theme-switch input:checked ~ .fa-moon {
    color: var(--accent);
}

.theme-switch input:checked ~ .slider {
    background: var(--accent);
}

.theme-switch input:checked ~ .slider::before {
    transform: translateX(22px);
    background: #ffffff;
}

.theme-switch input:focus-visible ~ .slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

section p {
    color: var(--text-secondary);
}

section a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

section a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-year {
    flex-shrink: 0;
    width: 140px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.timeline-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.course-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-list li {
    position: relative;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.course-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
}

.course-meta {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.9rem;
}

#publications p {
    margin-bottom: 0.5rem;
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.contact-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.contact-card-header i {
    color: var(--accent);
    font-size: 1rem;
}

.contact-card-header i.fa-key {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--accent);
}

.contact-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.contact-card-body code {
    font-family: 'SF Mono', SFMono-Regular, 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.copy-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.copy-btn:hover,
.copy-btn:focus-visible {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.copy-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.contact-card-footer {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contact-card-footer a {
    color: var(--accent);
    text-decoration: none;
}

.contact-card-footer a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 2.5rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .container {
        padding: 1.25rem 1rem;
    }

    header {
        padding: 2rem 0 1.5rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .avatar {
        width: 80px;
        height: 80px;
    }

    .social-links {
        gap: 0.5rem;
    }

    .social-links a {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
    }

    main {
        gap: 2rem;
    }

    .timeline-item {
        flex-direction: column;
        gap: 0.15rem;
        padding: 0.6rem 0;
    }

    .timeline-year {
        width: auto;
        font-size: 0.85rem;
    }

    .contact-card-body {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-card-body code {
        font-size: 0.8rem;
    }

    .copy-btn {
        align-self: flex-end;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 1rem 0.75rem;
    }

    h1 {
        font-size: 1.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .social-links a {
        transition: none;
    }

    .copy-btn,
    .theme-switch .slider,
    .theme-switch .slider::before,
    .theme-switch .fa-sun,
    .theme-switch .fa-moon {
        transition: none;
    }
}
