:root {
    color-scheme: light dark;
    --background: #fafafa;
    --surface: #ffffff;
    --surface-soft: #f5f5f5;
    --heading: #111111;
    --text: #2e2e2e;
    --muted: #6e6e6e;
    --hairline: rgba(17, 17, 17, 0.1);
    --menu-surface: rgba(255, 255, 255, 0.88);
    --menu-open-surface: rgba(244, 244, 244, 0.94);
    --menu-link: #555555;
    --menu-link-hover: #333333;
    --menu-link-active: #111111;
    --menu-trigger: #333333;
    --shadow-soft: 0 8px 36px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-menu: 0 8px 36px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-menu-open: 0 14px 60px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.05);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    min-width: 320px;
    background: var(--background);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    font-size: 16px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--heading);
    color: var(--background);
}

a {
    color: var(--heading);
    text-decoration-color: rgba(17, 17, 17, 0.25);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

a:hover {
    text-decoration-color: currentColor;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--heading);
    outline-offset: 4px;
}

img {
    max-width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--heading);
    color: var(--background);
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 180ms var(--ease-out);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Home */
.home-page {
    display: grid;
    min-height: 100vh;
    grid-template-rows: 1fr auto;
}

.home-main {
    display: flex;
    min-height: 0;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
}

.home-intro {
    display: flex;
    width: min(820px, 100%);
    align-items: flex-start;
    gap: 64px;
}

.home-intro__portrait {
    display: block;
    flex: 0 0 300px;
    width: 300px;
    height: 300px;
    border-radius: 24px;
    object-fit: cover;
}

.home-intro__copy {
    width: 456px;
    color: var(--muted);
    font-size: 18px;
    line-height: 29px;
}

.home-intro__copy h1 {
    margin: -3px 0 22px;
    color: var(--heading);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 36px;
}

.home-intro__copy p {
    margin: 0 0 20px;
}

.home-intro__copy p:last-child {
    margin-bottom: 0;
}

.home-intro__links {
    display: flex;
    gap: 20px;
}

.home-intro__links a {
    color: var(--heading);
}

/* Reading pages */
.editorial-main {
    width: min(680px, calc(100% - 48px));
    margin: 120px auto;
    padding-bottom: 120px;
    font-size: 19px;
    line-height: 32px;
}

.editorial-main h1,
.editorial-main h2 {
    color: var(--heading);
    font-size: 31.5px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 37.8px;
}

.editorial-main h1 {
    margin: 0 0 26px;
}

.editorial-main h2 {
    margin: 52px 0 26px;
}

.work-entry,
.education-entry {
    min-height: 98px;
    margin-bottom: 16px;
}

.work-entry h3,
.education-entry h3 {
    margin: 0;
    color: var(--heading);
    font: inherit;
    font-weight: 400;
}

.entry-date,
.entry-description,
.degree,
.publication-meta {
    color: var(--muted);
}

.entry-description,
.degree {
    margin: 0;
}

.publication-year {
    margin-bottom: 38px;
}

.publication-year h2 {
    margin-top: 48px;
    margin-bottom: 12px;
    font-size: 19px;
    font-weight: 600;
    line-height: 32px;
}

.publication {
    margin-bottom: 12px;
}

.publication a {
    display: inline;
    text-decoration-color: transparent;
}

.publication a:hover {
    text-decoration-color: currentColor;
}

.publication-meta {
    font-size: 16px;
    line-height: 26px;
}

/* Photo feed */
.photo-main {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto 96px;
    padding: 32px 20px 40px;
}

.image-feed {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.image-item {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
}

.image-item img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 300ms ease-in-out;
}

.image-item img.loaded,
.image-item img[loading="eager"] {
    opacity: 1;
}

