@keyframes settle {
    from {
        opacity: 0;
        transform: scale(1.04);
    }
}

html:has(.project-main) {
    scrollbar-width: none;
}

html:has(.project-main)::-webkit-scrollbar {
    display: none;
}

.intro-waiting .project-hero-img,
.intro-waiting .project-hero-links {
    opacity: 0;
}

.intro-in .project-hero-img {
    animation: settle 1.2s var(--ease-out) both;
}

.intro-in .project-hero-links {
    animation: rise 0.7s var(--ease-out) 0.46s both;
}

.project-hero {
    position: relative;
    isolation: isolate;
    height: 100svh;
    overflow: hidden;
    background: var(--black);
}

.project-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(33, 7, 16, 0.7) 0%, rgba(33, 7, 16, 0) 24%, rgba(33, 7, 16, 0) 32%, rgba(33, 7, 16, 0.66) 58%, rgba(33, 7, 16, 0.96) 100%);
    pointer-events: none;
}

.project-hero-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

.article-header {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    max-width: 1100px;
    box-sizing: border-box;
    padding: clamp(32px, 5vh, 56px) var(--pad-edge);
    pointer-events: none;
}

.article-header > * {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.article-header.loaded > * {
    opacity: 1;
    transform: none;
}

.article-header.loaded > :nth-child(2) { transition-delay: 80ms; }
.article-header.loaded > :nth-child(3) { transition-delay: 160ms; }
.article-header.loaded > :nth-child(4) { transition-delay: 240ms; }

.article-title {
    margin: 0 0 clamp(16px, 2.4vh, 28px);
    color: var(--white);
    font-size: clamp(44px, 7.2vw, 120px);
    line-height: 0.95;
}

.article-subtitle {
    max-width: 52ch;
    margin: 0 0 clamp(20px, 3.4vh, 36px);
    color: var(--text);
    font-size: clamp(16px, 1.35vw, 20px);
    font-weight: 400;
    line-height: 1.5;
}

.article-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 16px clamp(28px, 4vw, 56px);
    margin: 0 0 clamp(20px, 3vh, 32px);
}

.article-facts dt {
    margin: 0 0 6px;
    color: var(--text-faint);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.article-facts dd {
    margin: 0;
    color: var(--white);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 10px;
    border: 1px solid currentColor;
    border-radius: var(--radius-pill);
    color: var(--white);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.project-hero-links {
    position: absolute;
    right: var(--pad-edge);
    bottom: clamp(32px, 5vh, 56px);
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    max-width: min(440px, calc(100% - 2 * var(--pad-edge)));
}

.project-hero-live,
.project-cta-bottom-link {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 12px 22px;
    border: 1px solid var(--white);
    border-radius: var(--radius-pill);
    background: var(--white);
    color: var(--black);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: font-weight 0.15s var(--ease-out);
}

.project-hero-live:hover,
.project-hero-live:focus-visible,
.project-cta-bottom-link:hover,
.project-cta-bottom-link:focus-visible {
    font-weight: 800;
}

:where(.project-main) > section {
    display: block;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: clamp(96px, 20vh, 240px) max(var(--pad-edge), calc((100% - var(--container-width)) / 2)) 0;
}

.project-main .title {
    max-width: none;
    margin: 0 0 clamp(48px, 9vh, 112px);
}

.case-prose p,
.case-intro p {
    max-width: 58ch;
    margin: 0 0 1.5em;
    color: var(--text);
    font-size: clamp(16px, 1.3vw, 20px);
    font-weight: 400;
    line-height: 1.75;
}

.case-intro {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(16px, 2vw, 32px);
}

.case-intro .title {
    grid-column: 1 / span 5;
    grid-row: 1 / span 4;
    align-self: start;
    margin-bottom: 0;
}

.case-intro > :not(.title) {
    grid-column: 6 / -1;
}

.case-team {
    max-width: 62ch;
    margin: clamp(8px, 2vh, 20px) 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--hairline);
    color: var(--text-faint);
    font-size: 13px;
    letter-spacing: 0.02em;
    line-height: 1.6;
}

.case-pullquote {
    padding-top: clamp(128px, 24vh, 300px);
}

.pullquote {
    max-width: 20em;
    margin: 0 auto;
    color: var(--white);
    font-family: var(--font-display);
    font-size: clamp(30px, 4.4vw, 72px);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.08;
    text-align: center;
    text-wrap: balance;
}

.pullquote::before {
    content: '\201C';
    display: block;
    height: 0.5em;
    margin-bottom: 0.2em;
    color: var(--accent);
    font-size: 1.6em;
    line-height: 1;
}

.case-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(16px, 2vw, 32px);
    align-items: center;
    margin-top: clamp(96px, 18vh, 220px);
}

