/* =====================================================================
   HeroDemo.module.css — базовый (десктопный) слой интерактивной консоли
   LMS на заглавной странице.

   Все классы с префиксом hd- — стили не пересекаются с theme.css,
   admin-ui.css и ui-controls.css. Токены берутся из landing.module.css
   через var(--lp-…, fallback): если landing.module.css не подключён,
   виджет всё равно выглядит корректно на своих значениях.

   Мобильная переверстка — HeroDemoMobile.module.css.
   ===================================================================== */

.hd-root {
    /* Палитра, наследуемая от лендинга с автономными fallback-значениями */
    --hd-accent:      var(--lp-accent, oklch(57% 0.145 46));
    --hd-accent-hi:   var(--lp-accent-hi, oklch(64% 0.150 52));
    --hd-accent-deep: var(--lp-accent-deep, oklch(43% 0.112 44));
    --hd-accent-wash: var(--lp-accent-wash, oklch(94.6% 0.030 58));
    --hd-accent-line: var(--lp-accent-line, oklch(86% 0.055 55));

    --hd-ink:    var(--lp-ink, oklch(21% 0.014 55));
    --hd-text:   var(--lp-ink-soft, oklch(35% 0.013 55));
    --hd-muted:  var(--lp-muted, oklch(53% 0.012 58));
    --hd-faint:  var(--lp-faint, oklch(66% 0.010 62));

    --hd-line:    var(--lp-line, oklch(90% 0.008 68));
    --hd-line-2:  var(--lp-line-strong, oklch(82% 0.011 64));
    --hd-divider: var(--lp-divider, oklch(93.5% 0.007 70));

    --hd-paper: var(--lp-paper, oklch(99% 0.004 80));
    --hd-bg:    var(--lp-bg, oklch(96.4% 0.010 82));
    --hd-track: var(--lp-bg-deep, oklch(93.6% 0.014 80));

    --hd-moss:      var(--lp-moss, oklch(51% 0.105 148));
    --hd-moss-wash: var(--lp-moss-wash, oklch(94.5% 0.032 148));
    --hd-moss-line: var(--lp-moss-line, oklch(86% 0.060 148));
    --hd-slate:     var(--lp-slate, oklch(47% 0.060 250));

    --hd-radius:    var(--lp-radius, 14px);
    --hd-radius-sm: var(--lp-radius-sm, 8px);
    --hd-gap:       20px;
    --hd-control-h: 44px;

    --hd-ease:   var(--lp-ease, cubic-bezier(0.16, 1, 0.3, 1));
    --hd-ease-q: var(--lp-ease-q, cubic-bezier(0.25, 1, 0.5, 1));

    box-sizing: border-box;
    font-family: var(--lp-font-ui, 'Golos Text', 'Segoe UI', system-ui, sans-serif);
    color: var(--hd-text);
    font-size: 15px;
    line-height: 1.5;
    max-width: var(--lp-shell, 1200px);
    margin: 0 auto;
    padding: 0 24px;
}

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

/* ------------------------------------------------------------- заголовок */

.hd-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.hd-head__eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hd-accent);
    margin-bottom: 8px;
}

.hd-head__title {
    margin: 0;
    font-family: var(--lp-font-display, Georgia, serif);
    font-size: clamp(1.5rem, 2.6vw, 2.125rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.022em;
    color: var(--hd-ink);
}

.hd-head__sub {
    margin: 10px 0 0;
    font-size: 0.9375rem;
    color: var(--hd-muted);
    max-width: 62ch;
}

.hd-head__sub strong { color: var(--hd-ink); font-weight: 600; }

.hd-head__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: none; }

/* Плашка авто-демонстрации: полоска внизу заполняется за время шага */
.hd-auto {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--hd-accent-line);
    border-radius: 999px;
    background: var(--hd-accent-wash);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-accent-deep);
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    opacity: 0;
    transform: translate3d(0, -6px, 0);
    pointer-events: none;
    transition: opacity 0.4s var(--hd-ease-q), transform 0.4s var(--hd-ease);
}

.hd-auto.is-on { opacity: 1; transform: none; pointer-events: auto; }
.hd-auto:hover { border-color: var(--hd-accent); }
.hd-auto:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }

.hd-auto__dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--hd-accent);
    flex: none;
    animation: hd-throb 1.6s var(--lp-ease-io, ease-in-out) infinite;
}

@keyframes hd-throb {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.72); }
}

