/* A single chapter takes the foreground. Native scrolling owns the journey. */
.silk-word, .silk-word__ink { display: inline-block; max-inline-size: 100%; overflow-wrap: anywhere; }
.has-scroll-choreography .opening-scroll { min-height: 145svh; }
.has-scroll-choreography .hero { scroll-margin-block-start: 45svh; }
.has-scroll-choreography {
    --chapter-gutter: clamp(1.25rem, 4svh, 2.5rem);
    --chapter-bottom: max(5.5rem, env(safe-area-inset-bottom));
    /* Fractions of the stable viewport, shared with the scroll choreography. */
    --chapter-dwell: .80;
    --chapter-fade: .32;
    --contact-dwell: .42;
}
@media (max-width: 720px) {
    .has-scroll-choreography { --chapter-dwell: .88; --chapter-fade: .40; --contact-dwell: .50; }
    .has-scroll-choreography .opening-scroll { min-height: 132svh; }
    .has-scroll-choreography .hero { scroll-margin-block-start: 32svh; }
}
.chapter-thread {
    position: absolute;
    inset: 0 var(--edge) auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, #bfc9ff72 18%, #f0efffc4 48%, #bfc9ff50 82%, transparent);
    pointer-events: none;
    transform-origin: left;
}
:is(.interlude, .destinations, .work, .dossier-section, .contact) { position: relative; }
.dossier-section > .chapter-thread { inset-inline: 0; }
.field__error { color: #ffc1d3; font-size: .85rem; line-height: 1.4; }
.role, .cert { min-inline-size: 0; overflow-wrap: anywhere; }
.interlude { min-height: 100svh; }
.destinations { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.destination-pair { width: 100%; }
.work { min-height: 100svh; }
.contact { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.dossier { padding-block: 0; }
.dossier-section { padding-block: clamp(4rem, 9svh, 7rem); min-height: 100svh; }
.dossier-section + .dossier-section { margin-top: 0; }
.retrospective-heading > p {
    max-width: 28ch;
    margin-block: 1.5rem .8rem;
    color: var(--silk-muted);
    font-size: clamp(.95rem, 1.3vw, 1.15rem);
    line-height: 1.5;
    text-shadow: 0 2px 6px var(--silk-shadow);
}
.retrospective-heading .text-link { color: var(--silk-accent); }
.retrospective-heading { margin-bottom: 2rem; }
.retrospective-heading .section__title { margin-bottom: 0; }
.is-measuring-silk :is(.retrospective-heading, .silk-stage, .silk-experience-intro, .recognition__col:first-child, #competitions-title) {
    position: relative !important;
    top: auto !important;
}

@media (min-width: 1000px) {
    html:not(.has-scroll-choreography) #experience,
    .has-scroll-choreography .silk-experience-intro {
        display: grid;
        grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
        column-gap: clamp(2.5rem, 6vw, 6rem);
        align-items: start;
        max-width: none;
    }
    .retrospective-heading { position: sticky; top: 12svh; margin: 0; }
    .dossier .retrospective-heading .section__title { font-size: clamp(3rem, 5.4vw, 6.4rem); line-height: .98; }
    #experience .roles { margin: 0; padding-inline: 2.1rem; grid-column: 2; grid-row: 1; border-block-start-color: #a7acd561; }
    #experience .role { grid-template-columns: 1fr; gap: 1.15rem; }
    #experience .role__identity { grid-template-columns: 1fr auto; column-gap: 1rem; }
    #experience .role__time { grid-column: 2; grid-row: 1; align-self: center; font-size: .78rem; }
    #experience .role__org { grid-column: 1; grid-row: 1; }
    #experience .role__title { max-width: none; grid-column: 1 / -1; }
    #experience .section__more { grid-column: 2; }
    .recognition__col:first-child { position: sticky; top: 2rem; }
}

/* JavaScript changes this class after preserving the reading position. */
    .has-scroll-choreography :is(.interlude, .destinations, .work, .dossier-section, .contact) {
        display: flow-root;
        min-height: 0;
        padding-block: 0;
        margin-block-start: calc(-100svh + var(--chapter-gutter) + var(--chapter-bottom));
        scroll-margin-block-start: max(1rem, var(--chapter-top, var(--chapter-gutter)));
        pointer-events: none;
    }
    .has-scroll-choreography #about { margin-block-start: calc(var(--chapter-gutter) - 100svh); }
    .has-scroll-choreography .dossier { display: contents; }
    .has-scroll-choreography .dossier-section { max-width: none; padding-inline: var(--edge); }
    .has-scroll-choreography .dossier-section > .chapter-thread { inset-inline: var(--edge); }
    .has-scroll-choreography .silk-stage-track {
        grid-template-columns: inherit;
        gap: inherit;
        pointer-events: none;
    }
    .has-scroll-choreography .silk-stage-track::after {
        content: "";
        display: block;
        height: calc(100svh * (var(--chapter-dwell) + var(--chapter-fade)));
    }
    .has-scroll-choreography .silk-stage {
        position: sticky;
        top: var(--chapter-top, var(--chapter-gutter));
        min-height: calc(100svh - var(--chapter-gutter) - var(--chapter-bottom));
        padding-block: clamp(1.25rem, 3svh, 2.5rem);
        scroll-margin-block-start: var(--chapter-gutter);
        scroll-margin-block-end: var(--chapter-bottom);
    }
    .silk-stage--about {
        display: grid;
        grid-template-columns: inherit;
        gap: inherit;
        align-items: center;
        align-content: center;
    }
    .silk-stage--destinations {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .has-scroll-choreography #contact > .silk-stage-track::after {
        height: calc(100svh * var(--contact-dwell));
    }
    /* The inner frame holds the first role. The outer frame holds the last. */
    .has-scroll-choreography .silk-stage--experience { padding-block: 0; }
    .has-scroll-choreography .silk-stage--experience::after {
        content: "";
        display: block;
        height: 26svh;
    }
    .has-scroll-choreography .silk-experience-intro {
        position: sticky;
        top: var(--chapter-gutter);
        min-height: calc(100svh - var(--chapter-gutter) - var(--chapter-bottom));
        padding-block: clamp(1.25rem, 3svh, 2.5rem);
    }
    .has-scroll-choreography :is(.interlude, .destinations, .work, .dossier, .contact) { background: transparent; }
    .has-scroll-choreography .hero { position: sticky; top: 0; }
    .has-scroll-choreography .masthead > span:first-child {
        --opening-shift-x: -5vw;
        --opening-shift-y: -2svh;
    }
    .has-scroll-choreography .masthead > span:last-child {
        --opening-shift-x: 8vw;
        --opening-shift-y: 1.25svh;
    }
    .has-scroll-choreography .hero-foot { --opening-shift-y: -20px; }
    .has-scroll-choreography :is(.masthead > span, .hero-foot) {
        transform: translate3d(calc(var(--opening-pull, 0) * var(--opening-shift-x, 0px)),
            calc(var(--opening-pull, 0) * var(--opening-shift-y)), 0);
    }
    .has-scroll-choreography :is(.hero-nav, .hero-foot) { pointer-events: var(--chapter-pointer, auto); }
    .has-scroll-choreography [data-silk-motion="title"] .silk-word {
        overflow: clip;
        vertical-align: top;
        padding: .12em .04em .18em;
        margin: -.12em -.04em -.18em;
        perspective: 650px;
    }
    .has-scroll-choreography [data-silk-motion="title"] .silk-word__ink {
        --unfurl: calc(1 - clamp(0, (var(--silk-reveal, 1) - var(--word-delay, 0)) * 1.24, 1));
        transform-origin: center bottom;
        transform: translate3d(0, calc(var(--unfurl) * 105%), 0) rotateX(calc(var(--unfurl) * -58deg));
        opacity: calc(1 - var(--unfurl) * .55);
    }
    .has-scroll-choreography [data-silk-motion="reading"] .silk-word__ink {
        --lit: clamp(0, (var(--silk-reveal, 1) - var(--word-delay, 0)) * 1.24, 1);
        opacity: calc(.6 + var(--lit) * .4);
        transform: translate3d(0, calc((1 - var(--lit)) * 7px), 0);
    }
    .has-scroll-choreography [data-silk-motion] { --silk-rest: calc(1 - var(--silk-reveal, 1)); }
    .has-scroll-choreography [data-silk-motion="portal-left"] {
        transform-origin: right center;
        transform: perspective(1200px) translate3d(calc(var(--silk-rest) * 52px), calc(var(--silk-rest) * 90px), 0) rotateY(calc(var(--silk-rest) * 19deg)) rotateZ(calc(var(--silk-rest) * -5deg));
    }
    .has-scroll-choreography [data-silk-motion="portal-right"] {
        transform-origin: left center;
        transform: perspective(1200px) translate3d(calc(var(--silk-rest) * -52px), calc(var(--silk-rest) * 130px), 0) rotateY(calc(var(--silk-rest) * -19deg)) rotateZ(calc(var(--silk-rest) * 5deg));
    }
    .has-scroll-choreography [data-silk-motion="showcase"] {
        transform-origin: center 25%;
        transform: perspective(1300px) translate3d(0, calc(var(--silk-rest) * 96px), 0) rotateX(calc(var(--silk-rest) * 12deg)) scale(calc(1 - var(--silk-rest) * .055));
    }
    .has-scroll-choreography [data-silk-motion="identity"] { transform: translate3d(calc(var(--silk-rest) * -20px), 0, 0); opacity: calc(1 - var(--silk-rest) * .24); }
    .has-scroll-choreography [data-silk-motion="role"] { transform: translate3d(0, calc(var(--silk-rest) * 32px), 0); }
    .has-scroll-choreography [data-silk-motion="ledger"] { transform: translate3d(0, calc(var(--silk-rest) * 35px), 0); }
    .has-scroll-choreography [data-silk-motion="photo-left"], .has-scroll-choreography [data-silk-motion="photo-right"] {
        transform-origin: center 70%;
        transform: translate3d(0, calc(var(--silk-rest) * 65px), 0) rotate(calc(var(--silk-rest) * -2.5deg));
    }
    .has-scroll-choreography [data-silk-motion="photo-right"] { transform: translate3d(0, calc(var(--silk-rest) * 85px), 0) rotate(calc(var(--silk-rest) * 2.5deg)); }
    .has-scroll-choreography .chapter-thread { transform: scaleX(var(--silk-reveal, 1)); }
    .has-scroll-choreography [data-silk-active]:not([data-silk-motion="title"], [data-silk-motion="reading"]) { will-change: transform; }
    .has-scroll-choreography [data-silk-active] .silk-word__ink { will-change: transform, opacity; }
    .has-scroll-choreography [data-silk-settled]:not(.chapter-thread) { transform: none; }
    .has-scroll-choreography [data-silk-settled] .silk-word__ink { transform: none; opacity: 1; }
    .has-scroll-choreography [data-silk-motion]:focus-within { transform: none; }
    .has-scroll-choreography :is([data-silk-motion="title"], [data-silk-motion="reading"]):focus-within .silk-word__ink { transform: none; opacity: 1; }
    .has-scroll-choreography [data-chapter-focus] { --chapter-clarity: 0; --chapter-pointer: none; }
    .has-scroll-choreography [data-chapter-focus="active"] { --chapter-clarity: 1; --chapter-pointer: auto; }
    /* Fade the content, not a screen-sized translucent surface over WebGL.
       Fully recessed chapters cost no continuous blending and cannot catch taps. */
    .has-scroll-choreography :is(.opening-scroll > .hero, #about h2, .interlude-copy, .contributions,
        #destinations h2, .destination-pair, .work-heading, .project-index,
        .retrospective-heading, .roles, .section__more, #competitions h2, .recognition,
        #contact h2, .contact__grid, .chapter-thread) {
        opacity: var(--chapter-clarity, 1);
        pointer-events: var(--chapter-pointer, auto);
    }
    .has-scroll-choreography .chapter-thread { pointer-events: none; }

@media screen and (min-width: 721px) {
    /* Keep the Contact form compact enough to read in one desktop view. */
    .has-scroll-choreography .silk-stage--contact {
        min-height: calc(100svh - var(--chapter-bottom) - 5.5rem);
        padding-block-end: clamp(.9rem, 2.25svh, 2.5rem);
    }
    .has-scroll-choreography .contact__grid { margin-block-start: clamp(1.5rem, 5svh, 3.5rem); }
    .has-scroll-choreography .contact-form {
        padding-block: clamp(1rem, 2.4svh, 2.8rem);
        row-gap: clamp(.65rem, 1.45svh, 1.05rem);
    }
    .has-scroll-choreography .contact-form .field__input--area {
        min-block-size: 6.5rem;
        block-size: clamp(6.5rem, 14svh, 8.5rem);
    }
}

@media screen and (min-width: 721px) {
    .has-scroll-choreography .silk-stage--projects .work-heading {
        position: sticky;
        top: var(--chapter-gutter);
        z-index: 2;
    }
    .is-measuring-silk .work-heading {
        position: relative !important;
        top: auto !important;
    }
    .has-scroll-choreography .silk-stage--projects .project-index {
        clip-path: var(--work-preview-clip, none);
    }
    .has-scroll-choreography #competitions {
        --victories-title-top: var(--chapter-gutter);
        --victories-title-size: clamp(3.4rem, 10vw, 10rem);
        --victories-title-line: .96;
        --victories-title-gap: clamp(.75rem, 2svh, 1.5rem);
        --victories-columns-gap: clamp(1.65rem, 5vw, 5rem);
    }
    .has-scroll-choreography #competitions-title {
        position: sticky;
        top: var(--victories-title-top);
        z-index: 2;
        width: calc((100% - var(--victories-columns-gap)) * .39);
        font-size: var(--victories-title-size);
        line-height: var(--victories-title-line);
        white-space: nowrap;
        pointer-events: none;
    }
    .has-scroll-choreography #competitions .recognition { column-gap: var(--victories-columns-gap); }
    .has-scroll-choreography #competitions .recognition__col:first-child {
        top: calc(var(--victories-title-top) + var(--victories-title-size) * var(--victories-title-line) + var(--victories-title-gap));
    }
}

