/* ========================================
   Hinrich Bomsdorf - one pager
   ========================================
   Reading the CSS? Then you'll enjoy the nav: the pills morph into the
   dot pill on springs, and the black highlight flows like a drop of liquid.
   Say hi: hinrich@bomsdorf.de */

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

:root {
    --pill: #f1f1f4;
    --pill-hover: #e7e7eb;
    --muted: #a3a3a9;
    --ink: #111114;
    --grey: #86868b;
    --grey-dark: #6e6e73;
    --line: #e6e6eb;
    --soft: #f4f4f7;
    --font-hero: 'Rubik', sans-serif;
    --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-slide: cubic-bezier(0.22, 1, 0.36, 1);
    --gutter: clamp(20px, 3vw, 44px);
    /* edge of a centred 1440px frame, so nav and top bar move inwards on big screens */
    --edge: max(var(--gutter), calc(50vw - 720px));
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: #fff;
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

::selection {
    background: var(--ink);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
    border-radius: 100px;
}

/* ========================================
   Screen 1: Hello
   ======================================== */
.hello {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    background: #fff;
    transition: visibility 0s linear 0.9s;
}

.hello.is-gone {
    visibility: hidden;
    pointer-events: none;
}

.hello.is-back {
    transition: none;
}

.hello-word {
    display: flex;
    font-family: var(--font-hero);
    font-weight: 900;
    font-size: clamp(110px, 24vw, 340px);
    line-height: 1;
    letter-spacing: -0.05em;
    user-select: none;
}

.hello-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(40%);
    transition: opacity 0.7s var(--ease-out), transform 0.9s var(--ease-out);
}

.hello-letter:nth-child(2) { transition-delay: 0.06s; }
.hello-letter:nth-child(3) { transition-delay: 0.12s; }
.hello-letter:nth-child(4) { transition-delay: 0.18s; }
.hello-letter:nth-child(5) { transition-delay: 0.24s; }

.hello.is-ready .hello-letter {
    opacity: 1;
    transform: none;
}

/* Leaving: letters scatter (positions set in JS), pill lifts away */
.hello.is-leaving .hello-letter {
    transition: opacity 0.45s ease, transform 0.8s var(--ease-out);
    transition-delay: 0s;
}

/* While leaving, the white sheet melts away right away so the site shows through */
.hello.is-leaving {
    background: transparent;
    pointer-events: none;
    transition: background 0.3s ease, visibility 0s linear 0.9s;
}

/* ========================================
   Screen 2: The site
   ======================================== */
.site {
    --side: clamp(190px, 16vw, 280px);
    position: fixed;
    inset: 0;
    visibility: hidden;
}

.site.is-open {
    visibility: visible;
}

/* Top bar and nav slide in with the content, so the page assembles in one motion */
.topbar,
.nav {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.8s var(--ease-out);
}

.topbar {
    transform: translateY(-10px);
}

.nav {
    transform: translateX(-12px);
}

.site.is-open .topbar,
.site.is-open .nav {
    opacity: 1;
    transform: none;
}

.site.is-open .topbar {
    transition-delay: 0.05s;
}

.site.is-open .nav {
    transition-delay: 0.12s;
}

/* Top bar */
.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--gutter) + env(safe-area-inset-top)) var(--edge) 0;
}

.topbar > * {
    pointer-events: auto;
}

/* `hidden` on the header switches the whole bar off */
.topbar[hidden] {
    display: none;
}

/* Memoji home button. Plays its animation on hover or tap. */
.memoji {
    width: 68px;
    height: 68px;
    margin: -14px 0 -14px -12px;
    transition: transform 0.5s var(--ease-out);
}

.memoji img {
    display: block;
    width: 100%;
    height: 100%;
}

.memoji:hover {
    transform: scale(1.08) rotate(-4deg);
}

.memoji:active {
    transform: scale(0.94);
}

.hi-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 100px;
    background: var(--pill);
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: background 0.35s ease, color 0.35s ease;
}

.hi-pill img {
    height: 1.2em;
    width: auto;
    transform-origin: 70% 80%;
    transition: transform 0.5s var(--ease-out);
}

.hi-pill:hover {
    background: var(--pill-hover);
}

.hi-pill:hover img {
    transform: rotate(-14deg);
}

/* Nav pills */
.nav {
    position: absolute;
    z-index: 3;
    left: var(--edge);
    top: 50%;
    translate: 0 -50%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.nav-pill {
    position: relative;
    z-index: 1;
    padding: 11px 22px;
    border-radius: 100px;
    background: var(--pill);
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--grey-dark);
    white-space: nowrap;
    transition: color 0.35s ease, background 0.35s ease;
}

.nav-pill:hover {
    color: var(--ink);
    background: var(--pill-hover);
}

.nav-pill.is-active {
    color: #fff;
    background: transparent;
}

.nav-indicator {
    position: absolute;
    z-index: 0;
    left: 0;
    top: 0;
    border-radius: 100px;
    background: var(--ink);
    /* moved by script: a liquid spring, see moveIndicator */
}

/* Collapsing nav: the script drives translate/scale/opacity every frame from the cursor
   position (no CSS transitions on those), so the morph follows the hand continuously. */
.nav-pill {
    transition: color 0.35s ease, background 0.35s ease;
}

.nav-pill,
.nav-indicator,
.nav-dots {
    will-change: translate, scale, opacity, filter;
}

.nav-dots {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 80px;
    margin-top: -40px;
    border-radius: 100px;
    background: var(--pill);
    opacity: 0;
    pointer-events: none;
}

/* The pills morph into this shape; the dots themselves arrive last */
.nav-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a3a3a9;
    opacity: var(--dots, 0);
    scale: calc(0.3 + 0.7 * var(--dots, 0));
}

