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

:root {
    --bg: #faf8f5;
    --text: #1a1816;
    --muted: #6b6560;
    --accent: #b5651d;
    --border: #e8e3dc;
    --font-serif: 'Lora', Georgia, serif;
    --font-sans: system-ui, -apple-system, sans-serif;
    --syntax-comment: #756d65;
    --syntax-keyword: #9c3d10;
    --syntax-string: #647a16;
    --syntax-number: #8c4f9f;
    --syntax-title: #1d6c8c;
    --syntax-variable: #9a6700;
    --syntax-meta: #6f42c1;
}

@view-transition {
    navigation: auto;
}

[data-theme="dark"] {
    --bg: #181614;
    --text: #ede9e3;
    --muted: #938e88;
    --accent: #c98240;
    --border: #2e2a26;
    --syntax-comment: #9b948d;
    --syntax-keyword: #ff8f70;
    --syntax-string: #b8cc72;
    --syntax-number: #d6a0e8;
    --syntax-title: #78c7e8;
    --syntax-variable: #e8bd68;
    --syntax-meta: #c6a0f6;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    padding: 4rem 1.5rem 6rem;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 180ms;
    animation-timing-function: ease-out;
}

::view-transition-old(root) {
    animation-name: page-fade-out;
}

::view-transition-new(root) {
    animation-name: page-fade-in;
}

@keyframes page-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-0.25rem);
    }
}

@keyframes page-fade-in {
    from {
        opacity: 0;
        transform: translateY(0.25rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 660px;
    margin: 0 auto;
}

/* Hero */
.hero {
    margin-bottom: 4rem;
}

.hero-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.hero-name-row h1 {
    margin-bottom: 0;
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.hero .title {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.hero .pitch {
    font-size: 1.05rem;
    line-height: 1.65;
    max-width: 540px;
    margin-bottom: 1.75rem;
}

.links,
.project-links,
.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.links {
    gap: 0.5rem 1.25rem;
}

.links a,
.contact-row a,
.project-links a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

.links a:hover,
.contact-row a:hover,
.project-links a:hover {
    border-bottom-color: var(--accent);
}

.links a { font-size: 0.9rem; }
.contact-row a { font-size: 0.97rem; }

/* Sections */
section {
    margin-bottom: 3.5rem;
}

section h2 {
    font-family: var(--font-serif);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

/* Experience */
.job {
    margin-bottom: 0.25rem;
}

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

.job-company,
.project-name {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
}

.job-dates,
.project-status {
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.job-roles {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.job-role-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.job-role {
    font-style: italic;
    color: var(--muted);
    font-size: 0.95rem;
}

.job-desc,
.project-desc {
    font-size: 0.97rem;
    line-height: 1.7;
}

.tags {
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.tag {
    font-size: 0.78rem;
    color: var(--muted);
    background: var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-family: var(--font-sans);
}

/* Education */
.edu-item {
    margin-bottom: 1rem;
}

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

.edu-degree {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
}

.edu-detail {
    font-size: 0.9rem;
    color: var(--muted);
}

/* Personal */
.personal-text {
    font-size: 0.97rem;
    line-height: 1.7;
}

/* Projects */
.project-list {
    display: grid;
    gap: 1.2rem;
}

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

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

.project-header {
    gap: 0.35rem 1rem;
    margin-bottom: 0.35rem;
}

.project-name {
    font-size: 1.12rem;
}

.project-status {
    font-size: 0.82rem;
}

.project-desc {
    margin-bottom: 0.85rem;
}

.project-links {
    gap: 0.45rem 1rem;
    margin-bottom: 0.85rem;
}

.project-links a {
    font-size: 0.9rem;
}

.project .tags {
    margin-top: 0;
}

/* Blog */
.blog-list {
    display: grid;
    gap: 1.75rem;
}

.blog-list-item {
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
}

.blog-list-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.blog-list-item time,
.blog-post-date {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.blog-list-item h2 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.35;
    margin-bottom: 0.4rem;
}

.blog-list-item h2 a,
.blog-site-name,
.blog-post a {
    color: var(--accent);
    text-decoration: none;
}

.blog-list-item h2 a:hover,
.blog-site-name:hover,
.blog-post a:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.blog-list-item p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

.blog-site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 3.5rem;
    border-bottom: 1px solid var(--border);
}

.blog-site-name {
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
}

.blog-site-header .links {
    justify-content: flex-end;
}

.blog-post-date {
    margin-bottom: 0.6rem;
}

.blog-post h1,
.blog-post h2,
.blog-post h3 {
    font-family: var(--font-serif);
    line-height: 1.3;
}

.blog-post h1 {
    font-size: clamp(2rem, 7vw, 2.75rem);
    letter-spacing: -0.015em;
    margin-bottom: 1.75rem;
}

.blog-post h2 {
    font-size: 1.45rem;
    margin: 2.75rem 0 0.8rem;
}

.blog-post h3 {
    font-size: 1.15rem;
    margin: 2rem 0 0.7rem;
}

.blog-post p,
.blog-post ul,
.blog-post ol,
.blog-post blockquote,
.blog-post pre,
.blog-post table {
    margin-bottom: 1.25rem;
}

.blog-post ul,
.blog-post ol {
    padding-left: 1.5rem;
}

.blog-post li + li {
    margin-top: 0.3rem;
}

.blog-post blockquote {
    color: var(--muted);
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    font-family: var(--font-serif);
    font-style: italic;
}

.blog-post blockquote p:last-child {
    margin-bottom: 0;
}

.blog-post code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.88em;
    background: var(--border);
    border-radius: 3px;
    padding: 0.12em 0.3em;
}

.blog-post pre {
    overflow-x: auto;
    background: var(--border);
    border-radius: 5px;
    padding: 1rem;
    line-height: 1.55;
}

.blog-post pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
}

.hljs-comment,
.hljs-quote {
    color: var(--syntax-comment);
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-name,
.hljs-tag {
    color: var(--syntax-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute {
    color: var(--syntax-string);
}

.hljs-number,
.hljs-literal {
    color: var(--syntax-number);
}

.hljs-title,
.hljs-section,
.hljs-selector-id,
.hljs-selector-class,
.hljs-type {
    color: var(--syntax-title);
}

.hljs-variable,
.hljs-template-variable,
.hljs-params,
.hljs-property,
.hljs-attr {
    color: var(--syntax-variable);
}

.hljs-meta,
.hljs-symbol,
.hljs-bullet,
.hljs-link {
    color: var(--syntax-meta);
}

.hljs-deletion {
    color: var(--syntax-keyword);
}

.hljs-emphasis {
    font-style: italic;
}

.hljs-strong {
    font-weight: 700;
}

.blog-post img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.75rem auto;
    border-radius: 5px;
}

.blog-post table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.blog-post th,
.blog-post td {
    text-align: left;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
}

.blog-post th {
    font-weight: 600;
}

.blog-post hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* Contact */
.contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
#share-btn,
#theme-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    padding: 0.35rem 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

#share-btn:hover,
#theme-btn:hover {
    border-color: var(--muted);
    color: var(--text);
}

#theme-btn {
    font-size: 1rem;
    padding: 0.25rem 0.55rem;
    line-height: 1;
    flex-shrink: 0;
    align-self: center;
}

@media (max-width: 480px) {
    body {
        padding: 2.5rem 1.25rem 4rem;
    }

    .job-header {
        flex-direction: column;
        gap: 0;
    }

    .blog-site-header {
        align-items: flex-start;
    }

    .blog-site-header .links {
        gap: 0.5rem 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }
}
