/* ========== Страница: список мастер-классов ========== */
.mc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* ========== Страница: один мастер-класс ========== */
.mc-detail {
    padding-top: 2rem;
    padding-bottom: 4rem;
}
.mc-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    cursor: pointer;
}
.mc-detail-back:hover { color: var(--pink-dark); }
.mc-detail h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.2;
}
.mc-video-wrap {
    position: relative;
    width: 82%;
    max-width: 720px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.13);
    margin: 0 auto 1.5rem;
}
/* Fallback для браузеров без aspect-ratio через padding */
@supports not (aspect-ratio: 16 / 9) {
    .mc-video-wrap {
        aspect-ratio: auto;
        height: 0;
        padding-top: 56.25%;  /* 16:9 */
    }
}
@media (max-width: 768px) {
    .mc-video-wrap {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
        /* Жёстко гарантируем правильную высоту даже без aspect-ratio */
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
    }
}
.mc-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Постер-фолбек для VK/RuTube */
.mc-video-poster {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #111;
}
.mc-video-poster-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--pink);
    color: #fff;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    font-family: 'Raleway', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(233,30,99,0.4);
}
.mc-video-poster-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 28px rgba(233,30,99,0.55);
}
.mc-video-poster-note {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
}
.mc-detail-description {
    background: #fff;
    border-radius: 20px;
    padding: 1.8rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 3px 14px rgba(0,0,0,0.05);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}
.mc-detail-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.mc-products-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--pink-dark);
    margin-bottom: 0.5rem;
}
.mc-products-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}
.mc-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

/* ========== Layout детальной МК с боковой панелью ========== */
.mc-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.mc-detail-main { min-width: 0; }
.mc-detail-main .mc-video-wrap {
    width: 100%;
    max-width: 100%;
}
.mc-sidebar {
    background: #fff;
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: 0 3px 14px rgba(0,0,0,0.05);
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pink-light) transparent;
}
.mc-sidebar::-webkit-scrollbar { width: 6px; }
.mc-sidebar::-webkit-scrollbar-thumb {
    background: var(--pink-light);
    border-radius: 3px;
}
.mc-sidebar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    color: var(--pink-dark);
    margin-bottom: 0.85rem;
    font-weight: 600;
}
.mc-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: space-evenly;
}
.mc-sidebar-item {
    display: flex;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    border-radius: 12px;
    transition: background 0.18s;
    text-decoration: none;
    color: var(--text);
}
.mc-sidebar-item:hover { background: var(--pink-light); }
.mc-sidebar-item.is-active {
    background: var(--pink-light);
    box-shadow: inset 3px 0 0 var(--pink);
    cursor: default;
}
.mc-sidebar-item.is-active .mc-sidebar-name {
    color: var(--pink-dark);
}
.mc-sidebar-item.is-active .mc-sidebar-thumb::after {
    content: '●';
    font-size: 0.85rem;
    opacity: 1;
}
.mc-sidebar-thumb {
    flex: 0 0 120px;
    height: 70px;
    border-radius: 8px;
    background: #fef0f4 center/cover no-repeat;
    position: relative;
    overflow: hidden;
}
.mc-sidebar-thumb::after {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
    opacity: 0.85;
}
.mc-sidebar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.mc-sidebar-name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mc-sidebar-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 4px;
}
.mc-sidebar-empty {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* На планшетах, мобильных и горизонтальных смартфонах — сайдбар становится горизонтальной лентой под видео */
@media (max-width: 1100px), (max-height: 600px) {
    .mc-detail-layout {
        display: block;
    }
    .mc-detail-main {
        display: block;
        width: 100%;
    }
    .mc-sidebar {
        max-height: none;
        overflow: visible;
        padding: 1rem;
    }
    .mc-sidebar-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }
    .mc-sidebar-list::-webkit-scrollbar { display: none; }
    .mc-sidebar-item {
        flex: 0 0 240px;
        flex-direction: column;
        gap: 6px;
        padding: 0;
        scroll-snap-align: start;
    }
    .mc-sidebar-item.is-active {
        box-shadow: inset 0 -3px 0 var(--pink);
    }
    .mc-sidebar-thumb {
        flex: 0 0 auto;
        width: 100%;
        height: 130px;
    }
}