.hd-auto__stop { font-weight: 600; color: var(--hd-accent); text-decoration: underline; text-underline-offset: 2px; }

.hd-auto__track {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: transparent;
}

.hd-auto__track span {
    display: block;
    height: 100%;
    background: var(--hd-accent);
    transform: scaleX(0);
    transform-origin: left center;
}

.hd-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 11px;
    border: 1px solid var(--hd-line);
    border-radius: 999px;
    background: var(--hd-paper);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--hd-muted);
    white-space: nowrap;
}

.hd-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--hd-moss);
}

/* --------------------------------------------- рельс отделов (табы) */

.hd-rail {
    position: relative;
    display: flex;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    gap: 4px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid var(--hd-line);
    border-radius: 999px;
    background: var(--hd-paper);
    overflow-x: auto;
    scrollbar-width: none;
}

.hd-rail::-webkit-scrollbar { display: none; }

/* Подложка активного таба: едет через transform, поэтому подкрас плавный */
.hd-rail__ind {
    position: absolute;
    top: 5px;
    left: 0;
    height: calc(100% - 10px);
    border-radius: 999px;
    background: var(--hd-accent-deep);
    transform: translate3d(0, 0, 0);
    opacity: 0;
    transition: transform 0.55s var(--hd-ease), width 0.55s var(--hd-ease), opacity 0.3s var(--hd-ease-q);
    pointer-events: none;
    will-change: transform, width;
}

.hd-rail__ind.is-ready { opacity: 1; }

.hd-dept {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 0 17px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--hd-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.35s var(--hd-ease-q);
}

.hd-dept:hover { color: var(--hd-ink); }
.hd-dept:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }

.hd-dept__pct {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--hd-faint);
    transition: color 0.35s var(--hd-ease-q);
}

.hd-dept.is-active { color: oklch(98% 0.006 60); font-weight: 600; }
.hd-dept.is-active .hd-dept__pct { color: oklch(88% 0.05 60); }

/* --------------------------------------- мобильные табы (здесь скрыты) */

.hd-tabs { display: none; }

/* ------------------------------------------------------------- сетка */

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

/* ------------------------------------------------------- панель фильтров */

.hd-panel {
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius);
    background: var(--hd-paper);
    padding: 20px;
    position: sticky;
    top: 84px;
    box-shadow: var(--lp-elev-1, 0 1px 2px oklch(21% 0.014 55 / 0.05));
}

.hd-panel__title {
    margin: 0 0 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--hd-divider);
    font-family: var(--lp-font-ui, sans-serif);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--hd-faint);
}

.hd-field { margin-bottom: 16px; }

.hd-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hd-text);
}

.hd-select,
.hd-input {
    display: block;
    width: 100%;
    height: var(--hd-control-h);
    padding: 0 13px;
    border: 1px solid var(--hd-line-2);
    border-radius: var(--hd-radius-sm);
    background: var(--hd-paper);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--hd-ink);
    transition: border-color 0.2s var(--hd-ease-q), box-shadow 0.2s var(--hd-ease-q);
}

.hd-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23807066' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 36px;
    cursor: pointer;
}

.hd-select:focus,
.hd-input:focus {
    outline: none;
    border-color: var(--hd-accent);
    box-shadow: 0 0 0 3px oklch(57% 0.145 46 / 0.16);
}

.hd-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    font-size: 0.9375rem;
    color: var(--hd-text);
    cursor: pointer;
    user-select: none;
}

.hd-check input {
    width: 18px; height: 18px;
    margin: 0;
    accent-color: var(--hd-accent);
    cursor: pointer;
    flex: none;
}

.hd-panel__actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--hd-divider);
}

.hd-btn {
    position: relative;
    flex: 1 1 auto;
    height: var(--hd-control-h);
    padding: 0 14px;
    border: 1px solid var(--hd-line-2);
    border-radius: var(--hd-radius-sm);
    background: var(--hd-paper);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hd-text);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.2s var(--hd-ease-q), border-color 0.2s var(--hd-ease-q),
                color 0.2s var(--hd-ease-q), transform 0.15s var(--hd-ease-q);
}

.hd-btn:hover { border-color: var(--hd-accent-line); color: var(--hd-accent-deep); background: var(--hd-accent-wash); }
.hd-btn:active { transform: translateY(1px); }
.hd-btn:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }

.hd-btn--primary {
    border-color: var(--hd-accent-deep);
    background: var(--hd-accent-deep);
    color: oklch(98% 0.008 60);
}

