/* The projects page (p-ujw3oo5-work.html). */

.work-page {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.work-page .main-header .logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.work {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 56px) 120px;
}

/* --- The opening --- */
.work-hero {
    padding: clamp(56px, 12vh, 140px) 0 clamp(40px, 7vh, 80px);
}

.work-title {
    margin: 0;
    font-weight: var(--fw-light);
    font-size: clamp(64px, 15vw, 230px);
    line-height: 0.86;
    letter-spacing: -0.055em;
    display: flex;
    align-items: flex-start;
}

.work-title-word {
    display: inline-block;
    animation: w-rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.work-count {
    font-size: clamp(16px, 2vw, 26px);
    font-weight: var(--fw-regular);
    letter-spacing: 0;
    color: var(--accent-orange);
    margin: 0.5em 0 0 0.35em;
    font-variant-numeric: tabular-nums;
}

.work-lead {
    max-width: 52ch;
    margin: clamp(32px, 5.5vh, 56px) 0 0;
    font-size: clamp(17px, 1.6vw, 22px);
    line-height: 1.5;
    color: var(--text-secondary);
    animation: w-rise 1.1s 0.12s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.work-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: clamp(32px, 6vh, 56px);
    animation: w-rise 1.1s 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.work-filter {
    font: inherit;
    font-size: 14px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    transition: color 0.3s, background 0.3s, border-color 0.3s;
}

.work-filter:hover { color: var(--text-primary); border-color: rgba(255, 255, 255, 0.3); }
.work-filter.is-on { color: var(--bg-dark); background: var(--text-primary); border-color: var(--text-primary); }

@keyframes w-rise {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: none; }
}

/* --- The index --- */
.work-index {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.w-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: calc(min(var(--i), 8) * 50ms);
}

.w-row.is-in { opacity: 1; transform: none; }

.w-row a {
    display: grid;
    grid-template-columns: 56px 1fr 180px 260px 28px;
    align-items: center;
    gap: 24px;
    padding: clamp(18px, 2.4vw, 30px) 0;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.4s;
}

.w-num {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.w-name {
    font-size: clamp(28px, 4.6vw, 68px);
    font-weight: var(--fw-light);
    letter-spacing: -0.035em;
    line-height: 1.05;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.4s;
}

.w-type, .w-tags {
    font-size: 13px;
    color: var(--text-secondary);
}

.w-arrow {
    color: var(--accent-orange);
    opacity: 0;
    transform: translate(-10px, 10px);
    transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.w-thumb { display: none; }

@media (hover: hover) and (pointer: fine) {
    .work-index:hover .w-row a { opacity: 0.28; }
    .work-index .w-row a:hover { opacity: 1; }
    .w-row a:hover .w-name { transform: translateX(14px); }
    .w-row a:hover .w-arrow { opacity: 1; transform: none; }
}

/* The picture following the pointer */
.work-float {
    position: fixed;
    left: 0;
    top: 0;
    width: clamp(280px, 30vw, 460px);
    pointer-events: none;
    z-index: 5;
    border-radius: 6px;
    overflow: hidden;
    opacity: 0;
    clip-path: inset(50% 0 50% 0);
    transition: opacity 0.35s, clip-path 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.work-float.is-on { opacity: 1; clip-path: inset(0 0 0 0); }
.work-float img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 1100px) {
    .w-row a { grid-template-columns: 40px 1fr 160px 28px; }
    .w-tags { display: none; }
}

/* Phone: no pointer to follow, so each row carries its picture. */
@media (max-width: 760px), (hover: none) {
    .w-row a {
        grid-template-columns: 32px 1fr;
        gap: 6px 12px;
        padding: 22px 0 28px;
    }
    .w-num { align-self: start; padding-top: 0.9em; }
    .w-type { grid-column: 2; }
    .w-tags, .w-arrow { display: none; }
    .w-thumb {
        display: block;
        grid-column: 1 / -1;
        width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 8px;
        margin-top: 14px;
    }
    .work-float { display: none; }
}

/* --- A project, full screen --- */
html.is-case { overflow: hidden; }

.work-case {
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(10, 10, 14, 0);
    transition: background 0.6s;
    padding: 0 clamp(16px, 4vw, 56px);
}

.work-case.is-open { background: rgb(10, 10, 14); }

.work-case > :not(.c-hero) {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.work-case.is-ready > :not(.c-hero) { opacity: 1; transform: none; }
.work-case.is-ready > .c-head { transition-delay: 0.05s; }
.work-case.is-ready > .c-story { transition-delay: 0.15s; }
.work-case.is-swap > * { opacity: 0 !important; transition: opacity 0.35s !important; }

.work-case > * { max-width: 1320px; margin-left: auto; margin-right: auto; }

.c-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    background: linear-gradient(rgb(10, 10, 14) 60%, rgba(10, 10, 14, 0));
}

.c-back, .c-present {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 9px 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.3s;
}

.c-back:hover, .c-present:hover { background: rgba(255, 255, 255, 0.12); }

.c-pos {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.c-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: end;
    padding: clamp(40px, 9vh, 110px) 0 clamp(32px, 5vh, 56px);
}

.c-title {
    margin: 0;
    font-size: clamp(48px, 9vw, 150px);
    font-weight: var(--fw-light);
    letter-spacing: -0.05em;
    line-height: 0.9;
}

.c-meta {
    display: flex;
    gap: 40px;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.c-meta dt { color: var(--text-secondary); margin-bottom: 6px; }
.c-meta dd { margin: 0; }

.c-link {
    color: var(--accent-orange);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.c-shot {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    transform-origin: 0 0;
}

.c-view {
    position: relative;
    aspect-ratio: var(--ar);
    background: #121217;
}

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

/* A project whose picture is a film: the film over the still, shown once it
   is playing, so the still is what flies in and what stays if it cannot. */
.c-hero-film {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s;
}

.c-hero-film.is-on { opacity: 1; }

.c-shot.is-web {
    background: #1b1b21;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* The site itself, over its picture until it has drawn itself */
.c-view iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    opacity: 0;
    transition: opacity 0.7s;
}

.c-shot.is-loaded iframe { opacity: 1; }
.c-shot.is-loaded .c-hero-img { visibility: hidden; transition: visibility 0s 0.7s; }
.work-case.is-passing .c-view iframe { pointer-events: none; }

/* A live web project gets a taller window, closer to a real browser's */
.c-shot.is-live .c-view { aspect-ratio: auto; height: min(78vh, 760px); }

.c-tool {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.25s, background 0.25s;
}

.c-tool:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }
.c-grow .i-shrink { display: none; }
.work-case.is-full .c-grow .i-grow { display: none; }
.work-case.is-full .c-grow .i-shrink { display: inline; }

.c-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    vertical-align: 1px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.5s, box-shadow 0.5s;
}

.c-shot.is-loaded .c-dot { background: #3ddc84; box-shadow: 0 0 8px rgba(61, 220, 132, 0.6); }

/* Phones only: a word on the window saying it can be opened */
.c-touch { display: none; }

/* The window as the whole screen, over a dimmed case study */
.work-case.is-full { overflow: hidden; }
.work-case.is-full::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 4;
    background: rgba(6, 6, 9, 0.8);
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
}

.work-case.is-full .c-shot {
    position: fixed;
    inset: clamp(12px, 2.4vw, 32px);
    z-index: 5;
    display: flex;
    flex-direction: column;
}

.work-case.is-full .c-view { flex: 1; height: auto; }

.c-chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    background: #1f1f26;
}

.c-chrome i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.c-chrome .c-url {
    flex: 0 1 360px;
    margin: 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    min-height: 1.5em;
}

.w-ghost {
    position: fixed;
    z-index: 2100;
    object-fit: cover;
    transform-origin: 0 0;
    pointer-events: none;
}

.c-story {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px 48px;
    padding: clamp(72px, 12vh, 140px) 0 0;
}

.c-story h3 {
    margin: 0;
    font-size: 14px;
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    padding-top: 0.5em;
}

.c-story p {
    margin: 0 0 clamp(40px, 7vh, 72px);
    max-width: 46ch;
    font-size: clamp(17px, 1.5vw, 21px);
    line-height: 1.6;
}

.c-story p.c-big {
    max-width: 24ch;
    font-size: clamp(26px, 3.2vw, 46px);
    font-weight: var(--fw-light);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* A project shown at length: a chapter per screen, the words on one side and
   the screen on the other, swapping sides as they go. */
.c-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
    gap: clamp(28px, 4vw, 80px);
    align-items: center;
    padding: clamp(48px, 9vh, 100px) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.c-story + .c-screen { margin-top: clamp(56px, 9vh, 110px); }

.c-screen:nth-of-type(even) { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.c-screen:nth-of-type(even) .c-screen-words { order: 2; }

.c-screen-n {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--accent-orange);
    font-variant-numeric: tabular-nums;
}

.c-screen-words h3 {
    margin: 0;
    font-size: clamp(24px, 2.4vw, 38px);
    font-weight: var(--fw-light);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.c-screen-words p {
    margin: 16px 0 0;
    max-width: 40ch;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.c-screen-shot {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.c-screen-shot img,
.c-screen-shot video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #0e0e12;
}

.c-screen.is-phone .c-screen-shot video { aspect-ratio: 390 / 844; }

/* A picture keeps its own shape (--ar, its width / height), and a tall one
   is narrowed so it is never much taller than the screen. */
.c-screen.is-picture .c-screen-shot {
    justify-self: center;
    width: min(100%, calc(80vh * var(--ar)));
}

.c-screen.is-picture .c-screen-shot img,
.c-screen.is-picture .c-screen-shot video { aspect-ratio: var(--ar); }

/* The phone is a phone: narrow, round-cornered, in the middle of its side. */
.c-screen.is-phone .c-screen-shot {
    justify-self: center;
    width: min(320px, 78vw);
    padding: 9px;
    border-radius: 44px;
    background: #111116;
}

.c-screen.is-phone .c-screen-shot img,
.c-screen.is-phone .c-screen-shot video { border-radius: 36px; }

/* Presented: the screen rises out of a slight tilt and settles flat, the
   words a beat behind it, as each chapter comes into view. Inside its frame
   the picture drifts against the scroll (--drift, set by js/work.js). */
.c-screen-shot {
    transform: perspective(1600px) translateY(80px) rotateX(9deg) scale(0.94);
    transform-origin: 50% 100%;
    opacity: 0;
    transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 1s ease, box-shadow 0.6s;
}

.c-screen.is-in .c-screen-shot {
    transform: none;
    opacity: 1;
}

.c-screen-shot img,
.c-screen-shot video {
    transform: translateY(var(--drift, 0px)) scale(1.035);
    transition: transform 0.25s linear;
    will-change: transform;
}

.c-screen.is-phone .c-screen-shot img,
.c-screen.is-phone .c-screen-shot video { transform: none; }

.c-screen.is-in .c-screen-shot:hover {
    transform: translateY(-6px);
    box-shadow: 0 60px 140px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.c-screen-words > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.c-screen.is-in .c-screen-words > * { opacity: 1; transform: none; }
.c-screen.is-in .c-screen-words > :nth-child(1) { transition-delay: 0.25s; }
.c-screen.is-in .c-screen-words > :nth-child(2) { transition-delay: 0.35s; }
.c-screen.is-in .c-screen-words > :nth-child(3) { transition-delay: 0.45s; }

@media (prefers-reduced-motion: reduce) {
    .c-screen-shot, .c-screen-words > *, .c-screen-shot img, .c-screen-shot video { transition: none; transform: none; opacity: 1; }
}

@media (max-width: 900px) {
    .c-screen,
    .c-screen:nth-of-type(even) { grid-template-columns: 1fr; }
    .c-screen:nth-of-type(even) .c-screen-words { order: 0; }
}

.c-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: clamp(96px, 16vh, 180px);
    padding: clamp(40px, 6vh, 64px) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.c-cta p {
    margin: 0;
    max-width: 20ch;
    font-size: clamp(26px, 3vw, 42px);
    font-weight: var(--fw-light);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.c-next {
    position: relative;
    display: block;
    margin-top: clamp(40px, 8vh, 96px);
    margin-bottom: clamp(16px, 4vw, 56px);
    height: clamp(260px, 46vh, 520px);
    border-radius: 14px;
    overflow: hidden;
    color: var(--text-primary);
    text-decoration: none;
}

.c-next img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.42);
    transform: scale(1.04);
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.6s;
}

.c-next:hover img { transform: none; filter: brightness(0.6); }

.c-next-label, .c-next-name { position: relative; z-index: 1; display: block; padding: 0 clamp(20px, 4vw, 48px); }
.c-next-label { padding-top: clamp(20px, 4vw, 44px); font-size: 14px; color: var(--text-secondary); }
.c-next-name {
    position: absolute;
    bottom: clamp(20px, 4vw, 44px);
    font-size: clamp(36px, 7vw, 110px);
    font-weight: var(--fw-light);
    letter-spacing: -0.045em;
    line-height: 0.95;
}

/* Presentation: nothing of ours, only the work */
html.is-present .c-brand-only,
html.is-present .c-pos,
html.is-present .c-back { display: none; }
html.is-present .c-bar { justify-content: flex-end; }
html.is-present .c-present { opacity: 0.35; }
html.is-present .c-present:hover { opacity: 1; }

/* Phones and tablets: the site's own mobile layout in a tall window that
   lets the page scroll past it, until a tap opens it as the whole screen */
@media (hover: none), (max-width: 760px) {
    .c-shot.is-live .c-view { height: min(72vh, 640px); }
    .work-case:not(.is-full) .c-shot.is-live iframe { pointer-events: none; }
    .work-case:not(.is-full) .c-shot.is-live.is-loaded .c-touch {
        display: block;
        position: absolute;
        left: 50%;
        bottom: 16px;
        transform: translateX(-50%);
        z-index: 1;
        padding: 9px 16px;
        border-radius: 999px;
        background: rgba(10, 10, 14, 0.72);
        -webkit-backdrop-filter: blur(12px);
                backdrop-filter: blur(12px);
        color: #fff;
        font-size: 13px;
        white-space: nowrap;
        pointer-events: none;
        animation: w-rise 0.6s 0.4s both;
    }
    .work-case.is-full .c-shot { inset: 0; border-radius: 0; padding-top: env(safe-area-inset-top); }
}

@media (max-width: 900px) {
    .c-head { grid-template-columns: 1fr; gap: 28px; }
    .c-meta { gap: 28px; flex-wrap: wrap; }
    .c-story { grid-template-columns: 1fr; gap: 12px; }
    .c-pos { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .work-title-word, .work-lead, .work-filters { animation: none; }
    .w-row, .work-case > :not(.c-hero) { transition: none; opacity: 1; transform: none; }
}
