/* ============================================= */
/* Root Variables                                */
/* ============================================= */
:root {
    --primary: #FFD700;
    --secondary: #111111;
    --accent: #FFC400;
    --text: #E0E0E0;
    --dark-gray: #222222;
}

/* ============================================= */
/* Basic HTML Element Styling                    */
/* ============================================= */
html {
    scroll-behavior: smooth; /* Плавная прокрутка при переходе по якорям */
}

body {
    background-color: var(--secondary); /* Используем переменную из root */
    color: var(--text); /* Используем переменную из root */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Более полный шрифт */
    margin: 0;
    padding: 0;
    min-height: 100vh; /* Гарантирует, что body занимает всю высоту viewport */
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Предотвращает горизонтальный скролл */
    padding-top: 48px; /* Отступ сверху для фиксированного хедера, если он 48px высотой */
}

/* Общие стили для ссылок */
a {
    color: inherit; /* Наследуем цвет текста от родителя */
    text-decoration: none; /* Убираем подчеркивание */
    transition: color 0.3s ease; /* Плавный переход цвета при наведении */
}

a:hover {
    color: var(--primary); /* Цвет при наведении */
}

/* Общие стили для изображений */
img {
    max-width: 100%;
    height: auto;
    display: block; /* Убирает лишний отступ под изображением */
}

/* ============================================= */
/* Layout / Structure                            */
/* ============================================= */
/* Стили для хедера */
header {
    background-color: rgba(0, 0, 0, 0.8) !important; /* Черный с 70% непрозрачности */
    text-align: center; /* Центрирование содержимого, если не переопределено flexbox */
    padding: 1rem 0; /* py-4 из Tailwind (0.75rem 1.5rem) */
    position: fixed; /* Фиксируем хедер */
    top: 0;
    left: 0;
    right: 0;
    z-index: 50; /* Высокий z-index, чтобы хедер был поверх других элементов */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* Shadow-md из Tailwind */
}
.card h3 {
    color: var(--primary); /* Применяем желтый цвет из вашей переменной */
}
/* Контейнер для контента (аналог .container в Tailwind) */
.container {
    max-width: 1200px; /* Ограничение максимальной ширины контента */
    margin-left: auto; /* Центрирование контейнера */
    margin-right: auto;
    padding-left: 1rem; /* Горизонтальные отступы внутри контейнера */
    padding-right: 1rem;
}

/* Для плавного появления/скрытия контента (необязательно, но улучшает UX) */
.full-article-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 0;
}

.full-article-content:not(.hidden) { /* Используем not(.hidden) вместо .visible, так как скрывать будем через .hidden */
    max-height: 2000px; /* Достаточно большое значение, чтобы вместить весь контент */
    opacity: 1;
}

/* Если вы хотите, чтобы кнопка "Читать дальше" или "Свернуть" оставалась на той же строке */
.read-more-toggle {
    display: inline-block; /* Или inline-flex, если там иконка */
    white-space: nowrap; /* Чтобы текст не переносился */
}

/* Секции */
.section {
    padding: 0.5rem 0; /* Стандартные вертикальные отступы для секций */
}

.section#home {
    padding-top: 0 !important; /* Для первой секции "Главная" убираем верхний отступ */
}
.section-spacing {
    margin-top: 0.5rem; /* Отступ между секциями */
}
.section h2 {
    margin-bottom: 3rem; /* Общий отступ для заголовков секций (аналог mb-12) */
    text-align: center; /* Центрирование заголовков секций */
}

/* Секции с iframe */
.section-iframe-fullwidth {
    padding-top: 4rem; /* Оставляем отступ сверху для заголовка */
    padding-bottom: 0; /* Убираем нижний отступ секции, если iframe последний элемент */
}

.iframe-container { /* Общий контейнер для iframe */
    background-color: var(--dark-gray); /* Фон контейнера совпадает с карточками */
    padding: 1rem; /* Небольшой отступ вокруг iframe */
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    max-width: 1200px; /* Ограничиваем максимальную ширину для больших экранов */
    margin-left: auto;
    margin-right: auto;
}

.iframe-container iframe {
    display: block; /* Убирает лишний отступ под iframe */
    background-color: #0D1117; /* Фон самого iframe, соответствует фону ментальной карты */
    border-radius: 4px; /* Скругляем углы iframe, если контейнер скруглен */
    width: 100%; /* Убедимся, что iframe занимает всю ширину контейнера */
    height: 80vh; /* Пример: iframe занимает 80% высоты viewport */
    border: none; /* Убираем границу iframe */
}

.iframe-container-fullwidth { /* Контейнер для полноширинного iframe */
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.iframe-container-fullwidth iframe {
    border-radius: 0;
}

/* ============================================= */
/* Utility Classes (из Tailwind CSS)             */
/* ============================================= */
/*
    Удалены дублирующиеся утилитарные классы Tailwind, так как они уже
    импортируются из tailwind.min.css. Их прямое переопределение
    в style.css не рекомендуется и может привести к конфликтам.
    Оставьте их использование в HTML.
*/

/* ============================================= */
/* Components                                    */
/* ============================================= */

/* Эффект появления при скролле */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Логотип */
.logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
}

/* Пункты навигации */
.nav-item {
    position: relative;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.nav-item:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    bottom: 0;
    left: 0;
    transition: width 0.3s ease;
}