.hd-btn--primary:hover {
    background: var(--hd-accent);
    border-color: var(--hd-accent);
    color: oklch(99% 0.005 60);
}

.hd-panel__note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--hd-divider);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--hd-faint);
}

/* --------------------------------------------------------- правая колонка */

.hd-main { display: flex; flex-direction: column; gap: var(--hd-gap); min-width: 0; }

/* --------------------------------------------------- сводка: кольцо + цифры */

.hd-summary {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 24px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius);
    background: var(--hd-paper);
    box-shadow: var(--lp-elev-1, 0 1px 2px oklch(21% 0.014 55 / 0.05));
}

.hd-ringbox { position: relative; width: 168px; height: 168px; }

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

.hd-ring__track { fill: none; stroke: var(--hd-track); stroke-width: 11; }

.hd-ring__fill {
    fill: none;
    stroke: var(--hd-accent);
    stroke-width: 11;
    stroke-linecap: round;
    /* 2πr при r = 52 → 326.73 */
    stroke-dasharray: 326.73;
    stroke-dashoffset: calc(326.73 * (1 - var(--p, 0) / 100));
    transition: stroke-dashoffset 1.1s var(--hd-ease), stroke 0.5s var(--hd-ease-q);
}

.hd-ring__fill.is-high { stroke: var(--hd-moss); }
.hd-ring__fill.is-low  { stroke: var(--hd-accent-hi); }

.hd-ringbox__label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
}

.hd-ringbox__value {
    font-family: var(--lp-font-display, Georgia, serif);
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--hd-ink);
    font-variant-numeric: tabular-nums;
}

.hd-ringbox__cap {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--hd-faint);
    max-width: 108px;
    line-height: 1.3;
}

.hd-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 24px;
    min-width: 0;
}

.hd-figure { min-width: 0; }

.hd-figure__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--hd-faint);
    margin-bottom: 3px;
}

.hd-figure__value {
    display: block;
    font-family: var(--lp-font-display, Georgia, serif);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.022em;
    color: var(--hd-ink);
    font-variant-numeric: tabular-nums;
}

.hd-figure__hint { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--hd-muted); }

/* ------------------------------------------- сравнение отделов (график) */

.hd-compare { grid-column: 1 / -1; min-width: 0; }

.hd-compare__title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--hd-faint);
    margin-bottom: 11px;
}

.hd-compare__plot {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 88px;
}

.hd-col {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}

.hd-col__bar {
    width: 100%;
    max-width: 56px;
    height: 64px;
    border-radius: 3px 3px 0 0;
    background: oklch(89% 0.012 78);
    transform: scaleY(var(--sy, 0));
    transform-origin: bottom center;
    transition: transform 0.85s var(--hd-ease), background 0.4s var(--hd-ease-q);
    will-change: transform;
}

.hd-col.is-active .hd-col__bar { background: var(--hd-accent); }
.hd-col:hover .hd-col__bar { background: var(--hd-accent-line); }
.hd-col.is-active:hover .hd-col__bar { background: var(--hd-accent); }

.hd-col__cap {
    font-size: 0.6875rem;
    color: var(--hd-faint);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.35s var(--hd-ease-q);
}

.hd-col.is-active .hd-col__cap { color: var(--hd-accent-deep); font-weight: 600; }
.hd-col:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------- список курсов */

.hd-courses {
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius);
    background: var(--hd-paper);
    overflow: hidden;
    box-shadow: var(--lp-elev-1, 0 1px 2px oklch(21% 0.014 55 / 0.05));
}

.hd-courses__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--hd-divider);
    background: var(--hd-bg);
}

.hd-courses__title {
    margin: 0;
    font-family: var(--lp-font-ui, sans-serif);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hd-ink);
}

.hd-courses__count {
    font-size: 0.8125rem;
    color: var(--hd-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

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

.hd-course {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 168px;
    gap: 5px 24px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--hd-divider);
    /* Появление списка: fade-in + slide-up со сдвигом по индексу */
    animation: hd-row-in 0.5s var(--hd-ease) both;
    animation-delay: calc(var(--i, 0) * 55ms);
    transition: background 0.28s var(--hd-ease-q);
}

.hd-course:last-child { border-bottom: none; }

@keyframes hd-row-in {
    from { opacity: 0; transform: translate3d(0, 12px, 0); }
    to   { opacity: 1; transform: none; }
}

/* Микро-взаимодействие: подложка + сдвиг текста + подсветка процента */
.hd-course:hover { background: var(--hd-accent-wash); }

.hd-course__name {
    grid-column: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hd-ink);
    min-width: 0;
    transition: transform 0.28s var(--hd-ease);
}

