.works-page {
    margin-top: 40px;
    margin-bottom: 56px;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.works-card {
    display: flex;
    flex-direction: column;
    padding: 26px 24px 22px;
    border-radius: 16px;
    border: 1px solid rgba(16, 35, 42, 0.1);
    background: #fff;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.works-card__cover {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.works-card > *:not(.works-card__cover):not(.works-card__url) {
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.works-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.35s ease;
}

.works-card:hover {
    transform: translateY(-3px);
    border-color: rgba(181, 136, 99, 0.42);
    box-shadow: 0 16px 36px rgba(16, 35, 42, 0.08);
}

.works-card:hover::before {
    transform: scaleY(1);
}

.works-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.works-card__num {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--navy);
    opacity: 0.16;
    transition: opacity 0.3s ease;
}

.works-card:hover .works-card__num {
    opacity: 0.38;
}

.works-card__go {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: rgba(181, 136, 99, 0.12);
}

[dir="rtl"] .works-card__go svg {
    transform: scaleX(-1);
}

.works-card__title {
    margin: 18px 0 0;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.4;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.works-card__url {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    position: relative;
    z-index: 2;
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

.works-card__url-icon {
    flex-shrink: 0;
}

.works-card__url:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.works-card__desc {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(22, 22, 22, 0.68);
}

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

@media (max-width: 640px) {
    .works-grid {
        grid-template-columns: 1fr;
    }
}

/* Work details */
.page-hero--work .page-hero__lead {
    max-width: 46rem;
}

.work-hero__back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    font-weight: 700;
}

.work-hero__back:hover {
    color: #fff;
}

.work-hero__back-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.work-hero__back:hover .work-hero__back-icon {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.32);
    transform: translateX(-3px);
}

[dir="rtl"] .work-hero__back-icon svg {
    transform: scaleX(-1);
}

[dir="rtl"] .work-hero__back:hover .work-hero__back-icon {
    transform: translateX(3px);
}

.work-hero__meta {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.work-hero__url {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: rgba(211, 195, 185, 0.95);
}

.work-hero__url svg {
    width: 18px;
    height: 18px;
}

.work-hero__url:hover {
    color: #fff;
    text-decoration: underline;
}

.work-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.work-page {
    margin-top: 48px;
    margin-bottom: 56px;
}

.work-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 48px;
    align-items: start;
}

.work-block + .work-block {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(16, 35, 42, 0.08);
}

.work-block__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.work-block__num {
    flex-shrink: 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--navy);
    opacity: 0.16;
    padding-top: 2px;
}

.work-block__title {
    margin: 0;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.35;
    color: var(--navy);
}

.work-prose {
    margin: 0;
    white-space: pre-line;
    color: rgba(22, 22, 22, 0.72);
    font-size: 16px;
    line-height: 1.95;
}

.work-stats {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.work-stat {
    padding: 18px 16px;
    border-radius: 16px;
    border: 1px solid rgba(16, 35, 42, 0.1);
    background: #fff;
}

.work-stat__n {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--primary);
}

.work-stat__l {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(22, 22, 22, 0.62);
}

.work-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.work-tag {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid rgba(16, 35, 42, 0.1);
    background: #fff;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

.work-tag--hero {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.86);
}

.work-aside {
    display: grid;
    gap: 14px;
    position: sticky;
    top: calc(var(--header-h) + 24px);
}

.work-aside__box {
    padding: 22px 20px;
    border-radius: 16px;
    border: 1px solid rgba(16, 35, 42, 0.1);
    background: #fff;
}

.work-aside__title {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--navy);
}

.work-aside__url {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.work-aside__url svg {
    width: 18px;
    height: 18px;
}

.work-aside__url:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.work-aside__text {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.85;
    color: rgba(22, 22, 22, 0.7);
}

.work-thanks {
    margin: 0;
    padding: clamp(4rem, 7vw, 5.5rem) 0;
    border-top: 1px solid rgba(16, 35, 42, 0.08);
    background-color: color-mix(in srgb, #dfe3e6 32%, #ffffff);
}

.work-thanks__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 820px;
}

.work-thanks__icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(181, 136, 99, 0.14);
    color: var(--primary);
}

.work-thanks__body {
    min-width: 0;
}

.work-thanks__title {
    margin: 0;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--navy);
}

.work-thanks__text {
    margin: 10px 0 0;
    font-size: 16px;
    line-height: 1.9;
    font-weight: 400;
    color: rgba(22, 22, 22, 0.72);
}

@media (max-width: 1024px) {
    .work-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .work-aside {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 640px) {
    .work-page {
        margin-top: 36px;
        margin-bottom: 40px;
    }

    .work-aside {
        grid-template-columns: 1fr;
    }

    .work-stats {
        grid-template-columns: 1fr;
    }
}