.nav-item:hover:after,
.nav-item.active:after {
    width: 100%;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

h2 {
    color: var(--primary); /* Применяем желтый цвет из вашей переменной */
}

/* Текст в Hero-секции */
.hero-text {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    margin-top: 1rem;
}

/* Кнопки */
.btn-primary {
    background-color: var(--primary);
    color: var(--secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary:hover {
    background-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* Карточки */
.card {
    background-color: var(--dark-gray); /* ИСПРАВЛЕНО: Было var(#333333); */
    border-radius: 8px;
    overflow: hidden;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2);
}

.service-card {
    border-left: 4px solid var(--primary);
}

/* Таймлайн */
.timeline-item {
    position: relative;
    padding-left: 30px;
    margin-bottom: 30px;
}

.timeline-item:before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 12px;
    height: 12px;
    background-color: var(--primary);
    border-radius: 50%;
}

.timeline-item:after {
    content: '';
    position: absolute;
    left: 5px;
    top: 20px;
    width: 2px;
    height: calc(100% + 10px);
    background-color: var(--primary);
}

.timeline-item:last-child:after {
    display: none;
}

/* Портфолио */
.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.portfolio-item img {
    display: block;
    width: 100%;
    transition: transform 0.5s ease;
}

.portfolio-item:hover img {
    transform: scale(1.05);
}

.portfolio-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent); /* Увеличил непрозрачность до 90% */
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    transform: translateY(0);
}



.portfolio-item-link {
    display: block; /* Сделать ссылку блочным элементом, чтобы она занимала все доступное пространство */
    text-decoration: none; /* Убрать подчеркивание, если оно появляется */
    color: inherit; /* Наследовать цвет текста от родителя (по умолчанию может быть синим) */
}

/* Также, если вы хотите, чтобы при наведении на весь блок portfolio-item были эффекты,
    можете перенести :hover стили с .portfolio-item на .portfolio-item-link,
    или оставить их на .portfolio-item, так как hover на родителе сработает.
    Например, для transform translateY и box-shadow: */
.portfolio-item-link:hover .portfolio-item {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2);
}



/* Формы */
.form-input {
    background-color: var(--dark-gray);
    border: 1px solid #444;
    color: var(--text);
    padding: 0.75rem;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Иконки соц. сетей */
.social-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--dark-gray);
    color: var(--primary);
    border-radius: 50%;
    margin-right: 10px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-3px);
    background-color: var(--primary);
    color: var(--secondary);
}

/* Бэйджи */
.ai-badge {
    background-color: var(--primary);
    color: var(--secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* ============================================= */
/* Animations & Animated Components              */
/* ============================================= */
.glowing-border {
    position: relative;
}

.glowing-border:after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--primary);
    border-radius: 10px;
    animation: glow 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px var(--primary);
    }
    50% {
        box-shadow: 0 0 20px var(--primary);
    }
    100% {
        box-shadow: 0 0 5px var(--primary);
    }
}

.ai-animation {
    position: relative;
    overflow: hidden;
}

.ai-animation:after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.2), transparent);
    animation: ai-scan 3s infinite;
}

@keyframes ai-scan {
    0% {
        left: -100%;
    }
    50% {
        left: 0%;
    }
    100% {
        left: 100%;
    }
}

/* ============================================= */
/* Mentale Map Specific Styles (New Additions)   */
/* ============================================= */
.mind-map {
    display: flex;
    justify-content: center;
    padding: 2rem;
    overflow-x: auto;
}

.mind-map-container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    width: 100%;
}

.central-node {
    background: var(--primary);
    color: var(--secondary);
    border-radius: 10px;
    padding: 1rem 2rem;
    margin: 1rem auto;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.branches {
    display: grid;
    grid-template-columns: repeat(1, 1fr); /* Default to 1 column on mobile */
    gap: 1.5rem;
}

.branch {
    background: var(--dark-gray);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.branch-title {
    font-weight: bold;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-icon {
    width: 1rem;
}

/* Styles for collapsible content - hidden by default */
.collapsible-content,
.subbranches {
    display: none;
}

/* When not collapsed, display as block */
.collapsible-content:not(.collapsed),
.subbranches:not(.collapsed) {
    display: block;
}

.subbranch {
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leaf {
    background: #333;
    color: var(--text);
    border-left: 3px solid var(--primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.price {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================= */
/* Responsive / Mobile-Specific Styles           */
/* ============================================= */

/* Мобильное меню: Отображается только на мобильных и скрывается через JS при клике. */
/* Изначально скрыто с помощью 'hidden' в HTML, но при удалении 'hidden' должно быть flex */
#mobile-menu:not(.hidden) {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: var(--secondary);
    position: absolute; /* Позиционируем относительно хедера */
    top: 100%; /* Размещаем сразу под хедером */
    left: 0;
    right: 0;
    padding: 1rem 0;
    border-top: 1px solid var(--dark-gray);
    z-index: 49; /* Ниже хедера, но выше остального контента */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); /* Небольшая тень */
}

#mobile-menu a {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--dark-gray);
    display: block;
    color: var(--text); /* Цвет текста для пунктов меню */
}

#mobile-menu a:last-child {
    border-bottom: none;
}


/* Media queries for responsiveness */
/* md breakpoint (768px) */
@media (min-width: 768px) {
    /* На экранах md и выше, скрываем мобильное меню и отображаем десктопное */
    #mobile-menu {
        display: none !important; /* Убедитесь, что мобильное меню скрыто на больших экранах */
    }

    /* For .branches on md screens */
    .branches {
      grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
    }
}

/* lg breakpoint (1024px) */
@media (min-width: 1024px) {
    /* For .branches on lg screens */
    .branches {
      grid-template-columns: repeat(3, 1fr); /* 3 columns on large screens */
    }
}

/* New breakpoint for 4 columns on very large screens */
@media (min-width: 1200px) {
  .branches {
    grid-template-columns: repeat(4, 1fr); /* 4 columns on very large screens */
  }
}

/* Print styles (already existed) */
@media print {
  body {
    background-color: white;
    color: black;
  }
  .branch {
    background: white;
    border-left-color: #ccc;
  }
  .leaf {
    background: #eee;
    color: black;
  }
}