.nav.is-collapsed .nav-pill {
    pointer-events: none;
}

/* Stage + panels */
.stage {
    position: absolute;
    inset: 0;
}

/* Every panel centres its content in the middle of the screen.
   The side padding is the same on both sides so the nav never pushes it off centre. */
.panel {
    position: absolute;
    inset: 0;
    padding: 110px var(--side) 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
}

.panel-inner {
    display: flex;
    align-items: center;
    width: min(100%, 900px);
}

.panel-inner.panel-split {
    width: min(100%, 1080px);
}

.panel-inner.panel-about,
.panel-inner.panel-text {
    width: min(100%, 780px);
}

.panel-inner.panel-journey {
    width: min(100%, 680px);
}

.panel.is-active {
    visibility: visible;
    pointer-events: auto;
}

[data-stagger] {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
    transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out), filter 0.6s var(--ease-out);
    transition-delay: var(--d, 0s);
}

.panel.is-in [data-stagger] {
    opacity: 1;
    transform: none;
    filter: none;
}

.panel.is-leaving [data-stagger] {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(6px);
    transition-duration: 0.28s;
    transition-delay: 0s;
}

/* Shared type */
.eyebrow {
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: clamp(20px, 2vw, 26px);
    color: var(--grey);
    letter-spacing: -0.01em;
}

.title {
    font-family: var(--font-hero);
    font-weight: 900;
    font-size: clamp(56px, 7.4vw, 112px);
    line-height: 0.92;
    letter-spacing: -0.045em;
}

.lede {
    margin-top: 22px;
    max-width: 30ch;
    font-weight: 600;
    font-size: clamp(18px, 1.55vw, 22px);
    line-height: 1.5;
    color: var(--grey-dark);
}

/* About */
.panel-about {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(24px, 4vh, 40px);
}

/* Portrait sprite: nine stacked frames, script shows the one facing the cursor */
.about-photo {
    position: relative;
    flex: none;
    display: block;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    width: clamp(140px, 13vw, 200px);
    aspect-ratio: 408 / 404;
}

.about-photo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Soften where the shoulders are cut off */
    border-radius: 0 0 40% 40% / 0 0 32% 32%;
    corner-shape: squircle;
    visibility: hidden;
    user-select: none;
    -webkit-user-drag: none;
}

.about-photo img.is-on {
    visibility: visible;
}

/* Statements: big sentences with little images between the words */
.statement {
    max-width: 19em;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: clamp(28px, 3.1vw, 48px);
    line-height: 1.22;
    letter-spacing: -0.025em;
    color: var(--ink);
}

.statement-sm {
    max-width: 17em;
    margin-top: 22px;
    font-size: clamp(22px, 2.1vw, 32px);
}

.panel-text .statement {
    margin-top: 22px;
}

.statement .muted {
    color: var(--muted);
}

.ia {
    display: inline-block;
    height: 1.18em;
    margin: 0 0.06em;
    vertical-align: -0.24em;
    transition: transform 0.5s var(--ease-out);
    transform-origin: 50% 70%;
}

.ia img {
    display: block;
    height: 100%;
    width: auto;
}

.ia-photo {
    width: 1.18em;
    border-radius: 0.3em;
    overflow: hidden;
}

.ia-photo img {
    width: 100%;
    object-fit: cover;
}

.ia-sm {
    height: 0.92em;
    vertical-align: -0.1em;
}

.ia-wide img {
    border-radius: 0.2em;
}

@media (hover: hover) {
    .ia:hover {
        transform: scale(1.22) rotate(-4deg);
        position: relative;
        z-index: 3;
    }
}

/* Pop the little images in after the sentence appears */
.statement .ia {
    opacity: 0;
    scale: 0.4;
    transition: transform 0.5s var(--ease-out), opacity 0.4s ease, scale 0.6s var(--ease-out);
}

.panel.is-in .statement .ia {
    opacity: 1;
    scale: 1;
}

.panel.is-in .statement .ia:nth-of-type(1) { transition-delay: 0s, 0.35s, 0.35s; }
.panel.is-in .statement .ia:nth-of-type(2) { transition-delay: 0s, 0.45s, 0.45s; }
.panel.is-in .statement .ia:nth-of-type(3) { transition-delay: 0s, 0.55s, 0.55s; }
.panel.is-in .statement .ia:nth-of-type(n+4) { transition-delay: 0s, 0.65s, 0.65s; }
.panel.is-in .statement .muted .ia { transition-delay: 0s, 0.7s, 0.7s; }

