/* ============================================================
   Онлайн-школа — личный кабинет
   Чистый CSS, логические блоки, CSS-переменные.
   ============================================================ */

/* ------------------------------------------------------------
   0. Шрифт: Inter (локальная вариативная гарнитура)
   ------------------------------------------------------------ */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../assets/fonts/inter-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../assets/fonts/inter-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../assets/fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../assets/fonts/inter-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------
   1. Переменные
   ------------------------------------------------------------ */
:root {
    /* Контейнер и сетка */
    --container: 1220px;          /* максимальная ширина desktop */
    --padding: 36px;              /* боковые отступы контейнера (desktop) */
    --gutter: 22px;               /* зазор между карточками */

    /* Скругления */
    --radius-hero: 28px;
    --radius-card: 24px;
    --radius-pill: 999px;

    /* Цвета */
    --accent: #2f5bff;            /* насыщенный синий */
    --accent-dark: #1e46d8;
    --accent-soft: #eef2ff;
    --cyan: #67e8f9;              /* свечение кольца */

    --bg: #f6f8fb;                /* почти белый фон страницы */
    --surface: #ffffff;           /* фон карточек */

    --border: #e5e9f0;            /* тонкая серая граница */
    --border-strong: #c8d1e0;     /* граница при наведении */

    --text: #0b1220;              /* основной текст */
    --text-muted: #5b6472;        /* приглушённый текст */
    --text-faint: #8a93a6;        /* самый бледный текст */

    --white: #ffffff;

    /* Типографика */
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Отступы */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;             /* отступ после hero */

    /* Тени — минимум */
    --shadow-card: 0 1px 2px rgba(11, 18, 32, 0.04);
    --shadow-card-hover: 0 18px 40px rgba(11, 18, 32, 0.08);
}

/* ------------------------------------------------------------
   2. База
   ------------------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, p {
    margin: 0;
}

/* Контейнер: контент по центру, максимум 1220px */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--padding);
}

/* ------------------------------------------------------------
   3. Верхняя панель
   ------------------------------------------------------------ */
.appbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.appbar__inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 18px var(--padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--white);
}

.appbar__user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.appbar__chip {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
}

/* ------------------------------------------------------------
   4. Hero-баннер
   Слои (снизу вверх): картинка → затемнение → кольцо → контент.
   Каждый слой абсолютно позиционирован и независим.
   ------------------------------------------------------------ */
.hero {
    position: relative;
    height: 400px;                 /* desktop: 380–420px */
    margin-top: var(--space-xl);   /* воздух после панели */
    margin-bottom: var(--space-xl);/* 40px отступ до «Моя подготовка» */
    border-radius: var(--radius-hero);
    overflow: hidden;
    isolation: isolate;
}

/* Слой 1 — фоновая картинка.
   Файл assets/hero-bg.webp замените на своё изображение. */
.hero__background {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Слой 2 — синий градиент-затемнение для читаемости текста */
.hero__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(
            105deg,
            rgba(6, 16, 46, 0.78) 0%,
            rgba(20, 42, 110, 0.55) 48%,
            rgba(23, 74, 128, 0.22) 100%
        );
}

/* Слой 3 — светящееся кольцо (декор, анимируется отдельно от фона) */
.hero-ring {
    position: absolute;
    top: 50%;
    right: 8%;
    z-index: 2;
    width: 260px;
    height: 260px;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Вращение — только transform (GPU) */
.hero-ring__spin {
    position: absolute;
    inset: 0;
    animation: ring-spin 14s linear infinite;
}

/* Пульсация — только transform + opacity (GPU) */
.hero-ring__pulse {
    position: absolute;
    inset: 0;
    animation: ring-pulse 6s ease-in-out infinite;
}

.hero-ring__svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible; /* чтобы точка на орбите не обрезалась */
}

/* Мягкое свечение вокруг кольца */
.hero-ring::before {
    content: "";
    position: absolute;
    inset: -60px;
    background: radial-gradient(circle, rgba(103, 232, 249, 0.22) 0%, rgba(103, 232, 249, 0) 65%);
    border-radius: 50%;
}

/* Дуги мерцают с разной задержкой — opacity только */
.ring-arc {
    transform-origin: center;
    transform-box: fill-box;
    animation: arc-fade 7s ease-in-out infinite;
}
.ring-arc--main  { animation-delay: 0s; }
.ring-arc--inner { animation-delay: 1.6s; }
.ring-arc--dash  { animation-delay: 3.2s; }

.ring-dot {
    animation: dot-glow 4s ease-in-out infinite;
}

@keyframes ring-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes ring-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.9; }
    50%      { transform: scale(1.045); opacity: 1; }
}

@keyframes arc-fade {
    0%, 100% { opacity: 0.95; }
    50%      { opacity: 0.30; }
}

@keyframes dot-glow {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}

/* Слой 4 — контент hero */
.hero__content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-xl) 40px;
    color: var(--white);
}

/* Приветствие — вверху слева */
.hero__greeting {
    font-size: 20px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.86);
}

.hero__name {
    display: block;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--white);
    margin-top: 2px;
}

/* Блок урока — внизу слева */
.hero__bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
}

.hero__lesson-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.66);
    margin-bottom: 8px;
}

