/* ================= ШРИФТЫ =================
   Montserrat и Merriweather лежат в папке fonts/ рядом с сайтом, а не на
   серверах Google. Поэтому страница не зависит от чужого домена: если Google
   замедлен или недоступен, шрифты всё равно загрузятся.

   Montserrat — вариативный шрифт: один файл содержит все начертания от 300
   до 700, поэтому объявлен диапазон font-weight: 300 700 (а не отдельный
   файл на каждый вес).
   Merriweather нужен только жирный — им набраны заголовки.

   unicode-range: два подмножества на начертание. Браузер скачивает только
   те, символы которых реально есть на странице: русская страница возьмёт
   кириллицу и латиницу, и больше ничего. */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/montserrat-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/montserrat-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: 'Merriweather';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/merriweather-cyrillic-700.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Merriweather';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/merriweather-latin-700.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;
}

:root {
    --bg: #fafafa;
    --text: #1a1a1a;
    --accent: #000000;
    --gray: #5f5f5f;
    --border: #e2e2e2;
    --success: #047857;
    --danger: #ef4444;
}

/* ================= СБРОС И БАЗОВЫЕ СТИЛИ ================= */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html { overflow-y: scroll; }

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

/* ================= ТИПОГРАФИКА ================= */
h1, h2, h3, h4, h5, h6, .page-title, .section-title, nav a, .btn-primary, .hero-title, .category-header {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 0;
}

p {
    line-height: 1.8;
    font-size: 15px;
    color: #444;
    font-weight: 300;
}

/* ================= СЕТКА И БЛОКИ ================= */
/* width: 100% обязателен: body — флекс-колонка, а `margin: 0 auto` отменяет
   растягивание флекс-элемента по ширине. Без width контейнер сжимался бы
   по содержимому (на странице «Медиа» — до ~600 px вместо 1200), и сетка
   фотографий выстраивалась в одну колонку. */
.container { max-width: 700px; width: 100%; margin: 0 auto; padding: 0 20px; }
.media-container { max-width: 1200px; width: 100%; margin: 0 auto; text-align: center; }
.page-container { padding-top: 100px; padding-bottom: 120px; }
.section-block { padding-top: 80px; margin-bottom: 80px;   }
#about.section-block { padding-top: 30px; }
.section-title { font-size: 32px; text-align: center; margin-bottom: 30px; }

/* ================= НАВИГАЦИЯ ================= */
nav {
    position: fixed; top: 0; left: 0; width: 100%;
    background: rgba(250, 250, 250, 0.9);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000; display: flex; justify-content: center; padding: 20px 0;
}
nav a {
    font-family: 'Montserrat', sans-serif; margin: 0 18px; text-decoration: none;
    color: var(--text); font-weight: 500; font-size: 13px; text-transform: uppercase;
    letter-spacing: 1.5px; padding-bottom: 4px; border-bottom: 1px solid transparent; transition: 0.3s ease;
}
nav a:hover { color: var(--gray); }
nav a.active { border-bottom: 1px solid var(--accent); }

