@import url('https://cdn.jsdelivr.net/npm/geist@1.4.2/dist/fonts/geist-sans/variable.css');

:root {
    --font-body: 'Geist Sans', sans-serif;
    --font-heading: 'Source Serif 4', serif;
    --font-mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
    --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
    --bg: #fbfaf7;
    --text: #101010;
    --muted: #5a5a5a;
    --line: rgba(16, 16, 16, 0.14);
    --line-strong: rgba(16, 16, 16, 0.24);
    --header-bg: rgba(251, 250, 247, 0.84);
    --header-bg-strong: rgba(251, 250, 247, 0.96);
    --panel-bg: rgba(16, 16, 16, 0.05);
    --max-width: 46rem;
    --space-1: 0.4rem;
    --space-2: 0.7rem;
    --space-3: 1rem;
    --space-4: 1.4rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --space-7: clamp(4rem, 10vw, 7rem);
    --hero-portrait-width: clamp(6.1rem, 16vw, 10.75rem);
    --hero-head-gap: clamp(0.8rem, 2.4vw, 2rem);
}

@property --hover-progress {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}

html[data-theme='dark'] {
    color-scheme: dark;
    --bg: #11110f;
    --text: #f4f0e8;
    --muted: #bbb3a8;
    --line: rgba(244, 240, 232, 0.14);
    --line-strong: rgba(244, 240, 232, 0.28);
    --header-bg: rgba(17, 17, 15, 0.84);
    --header-bg-strong: rgba(17, 17, 15, 0.96);
    --panel-bg: rgba(244, 240, 232, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 4.75rem;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.shell {
    width: min(var(--max-width), calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    transition: background-color 180ms ease, border-color 180ms ease;
}

.site-header.is-scrolled {
    border-bottom: 1px solid var(--line);
    background: var(--header-bg-strong);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: 1.1rem 0 0.85rem;
}

.site-brand,
.site-nav {
    font-size: 0.95rem;
}

.site-brand {
    font-weight: 600;
    text-decoration: none;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-left: auto;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color 160ms ease;
}

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

.site-header__tools {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: 1.1rem;
}

.site-mode-toggle,
.site-batch-toggle {
    flex-shrink: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    cursor: pointer;
    transition: color 180ms ease, transform 180ms ease;
}

.site-mode-toggle:hover,
.site-batch-toggle:hover {
    color: var(--text);
    transform: translateX(-0.12rem);
}

.site-mode-toggle:focus-visible,
.site-batch-toggle:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 0.3rem;
}

.progress-rail {
    position: fixed;
    top: 50%;
    right: max(0.15rem, env(safe-area-inset-right));
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transform: translateY(-50%);
}

.progress-rail__track {
    position: relative;
    width: 1px;
    height: 10rem;
    background: var(--line);
}

.progress-rail__fill {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--text);
    transform: scaleY(0);
    transform-origin: top;
}

.progress-rail__nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 7.5rem;
}

.progress-rail__dot {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    cursor: pointer;
    transition: color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.progress-rail__index {
    display: inline-block;
    width: 2.4rem;
    flex: 0 0 2.4rem;
}

.progress-rail__label {
    display: inline-block;
    width: 4.6rem;
    margin-left: 0.45rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-0.2rem);
    transition: opacity 180ms ease, transform 260ms var(--ease-soft);
}

.progress-rail__dot:hover,
.progress-rail__dot.is-active {
    color: var(--text);
    transform: translateX(-0.18rem);
}

.progress-rail__dot.is-active .progress-rail__label {
    opacity: 1;
    transform: translateX(0);
}

.hero {
    min-height: calc(100svh - 4.25rem);
    display: flex;
    align-items: center;
    transition: min-height 620ms var(--ease-soft);
}

.hero__inner {
    padding: var(--space-7) 0 var(--space-6);
    transition: padding-bottom 620ms var(--ease-soft);
}

.hero-head,
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.hero-head__main,
.section-head__main {
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
}

.hero-head {
    display: grid;
    grid-template-columns: var(--hero-portrait-width) minmax(0, 1fr) auto;
    grid-template-areas:
        "index index toggle"
        "portrait main toggle";
    column-gap: var(--hero-head-gap);
    row-gap: 0.45rem;
    align-items: start;
}

.hero-head__main {
    grid-area: main;
    min-width: 0;
    max-width: none;
}

.hero-index {
    grid-area: index;
}