.case-chapter > .title + .case-row {
    margin-top: 0;
}

.case-prose {
    grid-column: 1 / span 5;
    grid-row: 1;
}

.case-panel {
    grid-column: 7 / -1;
    grid-row: 1;
    min-width: 0;
    margin: 0;
}

.case-row--reverse .case-panel {
    grid-column: 1 / span 6;
}

.case-row--reverse .case-prose {
    grid-column: 8 / -1;
}

.case-row > :only-child {
    grid-column: 1 / -1;
}

.case-heading {
    margin: 0 0 clamp(16px, 2.6vh, 28px);
    color: var(--white);
    font-size: clamp(28px, 2.6vw, 44px);
    line-height: 1.1;
}

.case-panel img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78svh;
    object-fit: contain;
}

.media-caption {
    margin: 12px 0 0;
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.4;
}

.media-caption a {
    color: inherit;
    text-decoration: none;
    transition: font-weight 0.15s var(--ease-out);
}

.media-caption a:hover,
.media-caption a:focus-visible {
    font-weight: 800;
}

.quote-grid {
    display: grid;
    gap: 12px;
}

.quote-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 22px;
    border: 1px solid var(--hairline);
}

.quote-card blockquote {
    margin: 0;
    color: var(--white);
    font-size: 15px;
    line-height: 1.6;
}

.quote-card footer {
    color: var(--text-faint);
    font-size: 12px;
    letter-spacing: 0.02em;
}

.quote-card footer strong {
    color: var(--white);
    font-weight: 700;
}

.case-table-scroll {
    width: 100%;
}

.case-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.case-table th,
.case-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--hairline);
    text-align: left;
}

.case-table thead th {
    color: var(--text-faint);
    font-size: 13px;
    font-weight: 600;
}

.case-table td:first-child {
    color: var(--white);
}

.case-table td:not(:first-child),
.case-table th:not(:first-child) {
    width: 72px;
    text-align: center;
}

.case-table tbody tr:last-child td {
    border-bottom: 0;
}

.case-table-hint {
    display: none;
}

.col-must { color: var(--accent); }
.col-should { color: var(--white); }
.col-could { color: var(--text); }
.col-wont { color: var(--text-faint); }

.case-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(20px, 2.6vw, 40px);
    align-items: start;
}

.gallery-item {
    margin: 0;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
}

.project-cta-bottom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(40px, 6vw, 100px);
    align-items: center;
    padding-bottom: clamp(96px, 20vh, 240px);
}

.project-cta-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(16px, 3vh, 28px);
}

.project-cta-heading {
    margin: 0;
    color: var(--white);
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 80px);
    font-style: italic;
    font-weight: 400;
    line-height: 1.05;
}

.project-cta-preview {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--hairline);
    background: var(--ink);
}

.project-cta-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}

.project-cta-video {
    aspect-ratio: 16 / 9;
}

.project-cta-video iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.project-cta-preview:hover img,
.project-cta-preview:focus-visible img {
    transform: scale(1.04);
}

.project-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    background: var(--black);
}

.project-pager-item {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
    min-height: clamp(220px, 32vh, 360px);
    padding: clamp(24px, 4vw, 48px);
    overflow: hidden;
    background: var(--black);
    text-decoration: none;
}

.project-pager-item:focus-visible {
    outline-offset: -4px;
}

.project-pager-item--next {
    justify-content: flex-end;
    border-left: 1px solid var(--hairline);
    text-align: right;
}

.project-pager-img {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--ink) center / cover;
    opacity: 0.28;
    transform: scale(1.05);
    transition: opacity 0.5s ease, transform 0.6s ease;
}

.project-pager-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(33, 7, 16, 0.1) 0%, rgba(33, 7, 16, 0.75) 100%);
}

.project-pager-item:hover .project-pager-img,
.project-pager-item:focus-visible .project-pager-img {
    opacity: 0.5;
    transform: scale(1);
}