/* ================= ГЛАВНАЯ СТРАНИЦА ================= */
header { text-align: center; padding: 100px 20px 20px; }
.hero-img { width: 220px; height: 280px; border-radius: 8px; object-fit: cover; object-position: center; margin-bottom: 30px; box-shadow: 0 15px 40px rgba(0,0,0,0.12); }
.hero-title { font-size: 46px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.hero-subtitle { font-family: 'Montserrat', sans-serif; color: var(--gray); font-size: 14px; text-transform: uppercase; letter-spacing: 3px; }

/* ================= КНОПКИ И ВКЛАДКИ ================= */
.media-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 30px; flex-wrap: wrap; }
.tab-btn {
    background: transparent; border: 2px solid var(--accent); color: var(--accent);
    padding: 10px 30px; font-size: 14px; cursor: pointer; text-transform: uppercase;
    letter-spacing: 1px; transition: all 0.3s ease; font-family: 'Montserrat', sans-serif;
    font-weight: 500; border-radius: 4px; text-decoration: none; display: inline-block;
}
.tab-btn:hover, .tab-btn.active { background: var(--accent); color: #fff; border-color: transparent; background-clip: padding-box; }
.tab-content { display: none; opacity: 0; transition: opacity 0.4s ease; animation: fadeIn 0.5s; }
.tab-content.active { display: block; opacity: 1; }

.btn-outline, .action-btn {
    background: transparent; border: 1px solid var(--border); padding: 8px 16px;
    font-family: 'Montserrat', sans-serif; font-size: 11px; text-transform: uppercase;
    letter-spacing: 1px; cursor: pointer; border-radius: 4px; transition: all 0.3s ease;
    color: var(--text); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-outline:not(:disabled):hover, .action-btn:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.btn-outline:disabled { color: #bbb; border-color: #eee; cursor: not-allowed; }
.copy-success { background: var(--success) !important; color: #fff !important; border-color: var(--success) !important; }

/* ================= ФИЛЬТРЫ ================= */
.gallery-filters { text-align: center; margin-bottom: 25px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.filter-btn {
    background: transparent; border: 1px solid var(--border); padding: 10px 20px;
    font-family: 'Montserrat', sans-serif; font-size: 12px; text-transform: uppercase;
    letter-spacing: 1px; cursor: pointer; border-radius: 4px; transition: all 0.3s ease;
    color: var(--gray); font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
}
.filter-btn .badge, .filter-btn .count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.08); color: var(--gray); border-radius: 10px;
    padding: 2px 7px; font-size: 10px; margin-left: 8px; font-weight: 700; transition: all 0.3s ease;
}
.filter-btn.active, .filter-btn:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.filter-btn.active .badge, .filter-btn:hover .badge, .filter-btn.active .count-badge, .filter-btn:hover .count-badge { background: rgba(255, 255, 255, 0.25); color: #ffffff; }

/* ================= РЕПЕРТУАР И ТРЕКИ ================= */
.search-box {
    width: 100%; padding: 16px 20px; font-size: 15px; font-family: 'Montserrat', sans-serif;
    border: 1px solid var(--border); border-radius: 4px; background: transparent;
    box-sizing: border-box; margin-bottom: 20px; outline: none; transition: 0.3s ease;
}
.search-box:focus { border-color: var(--accent); }
#emptyMessage { display: none; text-align: center; color: var(--gray); margin-top: 40px; }

.track-item { display: flex; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: 0.3s; min-height: 75px; box-sizing: border-box; }
.track-item:hover { transform: translateX(5px); }
.track-item input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-right: 20px;
    border: 1px solid var(--gray); border-radius: 3px; background: transparent; position: relative;
    cursor: pointer; outline: none; transition: 0.2s ease; margin-top: 2px; flex-shrink: 0;
}
.track-item input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.track-item input[type="checkbox"]:checked::after {
    content: ''; position: absolute; top: 4px; left: 8px; width: 4px; height: 9px;
    border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.track-info { flex-grow: 1; margin-left: 15px; padding-right: 15px; min-width: 0; }
.track-title { font-size: 16px; font-weight: 500; overflow-wrap: break-word; }
.track-author { font-size: 13px; color: var(--gray); margin-top: 4px; }
.track-duration { font-size: 14px; color: var(--gray); font-variant-numeric: tabular-nums; flex-shrink: 0; padding-top: 2px; }

/* Названия в кавычках не разрываются переносом строки:
   «Ария Ленского из оперы "Евгений Онегин"» переносится только
   до кавычек или после них, но не внутри названия оперы.
   Класс ставит vpKeepQuoted() в bootstrap.php. */
.vp-nowrap { white-space: nowrap; }

/* ================= ОПЕРНЫЕ ПАРТИИ ================= */
.roles-grid { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; text-align: left; }
.role-item { background: #fdfdfd; border: 1px solid var(--border); padding: 20px; border-radius: 4px; transition: box-shadow 0.3s ease; }
.role-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.role-composer { font-size: 13px; color: var(--gray); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
/* 700, а не 600: у Merriweather на сайте только жирное начертание. */
.role-opera { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 5px; font-family: 'Merriweather', serif; }
.role-part { font-size: 15px; color: var(--text); }
.private-badge { background: var(--danger); color: white; font-size: 12px; padding: 4px 8px; border-radius: 4px; vertical-align: middle; margin-left: 10px; font-family: 'Montserrat', sans-serif; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }

/* ================= НИЖНЯЯ ПАНЕЛЬ СБОРКИ ================= */
.bottom-panel { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background: rgba(250, 250, 250, 0.98); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); 
    padding: 15px 20px; 
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px)); /* Учет безопасной зоны */
    box-sizing: border-box; 
    display: flex; 
    justify-content: center; 
    z-index: 2000; /* Повышен z-index */
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08); /* Тень для выделения */
}
.panel-content { max-width: 700px; width: 100%; display: flex; justify-content: space-between; align-items: center; }
.summary-text { font-family: 'Montserrat', sans-serif; line-height: 1.4; flex-shrink: 0; }
.summary-text strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.panel-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ================= КОНТАКТЫ И БИОГРАФИЯ ================= */
.contact-cards { display: flex; flex-direction: column; gap: 12px; max-width: 550px; margin: 30px auto 0; }
.contact-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; padding: 16px 20px; border: 1px solid var(--border); border-radius: 8px; background: #ffffff; box-shadow: 0 2px 4px rgba(0,0,0,0.02); transition: transform 0.2s, box-shadow 0.2s; }
.contact-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
.contact-info { display: flex; align-items: center; gap: 12px; }
.contact-icon { font-size: 20px; line-height: 1; }
.contact-text { font-size: 15px; font-weight: 500; color: var(--text); word-break: break-all; font-family: 'Montserrat', sans-serif; }
.contact-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }

.bio-wrapper { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s ease-out; }
.bio-wrapper.open { grid-template-rows: 1fr; }
.bio-inner { overflow: hidden; }
.bio-inner .rich-text { margin: 15px 0 0 0; padding-top: 20px; border-top: 1px dashed var(--border); }

/* ================= МЕДИА (ВИДЕО И ФОТО) ================= */
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; text-align: left; }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 4px; background-color: #000; }
.video-wrapper iframe, .video-wrapper video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; object-fit: cover; }
.video-item h3 { font-size: 16px; margin-top: 12px; font-weight: 500; font-family: 'Montserrat', sans-serif; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.gallery-item { position: relative; overflow: hidden; border-radius: 6px; cursor: pointer; aspect-ratio: 4/5; background: #f9f9f9; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.gallery-item:hover img { transform: scale(1.05); }

/* ================= ЛАЙТБОКС (LIGHTBOX) ================= */
.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 15, 15, 0.98); z-index: 2000; justify-content: center; align-items: center; flex-direction: column; opacity: 0; transition: opacity 0.3s ease; }
.lightbox.show { opacity: 1; display: flex; }
.lightbox img { max-width: 90%; max-height: 85vh; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); user-select: none; }
.lightbox-caption { color: #ffffff; font-family: 'Montserrat', sans-serif; margin-top: 20px; font-size: 14px; letter-spacing: 0.5px; opacity: 0.8; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: #ffffff; font-size: 40px; font-weight: 300; cursor: pointer; transition: opacity 0.2s; z-index: 2002; line-height: 1; }
.lightbox-close:hover { opacity: 0.7; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #ffffff; font-size: 50px; font-weight: 300; cursor: pointer; user-select: none; padding: 20px; transition: opacity 0.3s; z-index: 2001; opacity: 0.7; }
.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ================= ФУТЕР ================= */
.site-footer { margin-top: auto; padding: 30px 40px; border-top: 1px solid var(--border); font-family: 'Montserrat', sans-serif; display: flex; justify-content: center; align-items: center; position: relative; }
.footer-socials { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 0; }
.social-btn { display: inline-block; background: transparent; border: 1px solid var(--border); padding: 8px 20px; font-family: 'Montserrat', sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; border-radius: 4px; transition: all 0.3s ease; color: var(--gray); font-weight: 500; text-decoration: none; }
.social-btn:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.footer-copy { position: absolute; right: 40px; color: var(--gray); font-size: 14px; text-align: right; }

/* ================= АНИМАЦИИ ================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================= МЕДИА-ЗАПРОСЫ (АДАПТИВ) ================= */
@media (max-width: 768px) {
    nav { padding: 15px 5px; flex-wrap: nowrap; justify-content: center; gap: 12px; }
    nav a { margin: 0; font-size: 12px; letter-spacing: 0; white-space: nowrap; }

    .site-footer { flex-direction: column; padding: 25px 15px; gap: 15px; }
    .footer-copy { position: static; text-align: center; width: 100%; }

    .media-tabs { display: flex; flex-wrap: wrap; width: 100%; gap: 10px; box-sizing: border-box; }
    .tab-btn { flex: 1 1 150px; padding: 12px 10px; font-size: 12px; box-sizing: border-box; text-align: center; white-space: nowrap; }

    .track-item input[type="checkbox"] { margin-right: 12px; width: 20px; height: 20px; }
    .track-info { margin-left: 0; padding-right: 10px; min-width: 0; }
    .track-duration { font-size: 13px; }
    .filter-btn { padding: 8px 12px; font-size: 11px; }

    .lightbox-nav { font-size: 35px; padding: 10px; }
    .lightbox-prev { left: 5px; }
    .lightbox-next { right: 5px; }
}

@media (max-width: 600px) {
    .bottom-panel {
        padding: 12px 15px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .panel-content { flex-direction: row !important; align-items: center !important; gap: 15px; }
    .panel-actions { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
    .btn-outline, .action-btn { padding: 8px 10px; font-size: 10px; width: 100%; text-align: center; }

    .role-item { flex-direction: column; align-items: flex-start; }
    .role-opera { width: 100%; margin-bottom: 4px; }
    
    .contact-card { flex-direction: column; align-items: flex-start; }
    .contact-actions { width: 100%; margin-left: 0; }

    /* Галерея на телефоне: две плитки в ряд вместо одной. При одной колонке
       каждое фото занимало весь экран и страница превращалась в длинную ленту. */
    .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ================= RICH TEXT CONTENT ================= */
.rich-text { line-height: 1.8; font-size: 15px; color: #444; font-weight: 300; overflow-wrap: break-word; }
.rich-text p { margin: 0 0 1em 0; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text h2,
.rich-text h3,
.rich-text h4 { font-family: 'Merriweather', serif; color: var(--text); margin: 1.2em 0 0.5em 0; line-height: 1.3; }
.rich-text h2 { font-size: 24px; }
.rich-text h3 { font-size: 20px; }
.rich-text h4 { font-size: 17px; }
.rich-text ul,
.rich-text ol { margin: 0.5em 0 1em 0; padding-left: 1.5em; }
.rich-text li { margin-bottom: 0.4em; }
.rich-text blockquote {
    border-left: 3px solid var(--border);
    margin: 1em 0;
    padding: 0.4em 0 0.4em 1em;
    color: var(--gray);
    font-style: italic;
}
.rich-text a { color: var(--text); text-decoration: underline; }
.rich-text a:hover { color: var(--gray); }
.rich-text strong, .rich-text b { font-weight: 600; }
.rich-text em, .rich-text i { font-style: italic; }
.rich-text .ql-align-center { text-align: center; }
.rich-text .ql-align-right { text-align: right; }
.rich-text .ql-align-justify { text-align: justify; }
/* ================= ДОСТУПНОСТЬ ================= */
/* Видимый фокус для клавиатуры (мышью рамка не появляется). */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}
.search-box:focus-visible,
.track-item input:focus-visible,
.filter-btn:focus-visible,
.tab-btn:focus-visible,
.action-btn:focus-visible,
.copy-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Ссылки-кнопки внутри карточек контактов и футера. */
a.action-btn, a.social-btn, .tab-btn { -webkit-tap-highlight-color: transparent; }

/* Уважаем системную настройку «меньше движения». */
@media (prefers-reduced-motion: reduce) {
    html, body { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .gallery-item:hover img { transform: none; }
}

/* Печать программы выступления: только текст. */
@media print {
    nav, .site-footer, .media-tabs, .bottom-panel, .gallery-filters, .filter-btn,
    .action-btn, .btn-outline, .hero-img, .lightbox,
    .section-title .private-badge {
        display: none !important;
    }
    body { background: #fff; color: #000; }
    .container, .page-container, .media-container { max-width: none; padding: 0; margin: 0; }
    .tab-content { display: block !important; opacity: 1 !important; }
    .track-item { border-bottom: 1px solid #ddd; padding: 5px 0; min-height: 0; }
    .track-duration { color: #333; }
    a { text-decoration: none; color: #000; }
}