@media (max-width: 700px) {
    /* Слайдер на главной — горизонтальный в 1 ряд */
    .mc-slider {
        display: flex;
        grid-template-rows: unset;
        grid-auto-flow: unset;
        grid-auto-columns: unset;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;          /* прячем скроллбар на мобиле */
        gap: 1rem;
        padding: 0.25rem 0.5rem 0.75rem;
    }
    .mc-slider::-webkit-scrollbar { display: none; }
    .mc-slider-prev { left: -4px; display: flex; }
    .mc-slider-next { right: -4px; display: flex; }
    .mc-slider-arrow { width: 36px; height: 36px; font-size: 1.2rem; }

    /* Карточки в слайдере — компактнее */
    .mc-card {
        flex: 0 0 auto;
        width: 72vw;
        scroll-snap-align: start;
    }
    /* На мобиле стандартный 16:9 — не такой высокий */
    .mc-card-cover { aspect-ratio: 16 / 9; }

    /* Секция на главной — меньше отступов */
    .mc-home-section { padding: 2.5rem 0 3rem; margin-top: 0; }

    /* Страница-список МК — 1 колонка */
    .mc-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1rem;
    }
    /* Страница-список: карточки статичные (не flex) */
    .mc-grid .mc-card {
        width: 100%;
        flex: none;
    }
    .mc-grid .mc-card-cover { aspect-ratio: 16 / 9; }

    /* Детальная страница МК */
    .mc-detail h1       { font-size: 1.4rem; }
    .mc-detail-description { padding: 1.25rem 1.3rem; font-size: 0.92rem; }
    .mc-products-title  { font-size: 1.25rem; }
    .mc-products-grid   { grid-template-columns: repeat(2, 1fr); gap: 0.9rem; }
}
@media (max-width: 480px) {
    .mc-slider-arrow { display: none; }
    .mc-card { width: 80vw; }
    .mc-home-section { padding: 2rem 0 2.5rem; }
}

/* Дополнения для контактного блока внутри «О нас» */
.contacts-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    color: var(--pink);
    text-align: center;
    margin: 3rem 0 1.5rem;
}
.contacts-section h3 {
    color: var(--pink);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

/* ========== Визуальный редактор текста ========== */
.rich-editor-wrap {
    border: 1.5px solid #e0d0d8;
    border-radius: 12px;
    background: #fefcfd;
    overflow: hidden;
    margin: 8px 0;
    transition: border-color 0.2s;
}
.rich-editor-wrap:focus-within { border-color: var(--pink); }
.rich-editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: #f9f0f4;
    border-bottom: 1px solid #e0d0d8;
    flex-wrap: wrap;
}
.rich-editor-toolbar button {
    width: 32px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.rich-editor-toolbar button:hover { background: #fff; color: var(--pink); }
.rich-editor-toolbar button.active { background: var(--pink-light); color: var(--pink); }
.rich-editor-toolbar .toolbar-sep {
    width: 1px;
    background: #d9c4ce;
    margin: 3px 4px;
    align-self: stretch;
}
.rich-editor-body {
    min-height: 140px;
    padding: 12px 14px;
    outline: none;
    font-family: 'Raleway', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    overflow-y: auto;
}
.rich-editor-body:empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
}
/* Стили контента внутри редактора и при выводе */
.rich-content b, .rich-content strong,
.rich-editor-body b, .rich-editor-body strong { font-weight: 700; }
.rich-content i, .rich-content em,
.rich-editor-body i, .rich-editor-body em { font-style: italic; }
.rich-content u, .rich-editor-body u { text-decoration: underline; }
.rich-content s, .rich-editor-body s { text-decoration: line-through; }
.rich-content h2, .rich-editor-body h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--pink-dark);
    margin: 0.8em 0 0.3em;
}
.rich-content ul, .rich-editor-body ul { padding-left: 1.5em; margin: 0.4em 0; }
.rich-content ol, .rich-editor-body ol { padding-left: 1.5em; margin: 0.4em 0; }
.rich-content li, .rich-editor-body li { margin-bottom: 0.2em; }
.rich-content a, .rich-editor-body a { color: var(--pink-dark); }
.rich-content p, .rich-editor-body p { margin: 0 0 0.4em; }
