/* ============================================
   Первый экран нового клиента (templates/welcome.html).
   Тёмно-зелёная шапка с настоящими товарами и светлый лист с фактами.
   Один акцент — фирменный зелёный, остальное держится на типографике.
   ============================================ */

:root {
    --w-hero-top: #0B3A1C;
    --w-hero-bottom: #17602D;
    --w-brand: #2E7D32;
    --w-brand-soft: rgba(46, 125, 50, 0.1);
    --w-sheet-radius: 28px;
    --w-gutter: 20px;
    --w-scrollbar: rgba(60, 60, 67, 0.28);
}

@media (prefers-color-scheme: dark) {
    :root {
        --w-brand: #5FC36E;
        --w-brand-soft: rgba(95, 195, 110, 0.14);
        --w-scrollbar: rgba(235, 235, 245, 0.25);
    }
}

body.w-page {
    margin: 0;
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Фон документа светлый, как лист: от тёмного фона низ при оттягивании
   и полоса прокрутки тоже темнели. Зелёный остаётся только над шапкой. */
html {
    background: var(--color-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--w-scrollbar) transparent;
}

body.w-page::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -100vh;
    height: 100vh;
    background: var(--w-hero-top);
}

.w-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.w-page svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Шапка --- */

.w-hero {
    position: relative;
    padding: 18px var(--w-gutter) calc(var(--w-sheet-radius) + 28px);
    background:
        radial-gradient(120% 70% at 50% 38%, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0) 62%),
        linear-gradient(180deg, var(--w-hero-top) 0%, var(--w-hero-bottom) 100%);
    color: #FFFFFF;
    text-align: center;
    overflow: hidden;
}

.w-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1;
}

.w-brand-dot { color: rgba(255, 255, 255, 0.55); font-weight: 900; }
.w-brand-shop { color: rgba(255, 255, 255, 0.78); font-weight: 600; }

/* В полноэкранном режиме бренд встаёт в полосу кнопок Telegram, по центру */
body.tg-fullscreen .w-hero {
    padding-top: var(--tg-safe-area-inset-top, 0px);
}

body.tg-fullscreen .w-brand {
    height: max(46px, var(--tg-content-safe-area-inset-top, 46px));
}

/* Три настоящих хита продаж веером */
.w-showcase {
    position: relative;
    height: 212px;
    margin: 18px auto 6px;
    max-width: 360px;
}

.w-product {
    position: absolute;
    left: 50%;
    top: 14px;
    width: 128px;
    margin-left: -64px;
}

.w-product--left { transform: translate(-104px, 22px) rotate(-10deg); }
.w-product--right { transform: translate(104px, 22px) rotate(10deg); }
.w-product--center { top: 0; width: 148px; margin-left: -74px; z-index: 2; }

.w-product-card {
    aspect-ratio: 1 / 1.12;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 24px;
    background: #FFFFFF;
    box-shadow:
        0 24px 48px -12px rgba(0, 0, 0, 0.45),
        0 2px 6px rgba(0, 0, 0, 0.12);
}

.w-product-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.w-product--left .w-product-card,
.w-product--right .w-product-card {
    filter: saturate(0.92);
}

.w-badge {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px 8px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #14361F;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transform: translateX(-50%);
    box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.35);
}

.w-badge svg {
    width: 17px;
    height: 17px;
    color: var(--w-hero-bottom);
    stroke-width: 2.1;
}

.w-hero-text {
    max-width: 420px;
    margin: 0 auto;
}

.w-eyebrow {
    margin: 22px 0 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.62);
}

.w-title {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -1.1px;
    color: #FFFFFF;
    text-wrap: balance;
}

.w-lead {
    margin: 14px auto 0;
    max-width: 340px;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.76);
    text-wrap: balance;
}

/* --- Лист с фактами --- */

.w-sheet {
    position: relative;
    z-index: 1;
    margin-top: calc(-1 * var(--w-sheet-radius));
    padding: 20px var(--w-gutter) 28px;
    border-radius: var(--w-sheet-radius) var(--w-sheet-radius) 0 0;
    background: var(--color-bg);
}