.eyebrow,
.writing-type,
.post-type {
    display: block;
    margin: 0 0 var(--space-2);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-index,
.row-index {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.hero h1,
.section-head h2,
.post-title,
.post-body h2,
.post-body h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.03em;
}

.hero h1,
.post-title {
    max-width: 9ch;
    font-size: clamp(2.35rem, 7vw, 4.85rem);
    line-height: 0.92;
}

.hero-copy,
.copy-block p,
.row-meta,
.writing-preview,
.contact-copy,
.post-deck,
.post-body p,
.post-body li {
    color: var(--muted);
    line-height: 1.72;
}

.hero-copy {
    max-width: 39rem;
    margin: 0;
    font-size: 1.16rem;
}

.hero-copy--update {
    margin-top: 0.9rem;
    color: var(--text);
}

.hero-body {
    display: block;
}

.hero-copy-group {
    min-width: 0;
    max-width: 39rem;
}

.hero-links {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    margin-top: 1.55rem;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.hero-contact {
    margin: 0;
    color: var(--text);
}

.hero-links__secondary {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.hero-portrait {
    grid-area: portrait;
    margin: 0;
    width: 100%;
    max-width: var(--hero-portrait-width);
    justify-self: start;
    align-self: start;
    aspect-ratio: 5 / 6;
    overflow: hidden;
    border-radius: 1rem;
    background: var(--panel-bg);
    box-shadow:
        0 0 0 1px var(--line),
        0 1.1rem 2.5rem rgba(16, 16, 16, 0.12);
}

.hero-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.section-toggle {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border: 0;
    padding: 0.15rem 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    cursor: pointer;
    transition: color 180ms ease, transform 180ms ease;
}

.hero-head .section-toggle {
    grid-area: toggle;
    justify-self: end;
    align-self: start;
}

.section-toggle:hover {
    color: var(--text);
    transform: translateX(-0.12rem);
}

.section-toggle:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 0.3rem;
}

.hero-links a,
.row-links a,
.contact-copy a,
.back-link {
    text-decoration: underline;
}

.hero-links a,
.row-links a {
    transition: opacity 160ms ease, transform 160ms ease;
}

.hero-links a:hover,
.row-links a:hover {
    opacity: 0.62;
    transform: translateX(0.18rem);
}

.section {
    min-height: calc(100svh - 4.25rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-6) 0;
    border-top: 1px solid var(--line);
    transition:
        padding 520ms var(--ease-soft),
        min-height 520ms var(--ease-soft);
}

.section-contact {
    padding-bottom: var(--space-7);
}

#research.section,
#publications.section,
#writing.section {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 2.35rem;
    padding-bottom: 2.25rem;
}

#connect.section-contact {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 2.2rem;
    padding-bottom: 2.85rem;
}

.section-head {
    margin-bottom: 1.15rem;
}

.section-head h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
}

.section-panel {
    overflow: hidden;
    contain: layout paint;
    backface-visibility: hidden;
    will-change: height;
    transform: translateZ(0);
    transition: height 620ms var(--ease-soft);
}

.section-panel--hero {
    margin-top: 1.1rem;
    transition:
        height 700ms var(--ease-soft),
        margin-top 620ms var(--ease-soft);
}

.section-block.is-collapsed {
    min-height: 0;
}

.hero.section-block.is-collapsed .hero__inner {
    padding-top: var(--space-7);
    padding-bottom: 1.8rem;
}

.section.section-block.is-collapsed {
    padding: 1.45rem 0;
}

.section.section-block.is-collapsed .section-head {
    margin-bottom: 0;
}

.section-block.is-collapsed .section-panel--hero {
    margin-top: 0;
}

.copy-block {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 39rem;
}

.copy-block p,
.contact-copy,
.post-body p,
.post-body ul,
.post-body ol {
    margin: 0;
    font-size: 1.02rem;
}

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

.row-item,
.writing-row {
    position: relative;
    scroll-margin-top: 5rem;
}

.row-item {
    padding: 1rem 0 1.05rem;
    border-bottom: 1px solid var(--line);
    transition: border-color 220ms ease, background-color 220ms ease;
}

.row-item::before {
    content: "";
    position: absolute;
    inset: 0.22rem 0.9rem 0.28rem 0.8rem;
    border-radius: 0.9rem;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(16, 16, 16, 0.018) 10%,
        rgba(16, 16, 16, 0.05) 24%,
        rgba(16, 16, 16, 0.038) 42%,
        rgba(16, 16, 16, 0.016) 62%,
        transparent 82%
    );
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
}