.hd-course:hover .hd-course__name { transform: translateX(4px); }

.hd-tag {
    display: inline-block;
    padding: 2px 9px;
    border: 1px solid var(--hd-line-2);
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-muted);
    background: var(--hd-bg);
    white-space: nowrap;
}

.hd-tag--required { border-color: var(--hd-accent-line); background: var(--hd-accent-wash); color: var(--hd-accent-deep); }
.hd-tag--optional { border-color: var(--hd-line); background: var(--hd-paper); color: var(--hd-muted); }

.hd-course__meta {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.8125rem;
    color: var(--hd-muted);
    transition: transform 0.28s var(--hd-ease);
}

.hd-course:hover .hd-course__meta { transform: translateX(4px); }

.hd-course__progress {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hd-bar {
    position: relative;
    flex: 1 1 auto;
    height: 8px;
    border-radius: 999px;
    background: var(--hd-track);
    overflow: hidden;
}

/* Заполнение: ширина по --p, плавно анимируется CSS-переходом.
   Задержка по --i даёт волну при переключении отдела. */
.hd-bar__fill {
    position: relative;
    display: block;
    overflow: hidden;
    height: 100%;
    width: calc(var(--p, 0) * 1%);
    border-radius: 999px;
    background: var(--hd-accent);
    transition: width 0.95s var(--hd-ease), background 0.45s var(--hd-ease-q);
    transition-delay: calc(var(--i, 0) * 55ms);
}

.hd-bar__fill--low  { background: var(--hd-accent-hi); }
.hd-bar__fill--high { background: var(--hd-moss); }

/* Блик, пробегающий по заполненной части при наведении на строку */
.hd-bar__fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, oklch(100% 0 0 / 0.45), transparent 80%);
    transform: translateX(-100%);
    transition: transform 0.9s var(--hd-ease);
}

.hd-course:hover .hd-bar__fill::after { transform: translateX(100%); }

.hd-course__pct {
    min-width: 44px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hd-text);
    font-variant-numeric: tabular-nums;
    text-align: right;
    flex: none;
    transition: color 0.28s var(--hd-ease-q), transform 0.28s var(--hd-ease);
}

.hd-course:hover .hd-course__pct { color: var(--hd-accent-deep); transform: scale(1.06); }

.hd-empty {
    padding: 40px 20px;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--hd-muted);
    animation: hd-row-in 0.45s var(--hd-ease) both;
}

.hd-empty strong { display: block; color: var(--hd-ink); margin-bottom: 4px; font-weight: 600; }

/* Скелетон: пока JS не отрисовал первый кадр (очень короткое состояние) */
.hd-skeleton { padding: 16px 20px; display: grid; gap: 14px; }
.hd-skeleton i {
    display: block;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--hd-track) 0%, var(--hd-bg) 50%, var(--hd-track) 100%);
    background-size: 220% 100%;
    animation: hd-shimmer 1.4s linear infinite;
}

@keyframes hd-shimmer {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

/* ------------------------------------------------- промежуточный планшет */

@media (max-width: 1024px) and (min-width: 769px) {
    .hd-grid { grid-template-columns: 260px minmax(0, 1fr); }
    .hd-summary { grid-template-columns: 140px minmax(0, 1fr); gap: 20px; padding: 18px; }
    .hd-ringbox { width: 140px; height: 140px; }
    .hd-ringbox__value { font-size: 2rem; }
    .hd-figures { gap: 16px 20px; }
    .hd-figure__value { font-size: 1.5rem; }
    .hd-course { grid-template-columns: minmax(0, 1fr) 132px; }
}

/* --------------------------------------------- уважение к настройкам ОС */

@media (prefers-reduced-motion: reduce) {
    .hd-course,
    .hd-empty { animation: none; }

    .hd-bar__fill,
    .hd-ring__fill,
    .hd-col__bar,
    .hd-rail__ind,
    .hd-auto,
    .hd-course__name,
    .hd-course__meta,
    .hd-course__pct { transition: none; }

    .hd-bar__fill::after { display: none; }
    .hd-auto__dot,
    .hd-skeleton i { animation: none; }
}
