:root {
    --as-ink: #171717;
    --as-muted: #686868;
    --as-line: #d8d6d1;
    --as-surface: #f5f4f1;
    --as-accent: #8f3f2f;
}

html:has(body.page-id-98),
body.page-id-98 {
    overflow-x: clip;
}

.as-projects {
    color: var(--as-ink);
    background: #fff;
    font-family: inherit;
}

.as-projects--archive,
.as-project-detail {
    padding: 88px clamp(20px, 4vw, 64px) 112px;
}

.as-projects__intro,
.as-project-detail__header,
.as-project-detail__gallery,
.as-project-detail__footer {
    width: min(100%, 1360px);
    margin-inline: auto;
}

.as-projects__intro {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--as-line);
}

.as-projects__eyebrow {
    margin: 0 0 10px;
    color: var(--as-accent);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
}

.as-projects__intro h2,
.as-project-detail__header h2 {
    margin: 0;
    max-width: 980px;
    color: var(--as-ink);
    font-family: inherit;
    font-size: clamp(34px, 4vw, 64px);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: 0;
}

.as-projects__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 64px 28px;
    width: min(100%, 1360px);
    margin: 48px auto 0;
}

.as-project-card {
    min-width: 0;
    margin: 0;
}

.as-project-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.as-project-card__media {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--as-surface);
}

.as-project-card__media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    object-position: center;
    transition: transform 280ms ease-out, filter 280ms ease-out;
}

.as-project-card__number {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: rgba(17, 17, 17, 0.86);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.as-project-card__body {
    display: block;
    padding-top: 18px;
}

.as-project-card__title,
.as-project-card__subtitle,
.as-project-card__action {
    display: block;
}

.as-project-card__title {
    font-size: 21px;
    font-weight: 500;
    line-height: 1.24;
}

.as-project-card__action {
    margin-top: 16px;
    color: var(--as-ink);
    font-size: 14px;
    font-weight: 600;
}

.as-project-card__link:hover .as-project-card__media img,
.as-project-card__link:focus-visible .as-project-card__media img {
    transform: scale(1.025);
    filter: contrast(1.04);
}

.as-project-card__link:focus-visible,
.as-project-detail__back:focus-visible,
.as-project-media__link:focus-visible,
.as-project-detail__footer a:focus-visible,
.as-project-lightbox button:focus-visible {
    outline: 3px solid var(--as-accent);
    outline-offset: 4px;
}

.as-project-detail__header {
    padding-bottom: 44px;
    border-bottom: 1px solid var(--as-line);
}

.as-project-detail__back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 48px;
    color: var(--as-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.as-project-detail__back span {
    margin-right: 10px;
    font-size: 20px;
}

.as-project-detail__gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px 24px;
    margin-top: 48px;
}

.as-project-media {
    min-width: 0;
    margin: 0;
}

.as-project-media__link {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--as-surface);
}

.as-project-media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    object-position: center;
    transition: transform 220ms ease-out;
}

.as-project-media--plan img,
.as-project-media--crochiu img {
    padding: 24px;
    object-fit: contain;
    box-sizing: border-box;
}

.as-project-media__link:hover img,
.as-project-media__link:focus-visible img {
    transform: scale(1.015);
}

.as-project-media figcaption {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    min-height: 52px;
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--as-line);
    color: var(--as-muted);
    font-size: 13px;
    line-height: 1.4;
}

.as-project-media figcaption span:last-child {
    flex: 0 0 auto;
    color: var(--as-accent);
}

.as-project-detail__footer {
    margin-top: 88px;
    padding-top: 28px;
    border-top: 1px solid var(--as-line);
}

.as-project-detail__footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--as-ink);
    font-weight: 600;
    text-decoration: none;
}

.as-project-detail__footer span {
    margin-right: 10px;
}

.as-project-lightbox {
    width: min(94vw, 1500px);
    height: min(92vh, 980px);
    max-width: none;
    max-height: none;
    padding: 54px 72px 34px;
    border: 0;
    color: #fff;
    background: #111;
}

.as-project-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.82);
}

.as-project-lightbox[open] {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
}

.as-project-lightbox figure {
    display: grid;
    place-items: center;
    min-width: 0;
    height: 100%;
    margin: 0;
}

.as-project-lightbox img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 130px);
    object-fit: contain;
}

.as-project-lightbox figcaption {
    align-self: end;
    margin-top: 12px;
    color: #ddd;
    font-size: 14px;
}

.as-project-lightbox button,
.as-project-lightbox button:hover,
.as-project-lightbox button:focus {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 50% !important;
    color: #fff !important;
    background: #1b1b1b !important;
    box-shadow: none !important;
    font-family: Arial, sans-serif !important;
    font-size: 26px !important;
    font-style: normal !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer;
}

.as-project-lightbox__close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 3;
    font-size: 30px !important;
}

@media (max-width: 980px) {
    .as-projects--archive,
    .as-project-detail {
        padding-block: 64px 88px;
    }

    .as-projects__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap-block: 52px;
    }
}

@media (max-width: 640px) {
    .as-projects--archive,
    .as-project-detail {
        padding: 48px 16px 72px;
    }

    .as-projects__intro {
        display: block;
    }

    .as-projects__intro h2,
    .as-project-detail__header h2 {
        font-size: 36px;
        overflow-wrap: anywhere;
    }

    .as-projects__grid,
    .as-project-detail__gallery {
        grid-template-columns: 1fr;
    }

    .as-projects__grid {
        gap: 48px;
        margin-top: 36px;
    }

    .as-project-card__title {
        font-size: 20px;
    }

    .as-project-detail__back {
        margin-bottom: 36px;
    }

    .as-project-detail__gallery {
        gap: 32px;
    }

    .as-project-media--plan img,
    .as-project-media--crochiu img {
        padding: 16px;
    }

    .as-project-lightbox {
        width: 100vw;
        height: 100dvh;
        padding: 64px 12px 24px;
    }

    .as-project-lightbox[open] {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .as-project-lightbox button {
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .as-project-card__media img,
    .as-project-media img {
        transition: none;
    }
}