html[data-theme='dark'] .row-item::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(244, 240, 232, 0.022) 10%,
        rgba(244, 240, 232, 0.072) 24%,
        rgba(244, 240, 232, 0.052) 42%,
        rgba(244, 240, 232, 0.022) 62%,
        transparent 82%
    );
}

.row-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(var(--text), var(--text)) left top / 0% 1px no-repeat,
        linear-gradient(var(--text), var(--text)) left bottom / 0% 1px no-repeat;
    opacity: 0;
    pointer-events: none;
}

.row-item:first-child {
    border-top: 1px solid var(--line);
}

.row-item h3,
.writing-title {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.42;
}

.row-meta {
    margin: 0.28rem 0 0;
}

.row-index {
    margin-bottom: 0.5rem;
}

.row-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.65rem;
    text-transform: lowercase;
}

.row-preview,
.writing-preview {
    max-width: 37rem;
    margin: 0 0 0;
    color: var(--muted);
    line-height: 1.68;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    will-change: max-height, opacity, transform;
    transform: translateY(0.45rem);
    transition:
        opacity 320ms ease,
        max-height 560ms var(--ease-soft),
        margin-top 420ms var(--ease-soft),
        transform 420ms var(--ease-soft);
}

.row-item.is-preview-visible .row-preview,
.writing-row.is-preview-visible .writing-preview {
    opacity: 1;
    max-height: 10rem;
    margin-top: 0.72rem;
    transform: translateY(0);
}

.hover-indicator {
    position: absolute;
    top: 1rem;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    opacity: 0;
    transform: translateY(-0.2rem);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.hover-indicator::before {
    content: "[hold]";
}

.hover-indicator::after {
    content: "";
    width: 0.68rem;
    height: 0.68rem;
    border: 1px solid var(--line-strong);
    border-top-color: var(--text);
    border-radius: 999px;
    animation: hover-indicator-spin 900ms linear infinite;
}

.preview-cursor {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    width: 1.5rem;
    height: 1.5rem;
    --hover-progress: 0%;
    border-radius: 999px;
    background:
        radial-gradient(circle at center, var(--bg) 0 31%, transparent 34%),
        conic-gradient(var(--text) var(--hover-progress), var(--line-strong) 0);
    box-shadow:
        0 0 0 0.26rem var(--bg),
        0 0 0 1px var(--line-strong),
        0 0.6rem 1.5rem rgba(16, 16, 16, 0.14);
    pointer-events: none;
    opacity: 0;
    will-change: transform, opacity;
    transform: translate3d(-999px, -999px, 0) translate(-50%, -50%) scale(0.9);
    transition: opacity 160ms ease;
}

.preview-cursor.is-visible {
    opacity: 1;
}

.preview-cursor.is-loading {
    animation: hover-orb-fill 1.5s linear forwards, hover-orb-glow 920ms ease-in-out infinite;
}

.row-item.is-hover-pending,
.row-item.is-preview-visible,
.writing-row.is-hover-pending,
.writing-row.is-preview-visible {
    border-color: var(--line-strong);
}

.row-item.is-hover-pending::before {
    opacity: 1;
}

.row-item.is-hover-pending,
.writing-row.is-hover-pending {
    cursor: none;
}

.row-item.is-hover-pending .hover-indicator,
.writing-row.is-hover-pending .hover-indicator {
    opacity: 1;
    transform: translateY(0);
}

.writing-row {
    display: block;
    padding: 0.9rem 0 0.95rem;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease, background-color 220ms ease;
}

.writing-row:first-child {
    border-top: 1px solid var(--line);
}

.writing-row:hover {
    opacity: 0.72;
    transform: translateX(0.28rem);
    border-color: var(--line-strong);
}

.writing-title {
    display: block;
}

.row-item.is-paper-highlighted::after {
    animation: paper-line-scan 1800ms var(--ease-soft);
}

.writing-empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.72;
}

.contact-copy {
    max-width: 38rem;
}

.site-footer__inner {
    padding: 0 0 2rem;
}

.site-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.post-shell {
    padding: var(--space-6) 0 var(--space-7);
}

.back-link {
    display: inline-block;
    margin-bottom: var(--space-5);
}

.post-header {
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--line);
}

.post-deck {
    max-width: 38rem;
    margin: 1rem 0 0;
}

.post-body {
    padding-top: var(--space-5);
}

.post-body h2,
.post-body h3 {
    margin-top: 2rem;
    margin-bottom: 0.55rem;
    line-height: 1.08;
}

.post-body h2 {
    font-size: 2rem;
}

.post-body h3 {
    font-size: 1.28rem;
}

