﻿.howto-page {
    background: var(--dark);
}

.howto-page .primary-nav__link[aria-current="page"] {
    color: #fff;
}

.howto-page .primary-nav__link[aria-current="page"]::after {
    transform: translateX(-50%) scaleX(1);
}

.howto-hero {
    position: relative;
    isolation: isolate;
    min-height: clamp(610px, 41vw, 780px);
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 169, 67, 0.16) 0, rgba(255, 169, 67, 0) 27%),
        radial-gradient(circle at 83% 25%, rgba(255, 128, 33, 0.2) 0, rgba(255, 128, 33, 0) 32%),
        linear-gradient(115deg, #db3e17 0%, #e9561b 48%, #f2731d 100%);
}

.howto-hero::after {
    content: "";
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: -1px;
    left: 0;
    height: clamp(170px, 16vw, 300px);
    background: linear-gradient(180deg, rgba(10, 10, 11, 0) 0%, rgba(10, 10, 11, 0.2) 28%, rgba(10, 10, 11, 0.88) 82%, #0a0a0b 100%);
    pointer-events: none;
}



/*
 * Карта на оранжевом — тот же приём, что .hero__map на главной.
 * soft-light подмешивает текстуру в градиент, а не кладёт её сверху
 * серым пятном. Стекающий контекст даёт .howto-hero (isolation: isolate).
 */
.howto-hero__map {
    --howto-map-opacity: 0.12;

    position: absolute;
    inset: 0;
    z-index: 0;

    background: url("../images/home/map2.webp") center / cover no-repeat;

    opacity: var(--howto-map-opacity);
    mix-blend-mode: soft-light;

    pointer-events: none;
}

/* Safari до 15.4 не знает soft-light и нарисовал бы картинку как есть. */
@supports not (mix-blend-mode: soft-light) {
    .howto-hero__map {
        --howto-map-opacity: 0.06;
    }
}

.howto-hero__inner {    position: relative;
    z-index: 5;
    display: flex;
    min-height: inherit;
    padding-top: clamp(175px, 11vw, 215px);
    padding-bottom: 145px;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.howto-hero__title {
    margin-bottom: 28px;
    font-size: 80px;
    font-weight: 800;
    font-family: var(--font-body);
    text-transform: uppercase;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.98) 56%, rgba(255,255,255,0.72) 82%, rgba(255,255,255,0.36) 94%, rgba(255,255,255,0.12) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.howto-hero__lead,
.howto-hero__hint {
    margin-bottom: 0;
    font-family: var(--font-body);
    font-weight: 300;
}

.howto-hero__lead {
    max-width: 660px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--font-body);
    font-size: 25px;
    line-height: 1.45;
}

.howto-store-grid {
    width: min(100%, 690px);
    margin-top: 34px;
    gap: 16px 16px;
}

.howto-store-grid .store-button {
    min-height: 100px;
    gap: 14px;
    padding: 10px 18px;
    border-radius: 8px;
}

.howto-store-grid .store-button > img {
    width: 28px;
    height: 28px;
}

.howto-store-grid .store-button__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    line-height: 1;
    text-align: left;
}

.howto-store-grid .store-button__text small {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1;
}

.howto-store-grid .store-button__text strong {
    line-height: 1;
    font-size: 20px;
    font-family: var(--font-body);
    font-weight: 800;
}

.howto-hero__hint {
    margin-top: 25px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.35;
    font-size: 25px;
    font-weight: 400;
}

.howto-hero__socials {
    top: 51%;
    transform: translate(-50%, -50%);
}

.howto-surface::before {
    opacity: 0.02;
}

.howto-steps {
    position: relative;
    width: 100%;
    max-width: 1160px;
    padding-top: 70px;
    padding-bottom: 88px;
}

.howto-step {
    position: relative;
    display: grid;
    justify-items: center;
}

.howto-step + .howto-step {
    margin-top: clamp(62px, 6vw, 112px);
}

.howto-step__heading {
    width: min(100%, 840px);
    margin-bottom: 34px;
    text-align: center;
}

.howto-step__heading h2 {
    margin-bottom: 18px;
    font-size: 60px;
    font-family: var(--font-body);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    transform: scaleY(1.08);
}