.project-pager-meta {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1vh, 12px);
}

.project-pager-dir {
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
}

.project-pager-title {
    color: var(--white);
    font-family: var(--font-display);
    font-size: clamp(26px, 3.6vw, 56px);
    font-style: italic;
    font-weight: 400;
    line-height: 1.05;
}

.project-pager-role {
    color: var(--white);
    font-size: clamp(12px, 1vw, 15px);
    font-weight: 500;
}

.project-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: 60vh;
    padding: var(--pad-edge);
    text-align: center;
}

.project-not-found p {
    margin: 0;
    color: var(--white);
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 64px);
    font-style: italic;
}

.project-not-found a {
    color: var(--white);
    font-size: 16px;
    text-decoration: none;
    transition: font-weight 0.15s var(--ease-out);
}

.project-not-found a:hover,
.project-not-found a:focus-visible {
    font-weight: 800;
}

.reading-progress {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 999;
    height: 3px;
    background: var(--hairline);
    pointer-events: none;
}

.reading-progress > span {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}

figure.case-panel,
.gallery-item {
    position: relative;
}

.is-waiting {
    visibility: hidden;
}

@media (max-width: 1024px) {
    .case-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-pager {
        grid-template-columns: 1fr;
    }

    .project-pager-item--next {
        justify-content: flex-start;
        border-top: 1px solid var(--hairline);
        border-left: 0;
        text-align: left;
    }
}

@media (max-width: 768px) {
    .project-hero {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        height: auto;
        min-height: 100svh;
        box-sizing: border-box;
        padding: max(96px, calc(env(safe-area-inset-top) + 72px)) var(--pad-edge) max(24px, env(safe-area-inset-bottom));
    }

    .project-hero::after {
        background: linear-gradient(180deg, rgba(33, 7, 16, 0.6) 0%, rgba(33, 7, 16, 0.15) 14%, rgba(33, 7, 16, 0.88) 40%, rgba(33, 7, 16, 0.97) 100%);
    }

    .article-header,
    .project-hero-links {
        position: relative;
        right: auto;
        bottom: auto;
        left: auto;
        max-width: none;
    }

    .article-header {
        padding: 0 0 20px;
    }

    .article-title {
        font-size: clamp(40px, 12vw, 64px);
    }

    .article-subtitle {
        max-width: 34ch;
        font-size: 16px;
    }

    .project-hero-links {
        justify-content: flex-start;
    }

    :where(.project-main) > section {
        padding-top: 72px;
    }

    .project-main .title {
        margin-bottom: 28px;
        font-size: clamp(40px, 12vw, 64px);
    }

    .case-intro,
    .case-row {
        display: block;
    }

    .case-prose p,
    .case-intro p {
        font-size: clamp(16px, 4.4vw, 18px);
    }

    .case-panel {
        margin-top: 32px;
    }

    .case-row--reverse .case-panel {
        margin-top: 32px;
    }

    .case-row {
        margin-top: 72px;
    }

    .pullquote {
        font-size: clamp(26px, 7.2vw, 38px);
    }

    .case-panel img {
        max-height: 72svh;
    }

    .case-table-scroll {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        border: 1px solid var(--hairline);
    }

    .case-table {
        min-width: 620px;
        font-size: 13px;
    }

    .case-table-hint {
        display: block;
        margin: 10px 0 0;
        color: var(--text-faint);
        font-size: 13px;
        line-height: 1.4;
    }

    .project-cta-bottom {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-bottom: 72px;
    }


    .project-pager-item {
        min-height: clamp(160px, 24vh, 220px);
        padding: 24px var(--pad-edge);
    }

    .project-pager-img {
        opacity: 0.38;
    }

    .project-pager-title {
        font-size: clamp(24px, 7vw, 36px);
    }

    .reading-progress {
        top: 0;
        bottom: auto;
        height: 2px;
        z-index: 1001;
    }
}

@media (max-width: 520px) {
    .case-gallery-grid {
        grid-template-columns: 1fr;
    }
}

@media (hover: none) {
    .project-hero-live:active,
    .project-cta-bottom-link:active,
    .project-pager-item:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-header > * {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .project-pager-img {
        transition: none;
    }
}

@media (max-height: 500px) {
    .article-tags {
        display: none;
    }
}