@media screen {
    .has-scroll-choreography #competitions .recognition__col:first-child :is(h3, .podium) {
        filter: var(--results-row-filter, none);
    }
}

@media screen and (max-width: 720px) and (min-height: 361px) {
    .has-scroll-choreography {
        --title-gutter: max(1rem, env(safe-area-inset-top) + .4rem);
    }
    /* The compositor owns the docked position. JS only eases the short approach. */
    .has-scroll-choreography [data-silk-title-dock] {
        position: sticky;
        top: var(--title-gutter);
        z-index: 3;
    }
    .is-measuring-silk [data-silk-title-dock] {
        position: relative !important;
        top: auto !important;
    }
    .has-scroll-choreography [data-silk-title-host] > h2 {
        position: relative;
        z-index: 3;
        scroll-margin-block-start: var(--title-gutter);
        translate: 0 var(--title-lift, 0px) 0;
        scale: var(--title-scale, 1);
        transform-origin: left top;
        pointer-events: none;
    }
    .has-scroll-choreography [data-silk-title-host] > h2[data-silk-title-dock] {
        position: sticky;
    }
    .has-scroll-choreography [data-silk-title-host] > h2[data-silk-title-dock].section__title {
        align-self: start;
    }
    .is-measuring-silk [data-silk-title-host] > h2 { translate: none !important; scale: none !important; }
    .has-scroll-choreography #destinations h2 { transform-origin: center top; }
    .has-scroll-choreography :is(.work-heading, .retrospective-heading) > p {
        opacity: var(--title-lede-opacity, 1);
    }
    /* Keep the compact title sharp over a feathered strip of the scrolling content. */
    .has-scroll-choreography [data-silk-title-host]:not(.silk-stage--competitions)::before {
        content: "";
        position: fixed;
        z-index: 1;
        inset: 0 0 auto;
        height: calc(var(--title-blur-bottom, 0px) + .8rem);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        mask-image: linear-gradient(#000 calc(100% - .8rem), transparent);
        opacity: var(--title-blur-opacity, 0);
        pointer-events: none;
    }
    .has-scroll-choreography .silk-stage[data-silk-title-host]::before {
        opacity: calc(var(--title-blur-opacity, 0) * var(--chapter-clarity, 1));
    }
}

@media (max-width: 720px) {
    .has-scroll-choreography .masthead > span:first-child { --opening-shift-x: -3.5vw; }
    .has-scroll-choreography .masthead > span:last-child { --opening-shift-x: 6vw; }
    .has-scroll-choreography [data-silk-motion="portal-left"], .has-scroll-choreography [data-silk-motion="portal-right"] {
        transform-origin: center top;
        transform: perspective(900px) translate3d(0, calc(var(--silk-rest) * 44px), 0) rotateX(calc(var(--silk-rest) * 9deg));
    }
    .has-scroll-choreography [data-silk-motion="showcase"] { transform: translate3d(0, calc(var(--silk-rest) * 30px), 0) scale(calc(1 - var(--silk-rest) * .025)); }
    .has-scroll-choreography [data-silk-motion="photo-left"], .has-scroll-choreography [data-silk-motion="photo-right"] { transform: translate3d(0, calc(var(--silk-rest) * 30px), 0); }
}

@supports (animation-timeline: scroll(root block)) and (animation-range: 0px 1px) {
    @media screen {
        /* Drive the transform from native scrolling after the entry fold. */
        .has-scroll-choreography:not(.has-landing-loader) :is(.masthead > span, .hero-foot) {
            animation-name: opening-recede;
            animation-duration: auto;
            animation-fill-mode: both;
            animation-timing-function: cubic-bezier(.3333, 0, .6667, 1);
            animation-timeline: scroll(root block);
            animation-range: var(--opening-shift-start, 0px) var(--opening-shift-end, 1px);
        }
        @keyframes opening-recede {
            from { transform: translate3d(0, 0, 0); }
            to { transform: translate3d(var(--opening-shift-x, 0px), var(--opening-shift-y), 0); }
        }
    }
}

@media (max-height: 480px) {
    .has-scroll-choreography .silk-stage--experience::after { height: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .silk-word__ink { opacity: 1; transform: none; }
    .chapter-thread { transform: none; }
}
/* Without choreography, the semantic sections retain their original layout. */
html:not(.has-scroll-choreography) .silk-stage-track,
html:not(.has-scroll-choreography) :is(.silk-stage, .silk-experience-intro) { display: contents; }
@media (forced-colors: active) {
    .site-backdrop, .art { display: none !important; }
    .chapter-thread { background: CanvasText; }
    .silk-word__ink, [data-chapter-focus] { opacity: 1 !important; }
    [data-chapter-focus] { --chapter-clarity: 1 !important; --chapter-pointer: auto !important; }
}
@media print {
    .opening-scroll { min-height: 0 !important; }
    .hero, .retrospective-heading, .silk-stage, .recognition__col:first-child { position: static !important; }
    .silk-stage { min-height: 0 !important; padding-block: 0 !important; }
    .silk-stage-track { margin-block-start: 0 !important; }
    .silk-stage-track::after { display: none !important; }
    .has-scroll-choreography :is(.interlude, .destinations, .work, .dossier-section, .contact) {
        display: block !important;
        margin-block-start: 0 !important;
        scroll-margin-block-start: 0 !important;
    }
    .silk-stage-track, .silk-stage { display: contents !important; }
    .silk-experience-intro { display: contents !important; }
    .silk-stage--experience::after { display: none !important; }
    [data-silk-motion], .silk-word__ink, [data-chapter-focus] { transform: none !important; opacity: 1 !important; }
    [data-chapter-focus] { --chapter-clarity: 1 !important; --chapter-pointer: auto !important; }
    .silk-word { overflow: visible !important; }
    .chapter-thread { display: none; }
    .retrospective-heading > p { color: #34384e; text-shadow: none; }
    .interlude, .destinations, .work, .contact, .dossier-section { min-height: 0; padding-block: 1rem; }
}
