/* ===========================
   Base & Variables
   =========================== */

:root {
    --text: #1a1a1a;
    --text-secondary: #555;
    --text-tertiary: #888;
    --bg: #fafaf8;
    --border: #d4d0c8;
    --accent: #1a1a1a;
    --toggle-bg: #c8c4bc;
    --toggle-ball: #fafaf8;
    --font-serif: 'EB Garamond', Georgia, serif;
    --font-sans: 'Karla', 'Helvetica Neue', sans-serif;
    --max-width: 720px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --text: #e0ddd8;
        --text-secondary: #a09a90;
        --text-tertiary: #706b63;
        --bg: #161614;
        --border: #2e2d2a;
        --accent: #e0ddd8;
        --toggle-bg: #3a3935;
        --toggle-ball: #e0ddd8;
    }
}

:root[data-theme="dark"] {
    --text: #e0ddd8;
    --text-secondary: #a09a90;
    --text-tertiary: #706b63;
    --bg: #161614;
    --border: #2e2d2a;
    --accent: #e0ddd8;
    --toggle-bg: #3a3935;
    --toggle-ball: #e0ddd8;
}

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

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.7;
    transition: color 0.2s ease, background-color 0.2s ease;
}

::selection {
    background: var(--text);
    color: var(--bg);
}

/* ===========================
   Layout
   =========================== */

header, main, footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* ===========================
   Navigation
   =========================== */

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.wordmark {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--text);
}

/* ===========================
   Theme Toggle
   =========================== */

.theme-toggle {
    appearance: none;
    border: none;
    background: var(--toggle-bg);
    width: 36px;
    height: 20px;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.theme-toggle-ball {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 7px;
    background: var(--toggle-ball);
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle-ball {
        transform: translateX(16px);
    }
}

:root[data-theme="dark"] .theme-toggle-ball {
    transform: translateX(16px);
}

/* ===========================
   Introduction
   =========================== */

.intro {
    padding: 5rem 0 4rem;
}

.intro h1 {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

.lead {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 540px;
}

/* ===========================
   Horizontal rules
   =========================== */

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ===========================
   Sections
   =========================== */

section {
    padding: 3.5rem 0;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-tertiary);
    margin-bottom: 2rem;
}

.section-content p {
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.section-content h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.section-content h3:first-child {
    margin-top: 0;
}

/* ===========================
   Timeline entries (edu/exp)
   =========================== */

.entry {
    margin-bottom: 1.75rem;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.entry-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.entry-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.entry-org {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.entry-detail {
    font-size: 0.9rem;
    margin-top: 0.4rem;
    color: var(--text-secondary);
}

/* ===========================
   Skills
   =========================== */

.skills {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===========================
   Projects
   =========================== */

.project {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.project:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.project-header h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
}

.project-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
}

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

.project-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.project p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 0.75rem;
}

.project-tech {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ===========================
   Contact
   =========================== */

.contact-list {
    list-style: none;
    margin-top: 1rem;
}

.contact-list li {
    margin-bottom: 0.5rem;
}

.contact-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: border-color 0.15s ease;
}

.contact-list a:hover {
    border-color: var(--text);
}

/* ===========================
   Footer
   =========================== */

footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
}

footer p {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .intro {
        padding: 3.5rem 0 3rem;
    }

    .intro h1 {
        font-size: 2.2rem;
    }

    nav ul {
        gap: 1.25rem;
    }

    .entry-header {
        flex-direction: column;
        gap: 0.1rem;
    }

    .project-header {
        flex-direction: column;
        gap: 0.25rem;
    }
}
