/* ===== АДАПТИВНОСТЬ ===== */

/* Для экранов 1200px и меньше */
@media (max-width: 1200px) {
  .nav__text {
    font-size: 1.2rem;
  }

  .hero__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Для экранов 992px и меньше */
@media (max-width: 992px) {
  .header__logo-title {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
  }

  .header__tagline {
    font-size: clamp(0.7rem, 2vw, 1rem);
  }

  .hero__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .categories__grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Для экранов 768px и меньше (планшеты) */
@media (max-width: 768px) {

  /* Шапка */
  .navbar {
    padding: 15px 0;
    position: sticky;
    top: 0;
  }

  .header__inner {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }

  /* Логотип - может сжиматься */
  .header__logo-section {
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
  }

  .header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .header__logo-icon {
    font-size: clamp(1.5rem, 5vw, 2rem);
    flex-shrink: 0;
  }

  .header__logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    white-space: nowrap;
  }

  .header__logo-title {
    /* font-size: clamp(1rem, 4vw, 1.5rem); */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header__tagline {
    /* font-size: clamp(0.65rem, 2.5vw, 0.9rem); */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Скрываем навигацию */
  .header__nav {
    display: none;
  }

  /* Бургер-меню */
  .mobile-menu-btn {
    display: flex !important;
    order: 1;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    /* font-size: 1.5rem; */
    flex-shrink: 0;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 1001;
  }

  /* Авторизация */
  .header__auth {
    order: 2;
    display: flex;
    /* justify-content: flex-end; */
    gap: 20px;
    flex-shrink: 0;
    width: 100%;

  }

  .header__btn {
    padding: 6px 12px;
    font-size: clamp(0.8rem, 3vw, 1rem);
    white-space: nowrap;
  }

  /* Профиль пользователя */
  .header__user {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .header__user-link {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .header__avatar {
    width: 28px;
    height: 28px;
  }

  .header__username {
    font-size: 1rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header__logout {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  /* Иконки уведомлений */
  .header__icons {
    display: flex;
    gap: 10px;
    margin-right: 0;
  }

  .header__icon {
    font-size: 1.1rem;
  }

  .header__badge {
    font-size: 0.6rem;
    min-width: 16px;
    padding: 2px 4px;
    top: -6px;
    right: -6px;
  }

  /* Герой */
  .hero {
    padding: 40px 0;
  }

  .hero__content {
    margin-bottom: 30px;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__stats {
    grid-template-columns: 1fr;
  }

  .hero__buttons {
    flex-direction: column;
    align-items: center;
  }

  /* Категории */
  .categories__grid {
    grid-template-columns: 1fr;
  }

  /* Темы */
  .topic__stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  /* Формы */
  .register__card {
    padding: 20px;
  }

  .card--info {
    padding: 40px 20px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-header__subtitle {
    font-size: 1rem;
    line-height: 1.2;
  }
}

/* Для экранов 576px и меньше (телефоны) */
@media (max-width: 576px) {

  /* Шапка */
  .header__inner {
    gap: 8px;
  }

  .header__logo-icon {
    /* font-size: clamp(1.2rem, 4vw, 1.5rem); */
  }

  .header__logo-title {
    /* font-size: clamp(0.85rem, 3.5vw, 1.2rem); */
  }

  .header__tagline {
    /* font-size: clamp(0.55rem, 2vw, 0.7rem); */
  }

  .mobile-menu-btn {
    width: 36px;
    height: 36px;
    /* font-size: 1.2rem; */
  }

  .header__btn {
    padding: 5px 10px;
    /* font-size: clamp(0.7rem, 2.5vw, 0.85rem); */
  }

  .header__btn-img {
    font-size: 0.75rem;
  }

  .header__avatar {
    width: 24px;
    height: 24px;
  }

  .header__username {
    font-size: 0.9rem;
    max-width: 100px;
  }

  .header__logout {
    font-size: 0.75rem;
    padding: 3px 6px;
  }

  .header__icon {
    font-size: 1.1rem;
  }

  .header__auth {
    row-gap: 8px;
  }

  /* Мобильное меню */
  .mobile-menu {
    width: 70%;
  }

  .mobile-menu__list {
    gap: 20px;
  }

  .mobile-menu__link {
    font-size: 1rem;
    /* padding: 8px 0; */
  }

  .mobile-menu__btn {
    font-size: 0.9rem;
  }

  /* Секции */
  .section {
    padding: 20px 0 20px;
  }

  .section-title {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 1.2rem;
  }

  .section__icon {
    font-size: 1.8rem;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .page-header__title {
    font-size: 1.5rem;
  }

  .page-header__subtitle {
    font-size: 0.9rem;
  }

  .container {
    padding: 0 15px;
  }

  /* Герой */
  .hero {
    padding: 40px 0;
  }

  .hero__title {
    font-size: 1.5rem;
    margin-bottom: 12px;
  }

  .hero__descr {
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .btn-secondary {
    padding: 10px 20px;
    font-size: 1rem;
  }

  .hero__card {
    padding: 12px;
  }

  .hero__number {
    font-size: 1.8rem;
  }

  /* Категории */

  .categories__grid {
    gap: 20px;
  }

  .categories__card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 12px;
  }

  .categories__icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    margin-right: 0;
  }

  .categories__subtitle {
    font-size: 1rem;
    margin: 0;
  }

  .categories__descr {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0;
    grid-column: 1 / -1;
  }

  .categories__stats {
    grid-column: 1 / -1;
  }

  .categories__stats-text {
    font-size: 0.75rem;
    gap: 5px;
  }

  /* Темы */
  .topics-section {
    padding-top: 0;
    padding-bottom: 20px;
  }

  .topics__list {
    margin-bottom: 20px;
  }

  .topics__item {
    padding: 12px;
  }

  .topic {
    gap: 10px;
  }

  .topic__icon {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .topic__title {
    font-size: 0.95rem;
  }

  .topic__meta {
    gap: 6px;
  }

  .topic__author,
  .topic__categories,
  .topic__time {
    font-size: 0.75rem;
  }

  .topic__stats {
    font-size: 0.75rem;
    gap: 12px;
  }

  /* Особенности */
  .features__grid {
    gap: 15px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .feature__card {
    padding: 12px;
    width: 100%;
  }

  .feature__icon {
    width: 45px;
    height: 45px;
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  .feature__title {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  .feature__descr {
    color: var(--color-text-secondary);
    font-size: 1rem;
    line-height: 1.5;

    /* ✅ Добавьте эти свойства для переноса текста */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;

    /* ✅ Для переноса длинных слов без пробелов */
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;

    /* ✅ Ограничиваем ширину */
    max-width: 100%;
    width: 100%;
  }

  /* Футер */
  .footer {
    padding: 20px 0;
  }

  .footer__bottom {
    padding-top: 15px;
  }

  .footer__content {
    gap: 15px;
    margin-bottom: 15px;
    grid-template-columns: 1fr;
  }

  .footer__title {
    font-size: 1.2rem;
    margin-bottom: 8px;
  }

  .footer__descr {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .footer__subtitle {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .footer__link {
    font-size: 0.8rem;
  }

  .social__link {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  /* Карточки */
  .card--info,
  .card--register {
    padding: 15px;
  }

  .card__title {
    font-size: 1.3rem;
  }

  .card__subtitle {
    font-size: 0.85rem;
    line-height: 1.4;
  }
}

/* Для экранов 450px и меньше */
@media (max-width: 450px) {
  .footer__content {
    flex-direction: column;
    gap: 20px;
  }

  .footer__column:not(:last-child) {
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 15px;
  }
}

/* Для экранов 400px и меньше */
/* @media (max-width: 400px) {
  .header__logo-icon {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
  }

  .header__logo-title {
    font-size: clamp(0.7rem, 3vw, 0.85rem);
  }

  .header__tagline {
    display: none;
  }

  .mobile-menu-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .header__btn {
    padding: 4px 8px;
    font-size: clamp(0.65rem, 2vw, 0.75rem);
  }

  .header__username {
    max-width: 45px;
    font-size: 0.7rem;
  }

  .header__avatar {
    width: 22px;
    height: 22px;
  }
} */

/* Для экранов 320px и меньше */
/* @media (max-width: 320px) {
  .header__inner {
    gap: 5px;
  }

  .header__logo-icon {
    font-size: 0.9rem;
  }

  .header__logo-title {
    font-size: 0.65rem;
  }

  .mobile-menu-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .header__btn {
    padding: 3px 6px;
    font-size: 0.6rem;
  }

  .header__username {
    max-width: 40px;
    font-size: 0.65rem;
  }

  .header__avatar {
    width: 20px;
    height: 20px;
  }
} */

/* ===== БУРГЕР-МЕНЮ (мобильное меню) ===== */
@media (max-width: 768px) {
  .mobile-menu {
    display: block;
  }

  .mobile-menu-btn {
    display: block !important;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 1001;
  }

  /* Мобильное меню */
  .mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 80%;
    background: var(--color-bg-secondary);
    z-index: 10000;
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }

  .mobile-menu.active {
    transform: translateX(0);
  }

  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }

  .mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-menu__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border-light);
  }

  .mobile-menu__title {
    color: var(--color-text-white);
    font-size: 1.2rem;
  }

  .mobile-menu__close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.8rem;
    cursor: pointer;
  }

  .mobile-menu__list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
  }

  .mobile-menu__link {
    display: flex;
    align-items: center;
    gap: 12px;
    /* padding: 10px; */
    color: var(--color-text-white);
    text-decoration: none;
    font-size: 1rem;
    border-radius: 8px;
    transition: background 0.2s ease;
  }

  .mobile-menu__link:hover {
    background: rgba(102, 126, 234, 0.1);
  }

  .mobile-menu__link i {
    width: 24px;
    color: var(--color-primary-start);
  }

  .mobile-menu__auth {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border-light);
  }

  .mobile-menu__btn {
    width: 100%;
    padding: 10px;
    text-align: center;
  }
}