@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Newsreader:opsz,wght@6..72,400;6..72,500&display=swap');

:root {
    --paper: #FBFAF7;
    --ink: #1B1B18;
    --muted: #6F6A5F;
    --line: rgba(27, 27, 24, 0.16);
    --accent: #1E5C44;
    --accent-contrast: #FBFAF7;
    --soft: #F1EDE4;
    --serif: 'Newsreader', Georgia, serif;
    --sans: 'Inter', system-ui, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

html[data-theme="dark"] {
    --paper: #161813;
    --ink: #EDEAE2;
    --muted: #9C978B;
    --line: rgba(237, 234, 226, 0.16);
    --accent: #8FC4A8;
    --accent-contrast: #161813;
    --soft: #20231D;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

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

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 56px 28px 40px;
}

/* Hero */
.hero {
    position: relative;
    padding-bottom: 48px;
}

.toprow {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    user-select: none;
}

.theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.toggle-track {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--soft);
    border: 1px solid var(--line);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.theme-toggle input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.theme-toggle input:checked + .toggle-track::after {
    transform: translateX(14px);
    background: var(--accent-contrast);
}

.theme-toggle input:focus-visible + .toggle-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.name {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(44px, 8vw, 60px);
    line-height: 1.02;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.role {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 22px;
}

.bio {
    font-size: 17px;
    max-width: 60ch;
    margin-bottom: 10px;
}

.seeking {
    font-size: 16px;
    margin-bottom: 28px;
}

.seeking em {
    font-style: normal;
    color: var(--accent);
    font-weight: 500;
}

.ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    align-items: center;
}

.btn {
    display: inline-block;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 9px 18px;
    font-size: 14.5px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: var(--accent);
    color: var(--accent-contrast);
    text-decoration: none;
}

.link {
    font-size: 15px;
}

/* Sections */
.sec {
    border-top: 1px solid var(--line);
    padding: 44px 0;
}

/* Work */
.work {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 36px;
    align-items: center;
}

.work + .work {
    margin-top: 40px;
}

.work.lead {
    grid-template-columns: 1fr;
}

.work-name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 27px;
    line-height: 1.15;
    margin-bottom: 4px;
}

.idx {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    display: block;
    margin-bottom: 3px;
}

.work-sub {
    font-size: 14.5px;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 12px;
}

.work-desc {
    font-size: 15px;
    max-width: 54ch;
    margin-bottom: 12px;
}

.work-metrics {
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 14px;
}

.work-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 14px;
}

.work-visual {
    border: 1px solid var(--line);
    background: var(--soft);
}

.work-visual img {
    display: block;
    width: 100%;
    height: auto;
}

.work-visual svg {
    display: block;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    padding: 16px;
}

.work-visual > img {
    cursor: zoom-in;
}

.work-visual > svg {
    cursor: zoom-in;
}

.table-visual {
    padding: 6px 14px 0;
}

/* Compare slider */
.sim {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.sim img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sim-fg {
    position: absolute;
    inset: 0;
    clip-path: inset(0 50% 0 0);
}

.sim-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--line);
}

.sim-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--paper);
    border: 1px solid var(--line);
}

.sim-range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
}

/* Quiet table */
.quiet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.quiet-table th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 14px 8px 0;
}

.quiet-table td {
    padding: 9px 14px 9px 0;
    border-top: 1px solid var(--line);
}

.quiet-table th.num,
.quiet-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.quiet-table .accent-row td {
    border-top: 1px solid var(--accent);
}

.visual-note {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 16px 12px;
}

.visual-note a {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

.visual-note.note-center {
    text-align: center;
}

/* Experience */
.exp-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 24px;
}

.exp-row + .exp-row {
    margin-top: 26px;
}

.exp-date {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.02em;
    color: var(--muted);
    padding-top: 2px;
}

.exp-org {
    font-size: 16px;
    font-weight: 500;
}

.exp-role {
    font-size: 14px;
    color: var(--muted);
    margin: 1px 0 6px;
}

.exp-line {
    font-size: 14.5px;
    max-width: 56ch;
}

/* Education (quiet confirmation block) */
.edu-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 34px 0 20px;
}

.edu-line {
    font-size: 14px;
    color: var(--ink);
    line-height: 1.65;
}

.edu-line + .edu-line {
    margin-top: 5px;
}

.edu-accent {
    color: var(--accent);
    font-weight: 500;
}

/* Writing */
.post-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 25px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.post-date {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}

.post-desc {
    font-size: 15px;
    max-width: 56ch;
    margin-bottom: 14px;
}

.post-link a {
    font-size: 15px;
}

/* Footer */
.foot {
    border-top: 1px solid var(--line);
    padding-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    font-size: 13.5px;
    color: var(--muted);
}

.foot a {
    color: var(--muted);
}

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

/* Post modal */
.post-modal {
    position: fixed;
    inset: 0;
    background: rgba(27, 27, 24, 0.55);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.post-modal[hidden] {
    display: none;
}

.post-modal-box {
    position: relative;
    background: var(--paper);
    max-width: 760px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 44px 48px 48px;
}

.post-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.post-close:hover {
    color: var(--ink);
}

.post-header h2 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 30px;
    line-height: 1.15;
    margin-bottom: 4px;
}

.post-header time {
    font-size: 13px;
    color: var(--muted);
}

.post-body {
    margin-top: 22px;
    font-size: 15.5px;
}

.post-body h2,
.post-body h3 {
    font-family: var(--serif);
    font-weight: 500;
    margin: 28px 0 8px;
}

.post-body p {
    margin-bottom: 14px;
}

.post-body ul,
.post-body ol {
    margin: 0 0 14px 22px;
}

.post-body code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.9em;
    background: var(--soft);
    padding: 1px 5px;
}

.post-body pre {
    background: var(--soft);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 14px;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 14px;
}

.table-wrap table {
    border-collapse: collapse;
    font-size: 13.5px;
    width: 100%;
}

.table-wrap th,
.table-wrap td {
    border: 1px solid var(--line);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}

.post-figure-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0;
}

.post-figure-grid img {
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
}

.post-pdf-embed {
    width: 100%;
    height: 560px;
    border: 1px solid var(--line);
    margin: 14px 0;
}

.post-error {
    color: #9a3b2e;
}

body.modal-open {
    overflow: hidden;
}

/* Image lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(22, 22, 20, 0.9);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    cursor: zoom-out;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: var(--paper);
}

.lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
}

.lightbox-content svg {
    width: min(90vw, 780px);
    height: auto;
    max-height: 88vh;
    flex-shrink: 0;
    background: var(--paper);
}

/* Focus */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .wrap {
        padding: 36px 20px 32px;
    }

    .work {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .exp-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .post-modal-box {
        padding: 36px 22px 40px;
    }

    .post-figure-grid {
        grid-template-columns: 1fr;
    }
}

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

    .btn {
        transition: none;
    }

    body,
    .toggle-track,
    .toggle-track::after {
        transition: none;
    }
}
