/**
 * GRO TOC Mobile — trigger (60×60) + modal (fullscreen)
 *
 * Figma:
 *   - 6504-55571 (trigger)
 *   - 6479-67344 (modal)
 *
 * Showing rules:
 *   - Trigger: visible only <768px (mobile)
 *   - Modal: opens on trigger click, body scroll-locked
 *   - Includes our Dark mode toggle (Figma 6403-63250) in bottom-right
 */

/* ============================================================
   Trigger button (60×60 чёрный круг с белой ≡ иконкой)
   ============================================================ */

.gro-toc-mobile-trigger {
    display: none; /* shown only on mobile via @media */
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    padding: 8px;
    background: #141414;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.gro-toc-mobile-trigger:hover {
    background: #2a2a2a;
}

.gro-toc-mobile-trigger:active {
    transform: scale(0.95);
}

.gro-toc-mobile-trigger:focus-visible {
    outline: 2px solid #D9B648;
    outline-offset: 2px;
}

.gro-toc-mobile-trigger__inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.gro-toc-mobile-trigger__inner svg {
    width: 24px;
    height: 16px;
    display: block;
}

/* Visible on mobile only */
@media (max-width: 768px) {
    .gro-toc-mobile-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Hide when modal is open */
body.gro-toc-modal-open .gro-toc-mobile-trigger {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================
   Modal — fullscreen overlay
   ============================================================ */

.gro-toc-mobile-modal {
    position: fixed;
    inset: 0;
    z-index: 9200;
    display: none;
}

.gro-toc-mobile-modal.is-open {
    display: block;
}

.gro-toc-mobile-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: gro-toc-backdrop-in 0.2s ease;
}

@keyframes gro-toc-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gro-toc-mobile-modal__panel {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: #FFFFFF;
    border-radius: 24px;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: gro-toc-panel-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Golos Text', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
}

@keyframes gro-toc-panel-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gro-toc-mobile-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    flex-shrink: 0;
}

.gro-toc-mobile-modal__title {
    margin: 0;
    font-family: inherit;
    font-weight: 500;
    font-size: 24px;
    line-height: 112%;
    letter-spacing: -0.04em;
    color: var(--light-mode-text-003, #aaa8a8);
}

.gro-toc-mobile-modal__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.gro-toc-mobile-modal__close:hover {
    background: #f5f5f5;
}

.gro-toc-mobile-modal__close svg {
    width: 24px;
    height: 24px;
    display: block;
}

.gro-toc-mobile-modal__content {
    flex: 1;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px 24px;
}

/* TOC list styles inside modal — упрощено для mobile (без vertical lines у inactive) */
.gro-toc-mobile-modal__content .pillar-aside__list,
.gro-toc-mobile-modal__content .gro-toc-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.gro-toc-mobile-modal__content .pillar-aside__list:before,
.gro-toc-mobile-modal__content .gro-toc-mobile-list:before {
    display: none; /* убираем общую вертикальную линию */
}

.gro-toc-mobile-modal__content .pillar-aside__item,
.gro-toc-mobile-modal__content .gro-toc-mobile-list li {
    padding: 12px 0;
    position: relative;
    padding-left: 16px;
}

.gro-toc-mobile-modal__content .pillar-aside__item a,
.gro-toc-mobile-modal__content .gro-toc-mobile-list a {
    font-family: inherit;
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--light-mode-text-002, #525252);
    text-decoration: none;
    display: block;
    transition: color 0.15s ease;
}

.gro-toc-mobile-modal__content .pillar-aside__item:hover a,
.gro-toc-mobile-modal__content .gro-toc-mobile-list li:hover a {
    color: var(--light-mode-text-001, #303030);
}

.gro-toc-mobile-modal__content .pillar-aside__item.act,
.gro-toc-mobile-modal__content .gro-toc-mobile-list li[aria-current="page"] {
    position: relative;
}

.gro-toc-mobile-modal__content .pillar-aside__item.act:before,
.gro-toc-mobile-modal__content .gro-toc-mobile-list li[aria-current="page"]:before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--light-mode-text-001, #303030);
    border: 0;
}

.gro-toc-mobile-modal__content .pillar-aside__item.act a,
.gro-toc-mobile-modal__content .gro-toc-mobile-list li[aria-current="page"] a {
    font-weight: 500;
    color: var(--light-mode-text-001, #303030);
}

/* Locked items (paywall) */
.gro-toc-mobile-modal__content .pillar-aside__item--locked a {
    color: var(--light-mode-text-003, #aaa8a8);
}

/* Hide dividers (lock divider) — упрощено на mobile */
.gro-toc-mobile-modal__content .pillar-aside__divider {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    margin-left: 0;
}

.gro-toc-mobile-modal__content .pillar-aside__divider-line {
    flex: 1;
    height: 1px;
    background: var(--light-mode-border, #c4c2bc);
}

/* Solution TOC inside modal — снять padding/border (он рассчитан на desktop) */
.gro-toc-mobile-modal__content .gro-solution-toc {
    padding: 0;
    border-radius: 0;
}

.gro-toc-mobile-modal__content .gro-solution-toc__close,
.gro-toc-mobile-modal__content .gro-solution-toc__title {
    display: none; /* дублирует header модалки */
}

/* Theme toggle inside modal — bottom right (Figma 6479-67344) */
.gro-toc-mobile-modal__theme {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 1;
}

/* Body scroll-lock когда modal открыт */
body.gro-toc-modal-open {
    overflow: hidden;
    touch-action: none;
}

/* Desktop hide modal (на случай accidental open) */
@media (min-width: 769px) {
    .gro-toc-mobile-modal {
        display: none !important;
    }
}
