:root {
    --bg: #FDF6E3;
    --bg-alt: #EEE8D5;
    --text: #657B83;
    --text-emphasis: #586E75;
    --text-muted: #93A1A1;
    --accent: #268BD2;
    --accent-hover: #2AA198;
    --border: #EEE8D5;
    --border-strong: #93A1A1;

    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --max-width: 720px;
    --content-padding: clamp(1.5rem, 5vw, 4rem);

    --header-height: 56px;
    --tab-height: 44px;
    --footer-height: 40px;
}

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

html {
    font-size: 17px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

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

a:hover {
    color: var(--accent-hover);
}

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

/* ── Header ────────────────────────────────────────────────── */

.site-header {
    height: var(--header-height);
    padding: 0 var(--content-padding);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.header-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-emphasis);
}

.header-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-links {
    display: flex;
    gap: 1rem;
}

.header-links a {
    font-size: 0.825rem;
    color: var(--text);
}

.header-links a:hover {
    color: var(--accent);
}

.btn-cv {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    background: var(--text-emphasis);
    color: var(--bg);
    border: 1px solid var(--text-emphasis);
    transition: all 0.2s ease;
}

.btn-cv:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* ── Tab Bar ───────────────────────────────────────────────── */

.tab-bar {
    height: var(--tab-height);
    padding: 0 var(--content-padding);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-bar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: stretch;
    gap: 0;
}

.tab-btn {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0 1.25rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
    color: var(--accent);
}

.tab-btn.active {
    color: var(--accent);
    font-weight: 500;
    border-bottom-color: var(--accent);
}

/* ── Content Area ──────────────────────────────────────────── */

.content-area {
    flex: 1;
    overflow: hidden;
}

.content-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 0 var(--content-padding);
}

.tab-panel {
    display: none;
    height: 100%;
}

.tab-panel.active {
    display: block;
}

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

/* ── About ─────────────────────────────────────────────────── */

.about-intro {
    margin-bottom: 2.5rem;
}

.intro-lead {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-emphasis);
    margin-bottom: 0.5rem;
}

.intro-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.about-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.block-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-emphasis);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.focus-list {
    list-style: none;
}

.focus-list li {
    padding: 0.4rem 0;
    font-size: 0.95rem;
    color: var(--text);
    border-bottom: 1px dotted var(--border);
}

.focus-list li:last-child {
    border-bottom: none;
}

.edu-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edu-item {
    padding-bottom: 0.75rem;
    border-bottom: 1px dotted var(--border);
}

.edu-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.edu-degree {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-emphasis);
}

.edu-school {
    font-size: 0.95rem;
    color: var(--text);
}

.edu-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Experience ────────────────────────────────────────────── */

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

.exp-card {
    padding: 1.25rem 0;
    border-bottom: 1px dotted var(--border);
    transition: background 0.2s ease;
}

.exp-card:hover {
    background: var(--bg-alt);
}

.exp-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-emphasis);
    margin-bottom: 2px;
}

.exp-company {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.exp-period {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.exp-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.description-list {
    padding-left: 1.2rem;
}

.description-list li + li {
    margin-top: 0.4rem;
}

.exp-collapsed {
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.exp-collapsed-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.exp-collapsed-role {
    font-weight: 500;
    color: var(--text);
}

.exp-collapsed-company {
    color: var(--text-muted);
}

.exp-collapsed-company::before {
    content: "·";
    margin-right: 0.5rem;
}

.exp-collapsed-period {
    margin-left: auto;
    font-size: 0.8rem;
}

/* ── Projects ──────────────────────────────────────────────── */

.projects-grid {
    display: flex;
    flex-direction: column;
}

.project-card {
    padding: 1.25rem 0;
    border-bottom: 1px dotted var(--border);
    transition: background 0.2s ease;
}

.project-card:last-child {
    border-bottom: none;
}

.project-card:hover {
    background: var(--bg-alt);
}

.project-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-emphasis);
    margin-bottom: 0.25rem;
}

.project-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.project-footer {
    display: block;
}

.project-link {
    font-size: 0.85rem;
    color: var(--accent);
}

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

/* ── Research ──────────────────────────────────────────────── */

.writing-list {
    display: flex;
    flex-direction: column;
}

.writing-card {
    padding: 1.25rem 0;
    border-bottom: 1px dotted var(--border);
    transition: background 0.2s ease;
}

.writing-card:last-child {
    border-bottom: none;
}

.writing-card:hover {
    background: var(--bg-alt);
}

.writing-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-emphasis);
    margin-bottom: 0.25rem;
}

.writing-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.writing-link {
    font-size: 0.85rem;
    color: var(--accent);
}

.writing-link:hover {
    color: var(--accent-hover);
}

/* ── Footer ────────────────────────────────────────────────── */

.site-footer {
    height: var(--footer-height);
    padding: 0 var(--content-padding);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────────────── */

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

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 0.15rem;
    }

    .site-header {
        height: auto;
        padding: 0.6rem var(--content-padding);
    }

    .header-right {
        gap: 1rem;
    }

    .header-links {
        gap: 0.75rem;
    }

    .tab-btn {
        padding: 0 0.75rem;
        font-size: 0.825rem;
    }

    .about-details {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .header-links {
        display: none;
    }

    .tab-btn {
        padding: 0 0.5rem;
        font-size: 0.8rem;
    }

    .intro-lead {
        font-size: 1.25rem;
    }
}

/* ── Reduced Motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ── Print ─────────────────────────────────────────────────── */

@media print {
    body {
        height: auto;
        overflow: visible;
        background: #fff;
        color: #000;
    }

    .site-header, .tab-bar, .site-footer {
        display: none !important;
    }

    .content-area {
        overflow: visible;
    }

    .content-scroll {
        overflow: visible;
    }

    .tab-panel {
        display: block !important;
    }
}