.post-body p + p,
.post-body p + ul,
.post-body p + ol,
.post-body ul + p,
.post-body ol + p,
.post-body h2 + p,
.post-body h3 + p {
    margin-top: 0.9rem;
}

.post-body ul,
.post-body ol {
    padding-left: 1.3rem;
}

.post-body hr {
    margin: 1.7rem 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.post-body code {
    padding: 0.1rem 0.3rem;
    border-radius: 0.3rem;
    background: var(--panel-bg);
    font-size: 0.92em;
}

.post-body pre {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 0.75rem;
    background: var(--panel-bg);
}

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

html.has-reveal [data-reveal] {
    opacity: 0;
    transform: translateY(1rem);
    transition:
        opacity 560ms ease var(--reveal-delay, 0ms),
        transform 560ms ease var(--reveal-delay, 0ms);
}

html.has-reveal [data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes hover-orb-fill {
    to {
        --hover-progress: 100%;
    }
}

@keyframes hover-orb-glow {
    0%,
    100% {
        box-shadow:
            0 0 0 0.26rem var(--bg),
            0 0 0 1px var(--line-strong),
            0 0.6rem 1.5rem rgba(16, 16, 16, 0.14);
    }

    50% {
        box-shadow:
            0 0 0 0.36rem var(--bg),
            0 0 0 1px var(--line-strong),
            0 0.85rem 2rem rgba(16, 16, 16, 0.2);
    }
}

@keyframes hover-indicator-spin {
    to {
        transform: rotate(1turn);
    }
}

@keyframes paper-line-scan {
    0% {
        opacity: 0;
        background-position: left top, left bottom;
        background-size: 0% 1px, 0% 1px;
    }

    14% {
        opacity: 1;
        background-position: left top, left bottom;
        background-size: 100% 1px, 100% 1px;
    }

    62% {
        opacity: 1;
        background-position: left top, left bottom;
        background-size: 100% 1px, 100% 1px;
    }

    100% {
        opacity: 0;
        background-position: right top, right bottom;
        background-size: 0% 1px, 0% 1px;
    }
}

@media (hover: none) {
    .hover-indicator {
        display: none;
    }

    .row-preview,
    .writing-preview {
        opacity: 1;
        max-height: none;
        overflow: visible;
        transform: none;
    }
}

@media (max-width: 900px) {
    .progress-rail {
        display: none;
    }

    .hero-head {
        grid-template-columns: clamp(4.8rem, 16vw, 7rem) minmax(0, 1fr) auto;
        column-gap: 0.9rem;
    }

    .hero h1 {
        max-width: 8.25ch;
        font-size: clamp(2.2rem, 6.4vw, 3.6rem);
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(var(--max-width), calc(100% - 1.25rem));
    }

    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.7rem;
    }

    .site-nav {
        gap: 0.8rem;
        margin-left: 0;
    }

    .hero {
        min-height: auto;
    }

    .hero-head,
    .section-head {
        align-items: flex-start;
    }

    .hero-head {
        grid-template-columns: clamp(4.35rem, 20vw, 5.75rem) minmax(0, 1fr) auto;
        column-gap: 0.7rem;
        row-gap: 0.35rem;
    }

    .hero-head__main {
        align-self: end;
    }

    .hero h1 {
        max-width: 7.8ch;
        font-size: clamp(1.9rem, 7.8vw, 2.65rem);
        line-height: 0.94;
    }

    .hero-portrait {
        justify-self: start;
        max-width: none;
    }

    .section-toggle {
        align-self: start;
    }

    .hero-copy-group {
        max-width: 39rem;
    }

    .hero__inner,
    .post-shell,
    .section {
        min-height: auto;
        justify-content: flex-start;
    }

    .hero__inner,
    .post-shell {
        padding-top: 3rem;
    }

    .section-toggle {
        margin-top: -0.1rem;
    }

    .site-header__tools {
        margin-left: 0;
    }
}

@media (max-width: 460px) {
    .hero-head {
        grid-template-columns: clamp(4rem, 24vw, 5.1rem) minmax(0, 1fr) auto;
        column-gap: 0.55rem;
    }

    .hero h1 {
        max-width: 7.2ch;
        font-size: clamp(1.72rem, 7.9vw, 2.25rem);
    }

    .hero-copy {
        font-size: 1.04rem;
    }

    .hero-links {
        gap: 0.95rem;
        margin-top: 1.2rem;
        font-size: 1rem;
    }
}

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

    *,
    *::before,
    *::after {
        transition: none !important;
    }

    html.has-reveal [data-reveal] {
        opacity: 1;
        transform: none;
    }

}