#finish-title {
    margin-bottom: 18px;
    font-size: 60px;
    font-weight: 900;
    font-family: var(--font-body);
    text-transform: uppercase;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.98) 56%, rgba(255,255,255,0.72) 82%, rgba(255,255,255,0.36) 94%, rgba(255,255,255,0.12) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.howto-step__heading h2 span {
    color: #f47c1f;
}

.howto-step__heading p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 18px;
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.55;
}

.howto-shot {
    width: min(100%, 760px);
    margin: 0;
    overflow: hidden;
    border-radius: 18px;
    background: #111113;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

.howto-shot--wide {
    width: min(100%, 850px);
}

.howto-shot img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/*
 * Блок «Поздравляем! Вы в игре» стоит РОВНО ПО ЦЕНТРУ секции —
 * никакого padding-right, сдвигающего его влево.
 *
 * Чтобы центрированный блок при этом не наезжал на персонажей,
 * подогнан сам арт. Замерено по альфа-каналу файла (1248x911):
 * слева у картинки 21.5% пустоты, справа 15.1% — то есть фигуры
 * реально начинаются на 21.5% её ширины. Отсюда условие, при
 * котором пересечения нет:
 *
 *     0.785 * ширина_арта  <=  (ширина_секции - 560) / 2 - отступ_справа
 *
 * При --howto-art-w: min(27vw, 620px) и отступе clamp(8px, 1vw, 28px)
 * оно выполняется с запасом на всех ширинах от 1280px:
 * 20px зазора на 1280, 43px на 1366, 159px на 1920.
 *
 * Ниже 1280px блок 560px и персонажи в одну строку не помещаются
 * физически — там арт скрыт, как и на телефоне.
 */
.howto-finish {
    --howto-art-w: min(27vw, 620px);
    position: relative;
    isolation: isolate;
    display: flex;
    width: min(calc(100% - 92px), 1760px);
    min-height: clamp(260px, 17vw, 330px);
    margin: 6px auto 0;
    overflow: visible;
    border-radius: 24px 24px 0 0;
    background:
        radial-gradient(circle at 72% 34%, rgba(255, 171, 76, 0.28) 0%, rgba(255, 171, 76, 0) 31%),
        linear-gradient(108deg, #d92d16 0%, #e44916 46%, #f16018 100%);
}

.howto-finish::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    border-radius: inherit;
    background: url("../images/brand/dragon-watermark.svg") -50px 35% / 560px auto no-repeat;
    opacity: 0.09;
    filter: brightness(0) invert(1);
    pointer-events: none;
}

/*
 * 100%, а не 46%: с прежними 46% блок на широких экранах ужимался
 * вдвое сильнее нужного, и надписи «GOOGLE PLAY» / «APP STORE»
 * обрезались многоточием. margin-inline: auto ставит его по центру.
 */
.howto-finish__content {
    position: relative;
    z-index: 3;
    width: min(560px, 100%);
    margin-inline: auto;
    padding: 56px 0 46px;
    text-align: center;
}

.howto-finish__content h2 {
    margin-bottom: 0;
    font-size: 60px;
    font-family: var(--font-body);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: 0.01em;
    text-align: center;
    text-transform: uppercase;
    transform: scaleY(1.08);
}

.howto-store-grid--finish {
    width: min(100%, 540px);
    margin: 34px auto 0;
}

/*
 * Арт прижат почти к самому краю секции: каждый лишний отступ справа
 * отбирает место у центрированного блока и приближает пересечение.
 */
.howto-finish__art {
    position: absolute;
    z-index: 2;
    right: clamp(8px, 1vw, 28px);
    bottom: -1px;
    width: var(--howto-art-w);
    height: auto;
    overflow: visible;
    pointer-events: none;
}

.howto-finish__art img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    object-fit: initial;
    overflow: visible;
}

.howto-footer {
    position: relative;
    z-index: 5;
    margin-top: -24px;
    padding-top: 0;
}

.howto-footer .footer-shell {
    position: relative;
    width: min(calc(100% - 92px), 1760px);
    padding-inline: 0;
}

.howto-footer .footer-card {
    border-radius: 23px;
}