.hero__lesson-title {
    max-width: 520px;
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    /* длинное название — максимум 2 строки */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero__lesson-number {
    display: block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
}

/* CTA-кнопка — справа внизу, светлая и pill-образная */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.btn--hero {
    flex-shrink: 0;
    min-width: 168px;              /* 160–180px */
    padding: 14px 26px;
    font-size: 15px;
    color: #0b1830;
    background: var(--white);
    box-shadow: var(--shadow-card);
    will-change: transform;
}

.btn--hero .btn__arrow {
    font-size: 17px;
    line-height: 1;
    transition: transform 200ms ease;
}

.btn--hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(6, 16, 46, 0.28);
}

.btn--hero:hover .btn__arrow {
    transform: translate(2px, -2px);
}

/* ------------------------------------------------------------
   5. Блок «Моя подготовка»
   ------------------------------------------------------------ */
.training__title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-lg);
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gutter);
}

/* ------------------------------------------------------------
   6. Карточки
   ------------------------------------------------------------ */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 216px;
    padding: var(--space-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition:
        transform 250ms ease,
        border-color 250ms ease,
        box-shadow 250ms ease;
}

.card:hover {
    transform: translateY(-3px);   /* 2–4px */
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
}

.card:hover .card__link-arrow {
    transform: translateX(3px);
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
}

.card__title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card__sub {
    color: var(--text-muted);
    font-size: 15px;
}

.card__sub:last-of-type {
    margin-top: 0;
}

.card__link {
    margin-top: auto;              /* прижимаем ссылку к низу карточки */
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
}

.card__link-arrow {
    transition: transform 200ms ease;
}

/* Иконки карточек — минималистичные круги */
.card__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}

.card__icon--violet {
    background: #f3efff;
    color: #7c5cff;
}

.card__chip,
.card__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
}

.card__count {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Карточка 1 — прогресс-бар */
.progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: auto;
}

.progress__track {
    flex: 1;
    height: 10px;
    border-radius: var(--radius-pill);
    background: #e8edf5;
    overflow: hidden;
}

.progress__fill {
    display: block;
    height: 100%;
    width: var(--p, 0%);
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent), #5b8bff);
    transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.progress__value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    min-width: 34px;
    text-align: right;
}

/* Мини-кольцо прогресса в шапке карточки (26px) */
.ring-mini {
    width: 30px;
    height: 30px;
}

.ring-mini svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-mini__track {
    fill: none;
    stroke: #e8edf5;
    stroke-width: 3.2;
}

.ring-mini__fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3.2;
    stroke-linecap: round;
    /* dashoffset вычисляется в main.js из data-progress */
    stroke-dasharray: 97.4;        /* длина окружности r=15.5 */
    stroke-dashoffset: 97.4;
}

/* Карточка 4 — крупный синий результат */
.card__score {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent);
    line-height: 1.1;
    margin-top: auto;
}

.card__score-unit {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ------------------------------------------------------------
   7. Адаптив
   ------------------------------------------------------------ */

/* === Mobile (до 700px) === */
@media (max-width: 700px) {
    :root {
        --padding: 16px;           /* контейнер почти на всю ширину */
        --gutter: 16px;
    }

    .appbar__inner {
        padding: 14px var(--padding);
    }

    /* Контейнер почти на всю ширину с боковыми отступами 16px */
    .container {
        padding: 0 var(--padding);
    }

    /* Hero становится высоким */
    .hero {
        height: 460px;             /* 430–500px */
        margin-top: var(--space-md);
    }

    .hero__content {
        padding: var(--space-lg) 20px;
    }

    .hero__greeting {
        font-size: 17px;
    }

    .hero__name {
        font-size: 26px;
    }

    /* Название урока — ближе к нижней части */
    .hero__bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .hero__lesson-title {
        font-size: 30px;
        max-width: 100%;
    }

    .hero__lesson-number {
        margin-top: 6px;
    }

    /* CTA — под названием урока, ничего не перекрывает */
    .btn--hero {
        min-width: 100%;
        padding: 14px 20px;
    }

    /* Кольцо — по центру */
    .hero-ring {
        top: 40%;
        right: auto;
        left: 50%;
        width: 200px;
        height: 200px;
        transform: translate(-50%, -50%);
    }

    /* Карточки — одна колонка */
    .cards {
        grid-template-columns: 1fr;
    }

    .card {
        min-height: auto;
    }

    .training__title {
        font-size: 24px;
    }
}

/* --- Desktop (от 900px): сетка карточек 2 × 2 уже задана по умолчанию --- */

/* --- Средний размер экрана (700–900px): hero остаётся горизонтальным, карточки в одну колонку --- */
@media (min-width: 701px) and (max-width: 899px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .hero {
        height: 420px;
    }
}

/* ------------------------------------------------------------
   8. Доступность: reduced motion
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .hero-ring__spin,
    .hero-ring__pulse,
    .ring-arc,
    .ring-dot,
    .progress__fill,
    .card,
    .btn,
    .card__link-arrow {
        animation: none !important;
        transition: none !important;
    }

    .progress__fill {
        width: var(--p, 0%);
    }

    /* Мини-кольцо: значение задаётся инлайн-стилем из main.js,
       поэтому при отключённой анимации просто оставляем его как есть. */
    .ring-mini__fill {
        transition: none;
    }
}