/* Text panels */
.panel-text {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.list {
    list-style: none;
    width: min(560px, 100%);
    margin-top: clamp(28px, 5vh, 48px);
}

.list li {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    font-family: var(--font-hero);
    font-size: 18px;
    transition: padding 0.4s var(--ease-out);
}

.list li:last-child {
    border-bottom: 1px solid var(--line);
}

.list li span:first-child {
    font-weight: 700;
}

.list li span:last-child {
    color: var(--muted);
    font-weight: 500;
}

.list li:hover {
    padding-left: 8px;
    padding-right: 8px;
}

/* Split panels: text left, media right */
.panel-split {
    gap: clamp(36px, 5vw, 80px);
}

.split-text {
    flex: 1 1 0;
    min-width: 0;
}

.media-card {
    position: relative;
    flex: 1.25 1 0;
    max-width: 600px;
    aspect-ratio: 4 / 3;
    border-radius: 44px;
    corner-shape: squircle;
    overflow: hidden;
    background: var(--soft);
}

.media-card img,
.media-card video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-apps img {
    transition: transform 0.8s var(--ease-out);
}

.media-apps:hover img {
    transform: scale(1.04);
}

/* Film: the first frame as a still; the video plays on hover and fades in over it */
.media-film {
    aspect-ratio: 16 / 9;
    background: #0d0f12;
}

.media-film picture,
.media-film .film-poster,
.media-film .film-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-film .film-poster,
.media-film .film-video {
    transition: transform 1.2s var(--ease-out);
}

.media-film .film-video {
    opacity: 0;
    transition: opacity 0.5s ease, transform 1.2s var(--ease-out);
}

.media-film.is-playing .film-video,
.media-film.has-frame .film-video {
    opacity: 1;
}

.media-film:hover .film-poster,
.media-film:hover .film-video {
    transform: scale(1.03);
}

/* On hover the card grows a little and rises above a blur that slowly builds over the page */
.media-film {
    transition: opacity 0.6s var(--ease-out) var(--d, 0s), transform 0.8s var(--ease-out) var(--d, 0s),
        filter 0.6s var(--ease-out) var(--d, 0s), scale 1.4s cubic-bezier(0.32, 0.72, 0, 1) 0s,
        box-shadow 1.4s cubic-bezier(0.32, 0.72, 0, 1) 0s;
}

.media-film.is-hovered {
    z-index: 5;
    scale: 1.06;
    box-shadow: 0 30px 70px rgba(17, 17, 20, 0.22);
}

.film-focus {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: rgba(255, 255, 255, 0);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    transition: background 0.6s ease, -webkit-backdrop-filter 0.6s ease, backdrop-filter 0.6s ease;
}

/* the longer the hover, the stronger the blur: one slow transition that keeps building */
.film-focus.is-on {
    background: rgba(255, 255, 255, 0.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.05);
    backdrop-filter: blur(20px) saturate(1.05);
    transition: background 12s cubic-bezier(0.45, 0, 0.55, 1), -webkit-backdrop-filter 12s cubic-bezier(0.45, 0, 0.55, 1),
        backdrop-filter 12s cubic-bezier(0.45, 0, 0.55, 1);
}

/* Journey: an index of big grey words. Hover one to bring it to life. */
.panel-journey {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.index {
    list-style: none;
    width: 100%;
    margin-top: clamp(20px, 4vh, 40px);
}

.index li {
    --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: 20px;
    cursor: default;
    outline: none;
    will-change: transform;
}

/* The open row makes room for its detail line in one step; the rows then glide (see script) */
.index li.is-active {
    padding-bottom: var(--dh, 0px);
}

.index .w {
    font-family: var(--font-hero);
    font-weight: 800;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.16;
    letter-spacing: -0.035em;
    color: #d9d9df;
    transition: color 0.45s ease, transform 0.7s var(--ease-soft);
}

.index .m {
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.7s var(--ease-soft);
}

.index li.is-now .m {
    color: #34c759;
}

.index li.is-active .w {
    color: var(--ink);
    transform: translateX(10px);
}

.index li.is-active .m {
    opacity: 1;
    transform: none;
    transition: opacity 0.45s ease 0.1s, transform 0.7s var(--ease-soft);
}

/* The short detail sits right under its word, out of the flow so it can fade on its own */
.index .d {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--wh, 1.16em);
    padding: 2px 0 12px 10px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.4;
    color: var(--grey);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.6s var(--ease-soft);
}

.index li.is-active .d {
    opacity: 1;
    transform: none;
    transition: opacity 0.5s ease 0.12s, transform 0.7s var(--ease-soft);
}

/* Apps: three apps side by side. Screenshots, then icon and name, then one line. */
.panel-inner.panel-apps {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: min(100%, 1080px);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(24px, 3.5vw, 56px);
    width: 100%;
    margin-top: clamp(28px, 5vh, 48px);
}

.app {
    display: block;
    color: inherit;
    text-decoration: none;
    outline-offset: 8px;
}

/* The three screenshots as a fanned stack: first in front, the others tilted behind it */
.app-shots {
    --sh: min(30vh, 260px);
    --sw: calc(var(--sh) * 480 / 1040);
    --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
    position: relative;
    display: block;
    width: calc(var(--sw) * 2.3);
    height: calc(var(--sh) + 24px);
}

.app-shots img {
    position: absolute;
    left: 50%;
    top: 12px;
    width: var(--sw);
    height: auto;
    aspect-ratio: 480 / 1040;
    margin-left: calc(var(--sw) / -2);
    border-radius: 16px;
    corner-shape: squircle;
    background: var(--pill);
    box-shadow: 0 10px 26px rgba(17, 17, 20, 0.14), 0 0 0 1px rgba(17, 17, 20, 0.04);
    transform-origin: 50% 90%;
    transition: transform 0.75s var(--ease-soft), box-shadow 0.75s var(--ease-soft);
}

.app-shots img:nth-child(1) {
    z-index: 3;
}

.app-shots img:nth-child(2) {
    z-index: 1;
    transform: translateX(-42%) rotate(-8deg) scale(0.9);
}

.app-shots img:nth-child(3) {
    z-index: 2;
    transform: translateX(42%) rotate(8deg) scale(0.9);
}

.app:hover .app-shots img:nth-child(1) {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 18px 36px rgba(17, 17, 20, 0.18), 0 0 0 1px rgba(17, 17, 20, 0.04);
}

.app:hover .app-shots img:nth-child(2) {
    transform: translateX(-74%) rotate(-12deg) scale(0.92);
}

.app:hover .app-shots img:nth-child(3) {
    transform: translateX(74%) rotate(12deg) scale(0.92);
}

.app-id {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.app-icon {
    flex: none;
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 2px 6px rgba(17, 17, 20, 0.14));
    transition: transform 0.6s var(--ease-out);
}

.app:hover .app-icon {
    transform: scale(1.08) rotate(-4deg);
}

.app-name b {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.02em;
}

.app-name b i {
    font-style: normal;
    font-size: 14px;
    color: var(--muted);
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity 0.3s ease, transform 0.5s var(--ease-out);
}

.app:hover .app-name b i {
    opacity: 1;
    transform: none;
}

.app-name > span {
    display: block;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
}

.app-desc {
    display: block;
    max-width: 30ch;
    margin-top: 12px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.45;
    color: var(--grey);
}

/* App detail: blur over the whole page, no card, just the app and its story */
.app-sheet {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(72px, 10vh, 110px) 24px clamp(48px, 8vh, 80px);
}

.app-sheet[hidden] {
    display: none;
}

/* The blur is its own layer so it can fade while the icon stays solid on its flight */
.app-sheet-bg {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(26px) saturate(1.1);
    backdrop-filter: blur(26px) saturate(1.1);
    opacity: 0;
    transition: opacity 0.45s ease;
}

.app-sheet.is-open .app-sheet-bg {
    opacity: 1;
}

.app-sheet-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 560px);
    text-align: center;
}