.howto-footer .footer-card::after {
    border-radius: 23px;
}

@media (max-width: 1120px) {
    .howto-hero {
        min-height: 620px;
    }

    .howto-hero__inner {
        padding-top: 150px;
    }

    .howto-store-grid {
        width: min(100%, 620px);
    }
}

/*
 * Ниже 1280px персонажи скрыты.
 *
 * Блок с кнопками — 560px. Чтобы он остался ровно по центру и при этом
 * не задевал фигуры, справа от него нужно минимум 0.785 ширины арта.
 * На 1200px свободного места там всего ~274px: арт влез бы шириной
 * ~330px, то есть высотой ~240px — маленькая картинка, висящая
 * в углу отдельно от композиции. Честнее убрать, как на телефоне.
 */
@media (max-width: 1279px) {
    .howto-finish__art {
        display: none;
    }
}

@media (max-width: 900px) {
    .howto-page .primary-nav__link[aria-current="page"]::after {
        display: none;
    }

    .howto-step::before,
    .howto-step::after {
        display: none;
    }

    .howto-finish,
    .howto-footer .footer-shell {
        width: calc(100% - 44px);
    }
}

@media (max-width: 767px) {
    .howto-hero {
        min-height: 560px;
    }

    .howto-hero::after {
        height: 150px;
    }

    .howto-hero__inner {
        min-height: inherit;
        padding-top: 132px;
        padding-bottom: 108px;
    }

    .howto-hero__title {
        margin-bottom: 17px;
        line-height: 0.9;
        font-size: 45px;
        font-weight: 900;
    }

    .howto-hero__lead {
        font-size: 18px;
    }

    .howto-store-grid {
        width: 100%;
        max-width: 352px;
        margin-top: 23px;
        gap: 10px 12px;
    }

    .howto-store-grid .store-button {
        min-height: 54px;
        gap: 8px;
        padding: 8px 11px;
        border-radius: 7px;
    }

    .howto-store-grid .store-button > img {
        width: 24px;
        height: 24px;
    }

    .howto-store-grid .store-button__text small {
        font-size: 10px;
    }

    .howto-store-grid .store-button__text strong {
        font-size: 15px;
    }

    .howto-hero__hint {
        margin-top: 23px;
        font-size: 18px;
    }

    .howto-steps {
        padding-top: 34px;
        padding-bottom: 48px;
    }

    .howto-step + .howto-step {
        margin-top: 46px;
    }

    .howto-step__heading {
        margin-bottom: 20px;
    }

    .howto-step__heading h2 {
        margin-bottom: 13px;
        font-size: 35px;
    }

    .howto-step__heading p {
        max-width: 400px;
        margin-inline: auto;
        font-size: 15px;
        line-height: 1.5;
    }

    #finish-title {
        font-size: 40px;
    }

    .howto-shot,
    .howto-shot--wide {
        width: 100%;
        border-radius: 8px;
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
    }

    .howto-finish {
        display: block;
        width: calc(100% - 28px);
        min-height: 0;
        overflow: hidden;
        border-radius: 22px 22px 0 0;
    }

    .howto-finish__content {
        width: 100%;
        margin-left: 0;
        padding: 35px 14px 29px;
    }

    .howto-finish__content h2 {
        font-size: 35px;
        line-height: 0.9;
    }

    .howto-store-grid--finish {
        width: 100%;
        margin-top: 28px;
    }

    .howto-finish__art {
        display: none;
    }

    .howto-footer {
        margin-top: 0;
        padding-bottom: 0;
    }

    .howto-footer .footer-shell {
        width: calc(100% - 28px);
        padding-inline: 0;
    }

    .howto-footer .footer-card {
        border-radius: 0 0 18px 18px;
        padding-top: 42px;
    }

    .howto-footer .footer-card::after {
        border-radius: 0 0 18px 18px;
    }
}

@media (max-width: 360px) {
    .howto-hero__title {
        font-size: 34px;
    }

    .howto-store-grid {
        gap: 8px;
    }

    .howto-finish,
    .howto-footer .footer-shell {
        width: calc(100% - 20px);
    }

    .howto-finish__content {
        padding-inline: 10px;
    }
}
