*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Кнопки ===== */

.course-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-btn--primary {
    background: var(--accent);
    color: #111827;
    box-shadow: 0 8px 28px rgba(165, 180, 252, 0.28);
}

.course-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(165, 180, 252, 0.42);
}

.course-btn:focus-visible,
.course a:focus-visible,
.course-hero a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* ===== Шапка з фото ===== */

.course-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 80vh;
    overflow: hidden;
    background:
            radial-gradient(900px 420px at 30% 20%, rgba(165, 180, 252, 0.14), transparent 70%),
            var(--bg);
}

.course-hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.04);
}

.course-hero__shade {
    position: absolute;
    inset: 0;
    background:
            linear-gradient(to bottom, rgba(15, 17, 21, 0.6) 0%, rgba(15, 17, 21, 0.1) 30%),
            linear-gradient(to top, var(--bg) 0%, rgba(15, 17, 21, 0.85) 32%, rgba(15, 17, 21, 0.25) 75%);
}

.course-hero__inner {
    position: relative;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 80px) 24px 56px;
    text-align: center;
}

.course-hero__back {
    display: block;
    width: fit-content;
    margin: 0 auto 22px;
    color: #c7cad1;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.course-hero__back:hover {
    color: var(--accent);
}

.course-hero__badge {
    display: inline-block;
    margin-bottom: 18px;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #111827;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.course-hero__title {
    margin: 0 0 20px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(40px, 6vw, 72px);
    font-weight: 600;
    line-height: 1.05;
    overflow-wrap: break-word;
}

.course-hero__lead {
    max-width: 640px;
    margin: 0 auto 32px;
    color: #d1d5db;
    font-size: 19px;
    line-height: 1.6;
}

.course-hero__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.course-hero__price {
    margin: 0;
    color: #b4b9c4;
    font-size: 15px;
}

.course-hero__price strong {
    color: var(--text);
    font-size: 17px;
}

.course-hero__price span {
    margin-left: 6px;
}

/* ===== Основна частина ===== */

.course {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.course-section-title {
    margin: 0 0 28px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(34px, 4.5vw, 48px);
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
}

.course-section-title em {
    color: var(--accent);
    font-style: italic;
    font-weight: 500;
}

/* ===== Про курс ===== */

.course-about {
    max-width: 720px;
    margin: 0 auto 80px;
}

.course-about__text {
    color: #d8dbe1;
    font-size: 18px;
    line-height: 1.8;
    white-space: pre-line;
    overflow-wrap: break-word;
}

/* ===== Тарифи ===== */

.course-tariffs {
    scroll-margin-top: calc(var(--nav-height) + 24px);
}

.tariff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));   /* до 4 тарифов в ряд */
    gap: 24px;
}

.tariff {
    display: flex;
    flex-direction: column;
    padding: 32px 28px 28px;
    background:
            linear-gradient(170deg, rgba(165, 180, 252, 0.08) 0%, rgba(165, 180, 252, 0) 45%),
            #181b22;
    border: 1px solid #2f3542;
    border-radius: 22px;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.tariff:hover {
    transform: translateY(-4px);
    border-color: rgba(165, 180, 252, 0.6);
    box-shadow: 0 20px 50px rgba(165, 180, 252, 0.12);
}

.tariff__name {
    margin: 0 0 18px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tariff__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tariff__amount {
    font-family: 'Cormorant Garamond', serif;
    font-size: 64px;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
}

.tariff__currency {
    color: #c7cad1;
    font-size: 24px;
    font-weight: 600;
}

.tariff__uah {
    margin: 8px 0 0;
    color: #9ca3af;
    font-size: 15px;
}

/* ===== Скидка акции ===== */

.tariff__old {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    color: #9ca3af;
    font-size: 16px;
}

.tariff__discount {
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
    font-size: 13px;
    font-weight: 700;
}

.course-price-old {
    margin-right: 4px;
    color: #9ca3af;
}

.tariff__divider {
    height: 1px;
    margin: 24px 0;
    background: linear-gradient(90deg, rgba(165, 180, 252, 0.4), rgba(165, 180, 252, 0));
}

.tariff__description {
    margin: 0 0 28px;
    color: #d1d5db;
    font-size: 16px;
    line-height: 1.65;
    white-space: pre-line;
}

.tariff__button {
    width: 100%;
    margin-top: auto;
}

.course-tariffs__note {
    margin: 28px 0 0;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

.course-tariffs__empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 24px;
    border: 1px dashed #2f3542;
    border-radius: 18px;
    color: #b4b9c4;
    text-align: center;
}

.course__back {
    display: block;
    width: fit-content;
    margin: 56px auto 0;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}


.tariff__actions {
    display: flex;
    flex-wrap: wrap;      /* на узкой карточке кнопки встанут друг под друга */
    gap: 10px;
    margin-top: auto;     /* прижать к низу карточки, если .tariff — flex-колонка */
}

.tariff__actions > a,
.tariff__actions > form {
    flex: 1 1 120px;      /* делят ширину поровну, но не уже 120px */
    margin: 0;
}

.tariff__actions .ui-btn-primary,
.tariff__actions .ui-btn-ghost {
    width: 100%;
    justify-content: center;
    text-align: center;
}


/* ===== Нижня панель на мобільному ===== */

.course-bar {
    display: none;
}

/* ===== Мобільний ===== */

@media (max-width: 700px) {
    .course-hero {
        min-height: 70vh;
    }

    .course-hero__inner {
        padding: calc(var(--nav-height) + 48px) 20px 40px;
        text-align: left;
    }

    .course-hero__back {
        margin-left: 0;
    }

    .course-hero__lead {
        margin-left: 0;
        font-size: 17px;
    }

    .course-hero__actions {
        align-items: stretch;
    }

    .course-hero__actions .course-btn {
        width: 100%;
    }

    .course {
        padding: 24px 16px 64px;
    }

    .course-about {
        margin-bottom: 56px;
    }

    .course-about__text {
        font-size: 17px;
    }

    .course-section-title {
        text-align: left;
    }

    .tariff {
        padding: 26px 22px 22px;
    }

    .tariff__amount {
        font-size: 54px;
    }

    .course-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 90;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(15, 17, 21, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #2f3542;
    }

    .course-bar__price {
        margin: 0;
        color: #b4b9c4;
        font-size: 14px;
    }

    .course-bar__price strong {
        color: var(--text);
        font-size: 18px;
    }

    .course-bar .course-btn {
        padding: 12px 22px;
        font-size: 15px;
    }

    body.has-course-bar {
        padding-bottom: 76px;
    }
}