.w-sheet > * {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

body.w-has-cta .w-sheet {
    padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

.w-stats {
    display: flex;
    padding: 16px 4px;
    border-radius: 20px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.w-stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 10px;
    text-align: center;
}

.w-stat + .w-stat {
    border-left: 1px solid var(--color-separator);
}

.w-stat-value {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.15;
    white-space: nowrap;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.w-stat-label {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--color-text-secondary);
}

.w-section {
    margin-top: 28px;
}

.w-h2 {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -0.5px;
    color: var(--color-text);
}

.w-steps {
    list-style: none;
    margin: 0;
    padding: 0;
}

.w-step {
    position: relative;
    display: flex;
    gap: 14px;
    padding-bottom: 20px;
}

.w-step:last-child { padding-bottom: 0; }

/* Тонкая линия между шагами, как маршрут посылки */
.w-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 21px;
    top: 48px;
    bottom: 4px;
    width: 2px;
    border-radius: 2px;
    background: var(--color-separator);
}

.w-step-ic {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--w-brand-soft);
    color: var(--w-brand);
}

.w-step-ic svg { width: 22px; height: 22px; }

.w-step-title {
    margin-top: 2px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.2px;
    color: var(--color-text);
}

.w-step-text {
    margin-top: 3px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--color-text-secondary);
    text-wrap: pretty;
}

.w-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin-top: 28px;
    padding: 14px 14px 14px 16px;
    border: none;
    border-radius: 18px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.w-row:active { transform: scale(0.98); }

.w-row-ic {
    flex: 0 0 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--w-brand-soft);
    color: var(--w-brand);
}

.w-row-ic svg { width: 20px; height: 20px; }

.w-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.w-row-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.w-row-text {
    margin-top: 2px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.w-row-chevron {
    width: 18px;
    height: 18px;
    color: var(--color-text-tertiary);
}

.w-note {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--w-brand-soft);
}

.w-note svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--w-brand);
}

.w-note p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--color-text);
}

.w-legal {
    margin-top: 20px;
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: var(--color-text-tertiary);
}

.w-legal a {
    color: var(--color-text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--color-separator);
    text-underline-offset: 2px;
}

/* --- Кнопка вне Telegram (в Telegram — нативная MainButton) --- */

.w-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding: 12px var(--w-gutter) max(12px, env(safe-area-inset-bottom, 0px));
    background: var(--color-bottom-nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--color-separator);
}

.w-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    min-height: 54px;
    margin: 0 auto;
    border: none;
    border-radius: 16px;
    background: #2E7D32;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 17px;
    font-weight: 650;
    cursor: pointer;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.w-cta-btn:active { transform: scale(0.98); }

.w-cta-btn.is-busy {
    pointer-events: none;
    opacity: 0.8;
}

.w-cta-btn.is-busy::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: w-spin 0.8s linear infinite;
}

@keyframes w-spin {
    to { transform: rotate(360deg); }
}

/* --- Движение: товары выезжают по очереди и потом едва заметно парят --- */

@media (prefers-reduced-motion: no-preference) {
    .w-product-card {
        animation:
            w-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both,
            w-float 6s ease-in-out 0.9s infinite;
    }

    .w-product--left .w-product-card { animation-delay: 0.08s, 1.4s; }
    .w-product--right .w-product-card { animation-delay: 0.16s, 2.1s; }

    .w-badge {
        animation: w-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s both;
    }

    .w-hero-text,
    .w-sheet {
        animation: w-fade 0.6s ease-out 0.15s both;
    }

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

    @keyframes w-float {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-6px); }
    }

    @keyframes w-pop {
        from { opacity: 0; transform: translateX(-50%) scale(0.8); }
        to { opacity: 1; transform: translateX(-50%) scale(1); }
    }

    @keyframes w-fade {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* --- Узкие телефоны (360 и меньше) --- */
@media (max-width: 370px) {
    :root { --w-gutter: 16px; }
    .w-title { font-size: 30px; }
    .w-product { width: 116px; margin-left: -58px; }
    .w-product--left { transform: translate(-86px, 22px) rotate(-10deg); }
    .w-product--right { transform: translate(86px, 22px) rotate(10deg); }
    .w-product--center { width: 136px; margin-left: -68px; }
    .w-showcase { height: 198px; }
    .w-stat { padding: 0 6px; }
    .w-stat-value { font-size: 19px; }
}

/* --- Широкий экран (Telegram Desktop, браузер) --- */
@media (min-width: 720px) {
    .w-hero { padding-top: 32px; }
    .w-showcase { height: 240px; max-width: 460px; }
    .w-product { width: 150px; margin-left: -75px; }
    .w-product--left { transform: translate(-130px, 24px) rotate(-10deg); }
    .w-product--right { transform: translate(130px, 24px) rotate(10deg); }
    .w-product--center { width: 172px; margin-left: -86px; }
    .w-title { font-size: 44px; letter-spacing: -1.6px; }
    .w-lead { font-size: 17px; max-width: 420px; }
}