/* Floating primary menu */
.floating-menu {
    --menu-open-width: 149px;
    --menu-open-height: 216px;
    --menu-collapsed-width: 82px;
    --menu-collapsed-height: 48px;
    --menu-width-spring-expand: linear(0, 0.03 5%, 0.12 10%, 0.45 20%, 0.82 33%, 1.08 44%, 1.15 52%, 1.08 68%, 1.01 84%, 1);
    --menu-width-spring-retract: linear(0, 0.03 5%, 0.12 10%, 0.45 20%, 0.82 33%, 1.03 44%, 1.06 52%, 1.03 68%, 1.005 84%, 1);
    --menu-height-spring-expand: linear(0, 0.02 6%, 0.14 12%, 0.3 18%, 0.5 24%, 0.69 30%, 0.86 36%, 0.97 42%, 1.025 48%, 1.04 58%, 1.025 70%, 1.008 84%, 1);
    --menu-height-spring-retract: linear(0, 0.02 6%, 0.14 12%, 0.3 18%, 0.5 24%, 0.69 30%, 0.86 36%, 0.97 42%, 1.018 48%, 1.03 58%, 1.02 70%, 1.006 84%, 1);
    --menu-width-duration-expand: 590ms;
    --menu-height-duration-expand: 428ms;
    --menu-width-duration-retract: 655ms;
    --menu-height-duration-retract: 475ms;
    --menu-width-spring-active: var(--menu-width-spring-retract);
    --menu-height-spring-active: var(--menu-height-spring-retract);
    --menu-width-duration-active: var(--menu-width-duration-retract);
    --menu-height-duration-active: var(--menu-height-duration-retract);
    position: fixed;
    z-index: 100;
    bottom: 32px;
    left: 32px;
    width: var(--menu-collapsed-width);
    height: var(--menu-collapsed-height);
    contain: layout paint;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 25px;
    background: var(--menu-surface);
    box-shadow: var(--shadow-menu);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    transform: translateX(4px);
    will-change: width, height, transform, bottom;
    transition: width var(--menu-width-duration-active) var(--menu-width-spring-active), height var(--menu-height-duration-active) var(--menu-height-spring-active), bottom var(--menu-height-duration-active) var(--menu-height-spring-active), transform var(--menu-width-duration-active) var(--menu-width-spring-active), border-radius 216ms cubic-bezier(0.2, 0, 0, 1), background 132ms ease, border-color 132ms ease, box-shadow 216ms ease, opacity 216ms ease;
}

.floating-menu.is-open {
    --menu-width-spring-active: var(--menu-width-spring-expand);
    --menu-height-spring-active: var(--menu-height-spring-expand);
    --menu-width-duration-active: var(--menu-width-duration-expand);
    --menu-height-duration-active: var(--menu-height-duration-expand);
    bottom: 24px;
    width: var(--menu-open-width);
    height: var(--menu-open-height);
    border-radius: 26px;
    background: var(--menu-open-surface);
    box-shadow: var(--shadow-menu-open);
    transform: translateX(0);
}

.floating-menu.floating-menu--no-motion,
.floating-menu.floating-menu--no-motion * {
    transition: none !important;
}

.floating-menu__inner {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    width: var(--menu-open-width);
    flex-direction: column;
    padding: 6px 22px;
    transform: translateX(-4px);
    transition: transform var(--menu-width-duration-active) var(--menu-width-spring-active), bottom var(--menu-height-duration-active) var(--menu-height-spring-active);
}

.floating-menu.is-open .floating-menu__inner {
    bottom: 8px;
    transform: translateX(0);
}

.floating-menu__links {
    display: contents;
}

.floating-menu__links a,
.floating-menu__trigger {
    display: block;
    width: 100%;
    padding: 4px 0;
    color: var(--menu-link);
    font: inherit;
    font-size: 17px;
    font-weight: 400;
    line-height: 28px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    transition: color 264ms ease;
}

.floating-menu__links > :nth-last-child(1) { --menu-stagger-index: 0; }
.floating-menu__links > :nth-last-child(2) { --menu-stagger-index: 1; }
.floating-menu__links > :nth-last-child(3) { --menu-stagger-index: 2; }
.floating-menu__links > :nth-last-child(4) { --menu-stagger-index: 3; }
.floating-menu__links > :nth-last-child(5) { --menu-stagger-index: 4; }

.floating-menu__links > * {
    opacity: 0;
    transition: opacity 200ms ease calc((4 - var(--menu-stagger-index, 0)) * 25ms), color 264ms ease;
}