.app-sheet-icon {
    width: clamp(96px, 11vw, 128px);
    height: auto;
    filter: drop-shadow(0 14px 30px rgba(17, 17, 20, 0.18));
}

.app-sheet-name {
    margin-top: 22px;
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: clamp(38px, 4.2vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--ink);
}

.app-sheet-sub {
    margin-top: 6px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 17px;
    color: var(--muted);
}

.app-sheet-desc {
    max-width: 28ch;
    margin-top: 18px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: clamp(19px, 1.7vw, 23px);
    line-height: 1.35;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.app-sheet-store {
    margin-top: 26px;
    padding: 12px 24px;
    font-size: 16px;
}

.app-sheet-case {
    width: min(100%, 460px);
    margin-top: clamp(36px, 6vh, 56px);
    padding-top: 22px;
    border-top: 1px solid rgba(17, 17, 20, 0.08);
    text-align: left;
}

.app-sheet-label {
    display: block;
    margin-bottom: 14px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-sheet-case .cs-meta {
    margin: -6px 0 16px;
    font-size: 13px;
    color: var(--muted);
}

.app-sheet-case h4 {
    margin-top: 14px;
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

.app-sheet-case h4:first-child {
    margin-top: 0;
}

.app-sheet-case p {
    margin-top: 3px;
    font-family: var(--font-hero);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.5;
    color: var(--grey-dark);
}

.app-sheet-close {
    position: fixed;
    z-index: 2;
    top: 24px;
    right: 24px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--pill);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    transition: background 0.25s ease, transform 0.4s var(--ease-out), opacity 0.3s ease;
}

.app-sheet.is-open .app-sheet-close {
    opacity: 1;
}

.app-sheet-close:hover {
    background: var(--pill-hover);
    transform: rotate(90deg);
}

/* Text follows the icon in, one line after another */
.app-sheet [data-sheet] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-sheet.is-open [data-sheet] {
    opacity: 1;
    transform: none;
    transition: opacity 0.5s ease var(--d, 0s), transform 0.7s var(--ease-out) var(--d, 0s);
}

.app-sheet.is-open [data-sheet]:nth-child(2) { --d: 0.12s; }
.app-sheet.is-open [data-sheet]:nth-child(3) { --d: 0.17s; }
.app-sheet.is-open [data-sheet]:nth-child(4) { --d: 0.22s; }
.app-sheet.is-open [data-sheet]:nth-child(5) { --d: 0.28s; }
.app-sheet.is-open [data-sheet]:nth-child(6) { --d: 0.36s; }

/* While its sheet is open, the card's own icon is the one up there */
/* (untransformed, so the flight measures and lands on its true resting spot) */
.app.is-lifted .app-icon {
    visibility: hidden;
    transform: none;
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .app-sheet-bg,
    .app-sheet-close,
    .app-sheet [data-sheet] {
        transition: none !important;
    }
}

/* Life */
.panel-life {
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.panel-life .statement,
.panel-contact .statement {
    margin-left: auto;
    margin-right: auto;
}

.panel-contact {
    text-align: center;
}

/* Life cards: same build as the original site */
.bounceCardsContainer {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 500px;
    height: 250px;
    margin: clamp(24px, 5vh, 48px) auto 0;
}

.bounceCardsContainer .card {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 200px;
    height: 200px;
    border: 5px solid #fff;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    will-change: transform;
    backface-visibility: hidden;
}

.bounceCardsContainer .card .image {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Zürich map: an Apple Maps screenshot with a pulsing pin, tilted like the old Munich card */
.map-card {
    aspect-ratio: 644 / 354;
    border-radius: 40px;
    corner-shape: squircle;
    background: #eef1ea;
    box-shadow: 0 20px 60px rgba(17, 17, 20, 0.1);
    rotate: 2deg;
    transition: opacity 0.6s var(--ease-out) var(--d, 0s), transform 0.8s var(--ease-out) var(--d, 0s),
        filter 0.6s var(--ease-out) var(--d, 0s), rotate 0.6s var(--ease-out), scale 0.6s var(--ease-out),
        box-shadow 0.6s var(--ease-out);
}

.map-card:hover {
    rotate: -2deg;
    scale: 1.02;
    box-shadow: 0 40px 90px rgba(17, 17, 20, 0.15);
}

.map-card picture,
.map-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Night in Zürich (after sunset there): same map, turned into a dark map. Invert + hue-rotate
   keeps the lake blue and the parks green while the streets and land go dark. */
.map-img {
    transition: filter 1.4s ease;
}

.map-card.is-night {
    background: #1d2024;
}

.map-card.is-night .map-img {
    filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.86) saturate(0.5);
}

.map-card.is-night .pin-dot {
    background: #fff;
    border-color: #1d2024;
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.45);
}

.map-card.is-night .pin-ring {
    background: rgba(255, 255, 255, 0.22);
}

.pin-dot,
.pin-ring {
    transition: background 1.4s ease, border-color 1.4s ease, box-shadow 1.4s ease;
}

/* sits exactly on the location dot in the screenshot and covers it */
.map-pin {
    position: absolute;
    left: 53.34%;
    top: 60.03%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.pin-dot {
    position: relative;
    z-index: 2;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ink);
    border: 4px solid #fff;
    box-shadow: 0 4px 14px rgba(17, 17, 20, 0.3);
}

.pin-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(17, 17, 20, 0.14);
    transform: translate(-50%, -50%);
    animation: pinRing 3s ease-out infinite;
}

@keyframes pinRing {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* Contact */
.panel-contact {
    flex-direction: column;
    justify-content: center;
}

.talk-title {
    font-family: var(--font-hero);
    font-weight: 900;
    font-size: clamp(76px, 12vw, 200px);
    line-height: 0.9;
    letter-spacing: -0.05em;
}

.talk-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: clamp(28px, 5vh, 48px);
}

.pill {
    padding: 15px 32px;
    border-radius: 100px;
    background: var(--pill);
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 18px;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.3s var(--ease-out), background 0.25s ease, color 0.25s ease;
}

.pill:hover {
    transform: translateY(-3px);
    background: var(--pill-hover);
}

.pill-solid {
    background: var(--ink);
    color: #fff;
}

.pill-solid:hover {
    background: #2a2a2e;
}

/* ========================================
   Mobile: nav becomes a pill bar at the bottom
   Everything below only applies to phones and small windows, the desktop layout is untouched.
   ======================================== */
@media (max-width: 820px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        -webkit-tap-highlight-color: transparent;
    }

    .site {
        display: grid;
        grid-template-rows: auto 1fr auto;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .topbar {
        position: static;
    }

    .stage {
        grid-row: 2;
        position: relative;
        min-height: 0;
    }

    /* Dot pager: a small capsule of dots, the current section stretched into a black pill with
       its name. The black pill is the liquid indicator; the script keeps it on the growing pill. */
    .nav {
        grid-row: 3;
        justify-self: center;
        position: relative;
        left: auto;
        top: auto;
        translate: none;
        transform: translateY(14px);
        flex-direction: row;
        align-items: center;
        gap: 2px;
        margin: 6px 0 14px;
        padding: 5px;
        border-radius: 999px;
        corner-shape: superellipse(1.25);
        background: var(--pill);
    }

    .nav .nav-pill,
    .nav .nav-pill:hover,
    .nav > .nav-pill:active:not(.is-active) {
        background: transparent;
    }

    .nav-pill {
        flex: none;
        display: grid;
        place-items: center;
        width: 30px;
        height: 36px;
        padding: 0;
        overflow: hidden;
        font-size: 15px;
        color: #fff;
        touch-action: manipulation;
        transition: width 0.55s cubic-bezier(0.34, 1.3, 0.64, 1), color 0.35s ease;
    }

    .nav-pill.is-active {
        width: calc(var(--lw, 48px) + 30px);
    }

    /* the name only shows on the current pill, revealed from the middle as it widens */
    .nav-label {
        white-space: nowrap;
        opacity: 0;
        filter: blur(4px);
        transition: opacity 0.18s ease, filter 0.18s ease;
    }

    .nav-pill.is-active .nav-label {
        opacity: 1;
        filter: none;
        transition: opacity 0.4s ease 0.12s, filter 0.4s ease 0.12s;
    }

    .nav-pill::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        width: 7px;
        height: 7px;
        margin: -3.5px 0 0 -3.5px;
        border-radius: 50%;
        background: #c4c4ca;
        transition: opacity 0.3s ease, scale 0.45s var(--ease-out), background 0.25s ease;
    }

    .nav-pill.is-active::before {
        opacity: 0;
        scale: 0.2;
    }

    .nav-pill:active:not(.is-active)::before {
        scale: 1.5;
        background: var(--grey);
        transition-duration: 0.12s;
    }

    .nav-dots {
        display: none;
    }

    /* Content sits between the status bar and the nav, centred when it fits, scrolling when it doesn't */
    .panel {
        padding: calc(20px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-left)) 20px max(24px, env(safe-area-inset-right));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        align-items: flex-start;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    .panel::-webkit-scrollbar {
        display: none;
    }

    .panel > :first-child {
        margin-top: auto;
    }

    .panel > :last-child {
        margin-bottom: auto;
    }

    .panel-about,
    .panel-split {
        flex-direction: column;
        align-items: stretch;
        gap: 28px;
    }

    .panel-about {
        gap: 26px;
    }

    .about-photo {
        width: clamp(124px, 38vw, 156px);
        margin-left: -6px;
    }

    .statement {
        font-size: clamp(25px, 7vw, 31px);
        line-height: 1.24;
        letter-spacing: -0.028em;
        text-wrap: pretty;
    }

    /* centred lines break evenly instead of leaving one word (or emoji) alone */
    .panel-life .statement,
    .panel-contact .statement {
        text-wrap: balance;
    }

    /* About reads as two beats on a phone: who, then where */
    .panel-about .statement > .muted {
        display: block;
        margin-top: 0.55em;
    }

    .statement-sm {
        font-size: clamp(20px, 5.6vw, 24px);
        margin-top: 14px;
    }

    .title {
        font-size: clamp(52px, 15vw, 72px);
    }

    .lede {
        margin-top: 14px;
        font-size: 17px;
    }

    .media-card {
        flex: none;
        width: 100%;
        border-radius: 30px;
    }

    /* Apps: a sideways carousel that runs edge to edge, the next app peeking in */
    .app-grid {
        display: flex;
        gap: 22px;
        width: auto;
        align-self: stretch;
        margin: 22px -24px -14px;
        padding: 6px 24px 14px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 24px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .app-grid::-webkit-scrollbar {
        display: none;
    }

    .app-grid::after {
        content: '';
        flex: none;
        width: 2px;
    }

    .app {
        flex: 0 0 min(78%, 300px);
        scroll-snap-align: start;
    }

    .app-shots {
        --sh: clamp(190px, 28vh, 240px);
        margin-left: -4px;
    }

    .app-id {
        margin-top: 18px;
    }

    .app-icon {
        width: 48px;
        height: 48px;
    }

    .app-desc {
        margin-top: 10px;
        max-width: none;
    }

    /* Journey: the words a touch darker so the list still reads at a glance */
    .index {
        margin-top: 18px;
    }

    .index li {
        -webkit-tap-highlight-color: transparent;
    }

    .index .w {
        font-size: clamp(25px, 7.4vw, 30px);
        line-height: 1.2;
        color: #d2d2d8;
    }

    .index .m {
        font-size: 13px;
    }

    .index .d {
        font-size: 15px;
        padding: 3px 0 14px 6px;
    }

    .index li.is-active .w {
        transform: translateX(6px);
    }

    .bounceCardsContainer {
        width: 100%;
        height: 250px;
    }

    .bounceCardsContainer .card {
        width: 160px;
        height: 160px;
    }

    .map-card {
        border-radius: 30px;
        rotate: 1.5deg;
    }

    .panel-contact {
        align-items: center;
        text-align: center;
    }

    .talk-title {
        font-size: clamp(76px, 25vw, 120px);
    }

    .panel-life .statement-sm,
    .panel-contact .statement-sm {
        margin-left: auto;
        margin-right: auto;
    }

    /* Email, X and LinkedIn on one line */
    .talk-pills {
        flex-wrap: nowrap;
        gap: 8px;
        margin-top: 32px;
    }

    .talk-pills .pill {
        padding: 15px 24px;
        font-size: 17px;
    }

    /* Case study sheet: room for the notch and the home bar, close button within thumb reach */
    .app-sheet {
        place-items: start center;
        padding: calc(76px + env(safe-area-inset-top)) 24px calc(48px + env(safe-area-inset-bottom));
    }

    .app-sheet-close {
        top: calc(16px + env(safe-area-inset-top));
        right: 16px;
    }

    .app-sheet-icon {
        width: 104px;
    }

    .app-sheet-name {
        margin-top: 18px;
        font-size: 40px;
    }

    .app-sheet-desc {
        font-size: 20px;
    }

    .app-sheet-store {
        padding: 14px 26px;
    }

    .app-sheet-case {
        margin-top: 40px;
    }

    .app-sheet-case p,
    .app-sheet-case h4 {
        font-size: 16px;
    }

    .calm-title {
        font-size: 40px;
    }
}

@media (max-width: 600px) {
    .bounceCardsContainer {
        height: 210px;
    }

    .bounceCardsContainer .card {
        width: 128px;
        height: 128px;
        border-width: 4px;
        border-radius: 20px;
    }
}

/* Small phones (SE, mini): a little tighter so most sections still fit without scrolling */
@media (max-width: 820px) and (max-height: 700px) {
    .about-photo {
        width: 118px;
    }

    .panel-about {
        gap: 20px;
    }

    .title {
        font-size: clamp(46px, 13vw, 60px);
    }

    .app-shots {
        --sh: 180px;
    }

    .app-grid {
        margin-top: 16px;
    }

    .talk-title {
        font-size: clamp(68px, 22vw, 100px);
    }
}

/* ========================================
   Touch screens: no hover, so nothing sticks in its hover state after a tap.
   Taps get a quick press instead.
   ======================================== */
@media (hover: none) {
    .nav-pill:hover {
        color: var(--grey-dark);
        background: var(--pill);
    }

    .nav-pill.is-active:hover {
        color: #fff;
        background: transparent;
    }

    .nav-pill:active:not(.is-active) {
        background: var(--pill-hover);
    }

    .pill,
    .hi-pill,
    .about-photo,
    .app-icon,
    .app-shots img {
        -webkit-tap-highlight-color: transparent;
    }

    .pill:hover {
        transform: none;
        background: var(--pill);
    }

    .pill-solid:hover {
        background: var(--ink);
    }

    .pill:active {
        transform: scale(0.95);
        transition-duration: 0.12s;
    }

    .hi-pill:hover {
        background: var(--pill);
    }

    .hi-pill:hover img {
        transform: none;
    }

    .memoji:hover {
        transform: none;
    }

    .app:hover .app-shots img:nth-child(1) {
        transform: none;
        box-shadow: 0 10px 26px rgba(17, 17, 20, 0.14), 0 0 0 1px rgba(17, 17, 20, 0.04);
    }

    .app:hover .app-shots img:nth-child(2) {
        transform: translateX(-42%) rotate(-8deg) scale(0.9);
    }

    .app:hover .app-shots img:nth-child(3) {
        transform: translateX(42%) rotate(8deg) scale(0.9);
    }

    .app:hover .app-icon {
        transform: none;
    }

    .app:hover .app-name b i {
        opacity: 1;
        transform: none;
    }

    /* the arrow is the only hint on touch that a card opens */
    .app-name b i {
        opacity: 1;
        transform: none;
    }

    .app:active .app-shots img:nth-child(1) {
        transform: scale(0.97);
        transition-duration: 0.2s;
    }

    .map-card:hover {
        rotate: 1.5deg;
        scale: 1;
        box-shadow: 0 20px 60px rgba(17, 17, 20, 0.1);
    }

    .media-film:hover .film-poster,
    .media-film:hover .film-video {
        transform: none;
    }

    .app-sheet-close:hover {
        background: var(--pill);
        transform: none;
    }

    /* Film: a small white "Play" pill in the corner says the still is a video, like a caption,
       so it never covers the shot. It slips away once the film plays. */
    .media-film {
        cursor: pointer;
    }

    .media-film::after {
        content: 'Play';
        position: absolute;
        left: 14px;
        bottom: 14px;
        z-index: 2;
        padding: 7px 14px 7px 29px;
        border-radius: 999px;
        corner-shape: superellipse(1.25);
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.9v14.2c0 1 1.1 1.6 1.9 1.1l11.2-7.1c.8-.5.8-1.7 0-2.2L8.9 3.8C8.1 3.3 7 3.9 7 4.9z' fill='%23111114'/%3E%3C/svg%3E") 12px 50% / 12px no-repeat;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
        font-family: var(--font-hero);
        font-weight: 600;
        font-size: 14px;
        line-height: 1.3;
        letter-spacing: -0.01em;
        color: var(--ink);
        pointer-events: none;
        transition: opacity 0.35s ease, translate 0.5s var(--ease-out), filter 0.35s ease;
    }

    .media-film:active::after {
        scale: 0.95;
    }

    .media-film.is-hovered::after {
        opacity: 0;
        translate: 0 8px;
        filter: blur(4px);
    }
}

@media (max-height: 640px) and (min-width: 821px) {
    .about-photo {
        width: 132px;
    }

    .title {
        font-size: clamp(48px, 6vw, 84px);
    }

    .panel {
        padding-top: 84px;
        padding-bottom: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
}

/* Zürich clock: digits keep their width as the minutes tick */
#zrhTime {
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Keyboard shortcuts ("?")
   The page blurs like the app case studies and the keys sit right on the blur.
   No card. Pressing a key presses its cap.
   ======================================== */
.keys {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(26px) saturate(1.1);
    backdrop-filter: blur(26px) saturate(1.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.keys[hidden] {
    display: none;
}

.keys.is-open {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.keys-title {
    margin-bottom: 26px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--muted);
}

.keys-list {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    column-gap: 22px;
    row-gap: 16px;
    margin: 0;
}

.keys-list dt {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.keys-list dt i {
    font-style: normal;
    font-family: var(--font-hero);
    font-size: 13px;
    color: var(--muted);
}

.keys-list dd {
    margin: 0;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: clamp(18px, 1.6vw, 21px);
    letter-spacing: -0.015em;
    color: var(--ink);
}

/* Lines come in one after another with a touch of bounce */
.keys-title,
.keys-list > * {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.keys.is-open .keys-title,
.keys.is-open .keys-list > * {
    opacity: 1;
    transform: none;
    transition: opacity 0.4s ease var(--d, 0s), transform 0.6s cubic-bezier(0.34, 1.45, 0.64, 1) var(--d, 0s);
}

.keys.is-open .keys-list > :nth-child(1),
.keys.is-open .keys-list > :nth-child(2) { --d: 0.05s; }
.keys.is-open .keys-list > :nth-child(3),
.keys.is-open .keys-list > :nth-child(4) { --d: 0.1s; }
.keys.is-open .keys-list > :nth-child(5),
.keys.is-open .keys-list > :nth-child(6) { --d: 0.15s; }
.keys.is-open .keys-list > :nth-child(7),
.keys.is-open .keys-list > :nth-child(8) { --d: 0.2s; }

.keys kbd {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(17, 17, 20, 0.08), 0 3px 0 rgba(17, 17, 20, 0.1), 0 8px 20px rgba(17, 17, 20, 0.06);
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    color: var(--ink);
    transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.64, 1), box-shadow 0.35s ease, background 0.35s ease, color 0.35s ease;
}

/* pressed: sinks into its shadow and flashes ink, then springs back */
.keys kbd.is-down {
    transform: translateY(3px);
    background: var(--ink);
    color: #fff;
    box-shadow: 0 0 0 1px var(--ink), 0 0 0 rgba(17, 17, 20, 0), 0 2px 6px rgba(17, 17, 20, 0.1);
    transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.06s ease, color 0.06s ease;
}

@media (prefers-reduced-motion: reduce) {
    .keys,
    .keys-title,
    .keys-list > * {
        transition: opacity 0.2s ease !important;
        transform: none !important;
    }
}

/* The "?" in the top-right corner: invisible until the mouse comes close (script adds .is-near) */
.keys-btn {
    position: fixed;
    top: calc(var(--gutter) + env(safe-area-inset-top));
    right: var(--edge);
    z-index: 41;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--pill);
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: 17px;
    line-height: 1;
    color: var(--grey-dark);
    cursor: pointer;
    opacity: 0;
    scale: 0.7;
    filter: blur(4px);
    pointer-events: none;
    transition: opacity 0.25s ease, scale 0.3s ease, filter 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.keys-btn.is-near,
.keys-btn:focus-visible,
.keys-btn[aria-expanded="true"] {
    opacity: 1;
    scale: 1;
    filter: none;
    pointer-events: auto;
    transition: opacity 0.3s ease, scale 0.5s cubic-bezier(0.34, 1.6, 0.64, 1), filter 0.3s ease, background 0.25s ease,
        color 0.25s ease;
}

.keys-btn:hover {
    background: var(--pill-hover);
    color: var(--ink);
}

.keys-btn[aria-expanded="true"] {
    background: var(--ink);
    color: #fff;
}

/* An open case study has its own close button in that corner, so the "?" steps aside */
body:has(.app-sheet:not([hidden])) .keys-btn {
    opacity: 0;
    scale: 0.7;
    filter: blur(4px);
    pointer-events: none;
}

/* Shortcuts only matter with a keyboard and a mouse */
@media (hover: none), (pointer: coarse) {
    .keys-btn {
        display: none;
    }
}



/* ========================================
   Easter egg: "Calm down." after switching sections too fast
   Same blur as the other overlays, a ring that fills over five seconds.
   ======================================== */
.calm {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(30px) saturate(1.1);
    backdrop-filter: blur(30px) saturate(1.1);
    opacity: 0;
    transition: opacity 0.45s ease;
}

.calm[hidden] {
    display: none;
}

.calm.is-open {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* leaving: the content dissolves first, the blur clears after it */
.calm.is-open.is-leaving {
    opacity: 0;
    transition: opacity 0.6s ease 0.35s;
}

.calm-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* A gauge open at the bottom (270 degrees), rounded at both ends, filling left to right over the top */
.calm-ring {
    position: relative;
    width: 84px;
    height: 84px;
}

.calm-ring svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.calm-ring path {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
}

.calm-track {
    stroke: rgba(17, 17, 20, 0.08);
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.3s ease;
}

.calm.is-open .calm-track {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}

/* pathLength="100" in the markup, so the dash maths is in percent of the arc */
.calm-progress {
    stroke: var(--ink);
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
}

/* starts once the ring has arrived and finishes right as the five seconds are up */
.calm.is-open .calm-progress {
    animation: calmFill 4.55s cubic-bezier(0.45, 0.05, 0.55, 0.95) 0.45s forwards;
}

@keyframes calmFill {
    to {
        stroke-dashoffset: 0;
    }
}

.calm-count {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.calm-title {
    margin-top: 22px;
    font-family: var(--font-hero);
    font-weight: 700;
    font-size: clamp(36px, 4vw, 52px);
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--ink);
}

.calm-sub {
    margin-top: 8px;
    font-family: var(--font-hero);
    font-weight: 600;
    font-size: 17px;
    color: var(--grey-dark);
}

/* ---- Coming in: everything sharpens out of a blur, with a touch of bounce ---- */
.calm-ring,
.calm-sub,
.calm-title .ch {
    opacity: 0;
    filter: blur(10px);
}

.calm-ring {
    transform: scale(0.55);
}

.calm-sub {
    transform: translateY(12px);
}

.calm-title .w {
    display: inline-block;
    white-space: nowrap;
}

.calm-title .ch {
    display: inline-block;
    transform: translateY(0.35em) scale(0.92);
}

.calm.is-open .calm-ring,
.calm.is-open .calm-sub,
.calm.is-open .calm-title .ch {
    opacity: 1;
    filter: none;
    transform: none;
}

.calm.is-open .calm-ring {
    transition: opacity 0.5s ease 0.05s, filter 0.6s ease 0.05s, transform 0.9s cubic-bezier(0.34, 1.5, 0.64, 1) 0.05s;
}

/* the title arrives letter by letter in a quick wave */
.calm.is-open .calm-title .ch {
    transition: opacity 0.5s ease var(--d), filter 0.6s ease var(--d), transform 0.8s cubic-bezier(0.34, 1.5, 0.64, 1) var(--d);
}

.calm.is-open .calm-sub {
    transition: opacity 0.6s ease 0.55s, filter 0.7s ease 0.55s, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.55s;
}

/* ---- Done: the ring gives a small pulse as it completes ---- */
.calm.is-done .calm-ring {
    animation: calmDone 0.36s cubic-bezier(0.34, 1.6, 0.64, 1);
}

@keyframes calmDone {
    40% {
        transform: scale(1.08);
    }
}

/* ---- Leaving: drifts up and dissolves, ring first, then title, then the line under it ---- */
.calm.is-open.is-leaving .calm-ring,
.calm.is-open.is-leaving .calm-sub,
.calm.is-open.is-leaving .calm-title .ch {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(-12px) scale(0.97);
}

.calm.is-open.is-leaving .calm-ring {
    transition: opacity 0.4s ease, filter 0.45s ease, transform 0.5s cubic-bezier(0.55, 0, 0.75, 0.2);
}

.calm.is-open.is-leaving .calm-title .ch {
    transition: opacity 0.4s ease var(--o), filter 0.45s ease var(--o), transform 0.5s cubic-bezier(0.55, 0, 0.75, 0.2) var(--o);
}

.calm.is-open.is-leaving .calm-sub {
    transition: opacity 0.4s ease 0.16s, filter 0.45s ease 0.16s, transform 0.5s cubic-bezier(0.55, 0, 0.75, 0.2) 0.16s;
}

@media (prefers-reduced-motion: reduce) {
    .calm,
    .calm-ring,
    .calm-sub,
    .calm-title .ch {
        transition: opacity 0.2s ease !important;
        transform: none !important;
        filter: none !important;
    }
}

/* ========================================
   Smooth, Apple-like pill corners: a normal round pill whose ends are
   softened with a light superellipse, so the curve flows into the sides.
   Browsers without corner-shape show the plain round pill.
   ======================================== */
.nav-pill,
.nav-indicator,
.nav-dots,
.pill,
.hi-pill {
    border-radius: 999px;
    corner-shape: superellipse(1.25);
}

/* keycaps are little squares, so the full squircle suits them */
.keys kbd {
    corner-shape: squircle;
}