.floating-menu.is-open .floating-menu__links > * {
    opacity: 1;
    transition: opacity 200ms ease calc(var(--menu-stagger-index, 0) * 25ms), color 264ms ease;
}

.floating-menu__links a:hover {
    color: var(--menu-link-hover);
}

.floating-menu__links a.active {
    color: var(--menu-link-active);
}

.floating-menu__divider {
    display: block;
    height: 1px;
    margin: 10px 0;
    background: var(--hairline);
}

.floating-menu__trigger {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.floating-menu:not(.is-open) .floating-menu__trigger {
    color: var(--menu-trigger);
}

.floating-menu:not(.is-open) .floating-menu__links > * {
    pointer-events: none;
}

.floating-menu__trigger:focus-visible {
    outline: none;
    color: var(--menu-link-active);
}

.floating-menu__links a:focus-visible {
    outline: none;
    color: var(--menu-link-active);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.22em;
}

.floating-menu.scroll-hidden {
    opacity: 0;
    pointer-events: none;
}

.site-credit {
    position: static;
    justify-self: end;
    margin: 0;
    padding: 0 32px 32px;
    color: var(--muted);
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
}

.site-credit a {
    color: inherit;
}

.site-credit a:hover {
    color: var(--heading);
}

@media (min-width: 1360px) {
    .home-intro {
        width: min(828px, 100%);
        gap: 72px;
    }
}

@media (max-width: 1240px) {
    .photo-main {
        width: calc(100% - 32px);
        padding-right: 0;
        padding-left: 0;
    }
}

@media (max-width: 880px) {
    .home-main {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 48px 24px 120px;
    }

    .home-intro {
        flex-direction: column;
        gap: 32px;
    }

    .home-intro__portrait {
        flex-basis: auto;
        width: max(180px, 40%);
        height: auto;
        aspect-ratio: 1;
        border-radius: 16px;
    }

    .home-intro__copy {
        width: min(100%, 620px);
    }

}

@media (max-width: 720px) {
    .home-intro__copy {
        font-size: 17px;
        line-height: 28px;
    }

    .editorial-main {
        font-size: 19px;
        line-height: 30px;
    }

    .editorial-main h1,
    .editorial-main h2 {
        font-size: 32px;
        line-height: 40px;
    }

    .home-intro__copy h1 {
        margin-bottom: 20px;
        margin-top: 0;
        font-size: 28px;
        line-height: 34px;
    }

    .home-intro__links {
        flex-wrap: wrap;
    }

    .editorial-main {
        width: calc(100% - 48px);
        margin: 48px auto 64px;
        padding-bottom: 32px;
    }

    .editorial-main h2 {
        margin-top: 48px;
    }

    .photo-main {
        width: calc(100% - 32px);
        margin-bottom: 96px;
        padding-top: 16px;
    }

    .image-feed {
        gap: 16px;
    }

    .floating-menu {
        right: auto;
        bottom: 20px;
        left: 12px;
        transform: none;
    }

    .floating-menu.is-open {
        bottom: 12px;
    }

    .site-credit {
        padding: 0 max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
        white-space: normal;
    }

}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #171717;
        --surface: #222222;
        --surface-soft: #2a2a2a;
        --heading: #dfdfdf;
        --text: #a1a1a1;
        --muted: #a3a3a3;
        --hairline: rgba(255, 255, 255, 0.1);
        --menu-surface: rgba(38, 38, 38, 0.88);
        --menu-open-surface: rgba(38, 38, 38, 0.92);
        --menu-link: #aaaaaa;
        --menu-link-hover: #d0d0d0;
        --menu-link-active: #dfdfdf;
        --menu-trigger: #dfdfdf;
        --shadow-soft: 0 8px 36px rgba(0, 0, 0, 0.24);
        --shadow-menu: 0 8px 36px rgba(0, 0, 0, 0.45);
        --shadow-menu-open: 0 14px 60px rgba(0, 0, 0, 0.55);
    }

    a {
        text-decoration-color: rgba(223, 223, 223, 0.28);
    }

    .floating-menu {
        border-color: rgba(255, 255, 255, 0.1);
    }

}

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

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
