/* =========================================================
   COEURS BLOG — RESPONSIVE
   static/css/responsive.css
   ========================================================= */


/* =========================================================
   1. TABLETTES — 1024px
   ========================================================= */

@media (max-width: 1024px) {

    .container,
    .page-container,
    .main-container {
        width: min(94%, 1200px);
    }

    /* Navigation */

    .desktop-nav {
        gap: 12px;
    }

    .desktop-nav a {
        font-size: 0.9rem;
    }

    /* Grilles */

    .posts-grid,
    .articles-grid,
    .events-grid,
    .challenges-grid,
    .questions-grid,
    .discussions-grid,
    .photos-grid,
    .badges-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Layout principal */

    .content-layout,
    .page-layout,
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
    }

    /* Hero */

    .hero-section,
    .page-hero {
        padding: 60px 30px;
    }

    .hero-title,
    .page-hero h1 {
        font-size: clamp(2rem, 5vw, 3.2rem);
    }

    /* Stats */

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

    /* Profil */

    .profile-header {
        padding: 30px;
    }
}


/* =========================================================
   2. MOBILE — 768px
   ========================================================= */

@media (max-width: 768px) {

    html {
        font-size: 15px;
    }

    body {
        overflow-x: hidden;
    }

    /* -----------------------------------------------------
       CONTAINERS
       ----------------------------------------------------- */

    .container,
    .page-container,
    .main-container {
        width: calc(100% - 28px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }


    /* -----------------------------------------------------
       HEADER
       ----------------------------------------------------- */

    .site-header,
    .main-header,
    header {
        width: 100%;
    }

    .header-inner,
    .navbar,
    .nav-container {
        min-height: 64px;
    }

    .desktop-nav,
    .desktop-navigation,
    .header-nav {
        display: none !important;
    }

    .mobile-menu-button,
    .menu-toggle,
    .hamburger {
        display: flex;
    }

    .logo {
        max-width: 190px;
        font-size: 1.2rem;
    }


    /* -----------------------------------------------------
       MENU MOBILE
       ----------------------------------------------------- */

    .mobile-menu {
        width: min(88vw, 360px);
        max-width: 100%;
    }

    .mobile-menu a {
        padding: 13px 15px;
    }


    /* -----------------------------------------------------
       HERO
       ----------------------------------------------------- */

    .hero-section,
    .page-hero {
        padding: 45px 20px;
        border-radius: 18px;
    }

    .hero-title,
    .page-hero h1 {
        font-size: clamp(1.8rem, 8vw, 2.7rem);
        line-height: 1.1;
    }

    .hero-subtitle,
    .page-hero p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn,
    .hero-actions button {
        width: 100%;
    }


    /* -----------------------------------------------------
       GRILLES
       ----------------------------------------------------- */

    .posts-grid,
    .articles-grid,
    .events-grid,
    .challenges-grid,
    .questions-grid,
    .discussions-grid,
    .photos-grid,
    .badges-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }


    /* -----------------------------------------------------
       LAYOUTS
       ----------------------------------------------------- */

    .content-layout,
    .page-layout,
    .main-layout,
    .article-layout,
    .discussion-layout,
    .question-layout,
    .event-layout {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    .main-content {
        width: 100%;
        min-width: 0;
    }


    /* -----------------------------------------------------
       STATS
       ----------------------------------------------------- */

    .stats-grid,
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 18px 12px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }


    /* -----------------------------------------------------
       CARTES
       ----------------------------------------------------- */

    .post-card,
    .article-card,
    .event-card,
    .challenge-card,
    .question-card,
    .discussion-card,
    .photo-card,
    .badge-card {
        width: 100%;
        min-width: 0;
    }


    /* -----------------------------------------------------
       ARTICLES
       ----------------------------------------------------- */

    .article-card-image,
    .article-image {
        height: 200px;
    }

    .article-card-content {
        padding: 18px;
    }


    /* -----------------------------------------------------
       QUESTIONS
       ----------------------------------------------------- */

    .question-card {
        padding: 18px;
    }

    .question-title {
        font-size: 1.15rem;
    }

    .question-actions {
        flex-wrap: wrap;
        gap: 8px;
    }


    /* -----------------------------------------------------
       DISCUSSIONS
       ----------------------------------------------------- */

    .discussion-card {
        padding: 18px;
    }

    .discussion-title {
        font-size: 1.15rem;
    }


    /* -----------------------------------------------------
       ARTICLES / QUESTIONS / DISCUSSIONS HERO
       ----------------------------------------------------- */

    .page-header,
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-header-actions,
    .section-actions {
        width: 100%;
    }

    .page-header-actions .btn,
    .section-actions .btn {
        width: 100%;
    }


    /* -----------------------------------------------------
       RECHERCHE / FILTRES
       ----------------------------------------------------- */

    .search-bar,
    .search-container {
        width: 100%;
    }

    .filter-buttons,
    .filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
        scrollbar-width: none;
    }

    .filter-buttons::-webkit-scrollbar,
    .filters::-webkit-scrollbar {
        display: none;
    }

    .filter-button,
    .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }


    /* -----------------------------------------------------
       FORMULAIRES
       ----------------------------------------------------- */

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

    .form-group {
        width: 100%;
    }

    input,
    textarea,
    select {
        max-width: 100%;
        font-size: 16px;
    }

    textarea {
        min-height: 150px;
    }

    .form-actions {
        flex-direction: column;
        width: 100%;
    }

    .form-actions button,
    .form-actions .btn {
        width: 100%;
    }


    /* -----------------------------------------------------
       PROFIL
       ----------------------------------------------------- */

    .profile-header {
        padding: 24px 18px;
    }

    .profile-header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-avatar {
        width: 90px;
        height: 90px;
    }

    .profile-info {
        width: 100%;
    }

    .profile-actions {
        width: 100%;
    }

    .profile-actions .btn {
        width: 100%;
    }

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


    /* -----------------------------------------------------
       ÉVÉNEMENTS
       ----------------------------------------------------- */

    .event-card-image {
        height: 190px;
    }

    .event-page-header {
        padding: 25px 18px;
    }

    .event-actions {
        flex-direction: column;
    }

    .event-actions button,
    .event-actions .btn {
        width: 100%;
    }


    /* -----------------------------------------------------
       PHOTOS
       ----------------------------------------------------- */

    .photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .photo-card-image {
        aspect-ratio: 1 / 1;
    }


    /* -----------------------------------------------------
       BADGES
       ----------------------------------------------------- */

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .badge-card {
        padding: 15px;
    }


    /* -----------------------------------------------------
       CLASSEMENT
       ----------------------------------------------------- */

    .leaderboard-podium {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
    }

    .ranking-item {
        padding: 14px;
    }

    .ranking-user {
        min-width: 0;
    }

    .ranking-username {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }


    /* -----------------------------------------------------
       NOTIFICATIONS
       ----------------------------------------------------- */

    .notification-card {
        padding: 15px;
    }

    .notification-content {
        min-width: 0;
    }


    /* -----------------------------------------------------
       MODALES
       ----------------------------------------------------- */

    .modal {
        width: calc(100% - 28px);
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }


    /* -----------------------------------------------------
       FOOTER
       ----------------------------------------------------- */

    .footer-grid,
    .footer-columns {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}


/* =========================================================
   3. PETITS TÉLÉPHONES — 480px
   ========================================================= */

@media (max-width: 480px) {

    html {
        font-size: 14px;
    }

    .container,
    .page-container,
    .main-container {
        width: calc(100% - 20px);
    }


    /* -----------------------------------------------------
       HEADER
       ----------------------------------------------------- */

    .header-inner,
    .navbar,
    .nav-container {
        min-height: 58px;
    }

    .logo {
        font-size: 1.05rem;
        max-width: 150px;
    }


    /* -----------------------------------------------------
       HERO
       ----------------------------------------------------- */

    .hero-section,
    .page-hero {
        padding: 35px 15px;
        border-radius: 14px;
    }

    .hero-title,
    .page-hero h1 {
        font-size: 1.85rem;
    }


    /* -----------------------------------------------------
       STATS
       ----------------------------------------------------- */

    .stats-grid,
    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 14px 8px;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }


    /* -----------------------------------------------------
       CARTES
       ----------------------------------------------------- */

    .post-card,
    .article-card,
    .event-card,
    .challenge-card,
    .question-card,
    .discussion-card {
        border-radius: 14px;
    }


    /* -----------------------------------------------------
       PHOTOS
       ----------------------------------------------------- */

    .photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }


    /* -----------------------------------------------------
       BADGES
       ----------------------------------------------------- */

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


    /* -----------------------------------------------------
       CLASSEMENT
       ----------------------------------------------------- */

    .leaderboard-podium {
        grid-template-columns: 1fr;
        gap: 10px;
    }


    /* -----------------------------------------------------
       FOOTER
       ----------------------------------------------------- */

    .footer-grid,
    .footer-columns {
        grid-template-columns: 1fr;
        text-align: center;
    }


    /* -----------------------------------------------------
       BOUTONS
       ----------------------------------------------------- */

    .btn,
    button {
        min-height: 44px;
    }
}


/* =========================================================
   4. TRÈS PETITS ÉCRANS — 360px
   ========================================================= */

@media (max-width: 360px) {

    .container,
    .page-container,
    .main-container {
        width: calc(100% - 14px);
    }

    .hero-title,
    .page-hero h1 {
        font-size: 1.6rem;
    }

    .stats-grid,
    .stats-container {
        gap: 6px;
    }

    .stat-card {
        padding: 12px 6px;
    }

    .stat-number {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .photos-grid {
        gap: 4px;
    }
}


/* =========================================================
   5. MODE PAYSAGE MOBILE
   ========================================================= */

@media (max-width: 768px) and (orientation: landscape) {

    .hero-section,
    .page-hero {
        padding: 30px 20px;
    }

    .mobile-menu {
        max-height: 85vh;
        overflow-y: auto;
    }
}


/* =========================================================
   6. ÉCRANS TACTILES
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    .post-card:hover,
    .article-card:hover,
    .event-card:hover,
    .challenge-card:hover,
    .question-card:hover,
    .discussion-card:hover,
    .photo-card:hover,
    .badge-card:hover {
        transform: none;
    }

    button:hover,
    .btn:hover,
    .nav-button:hover {
        transform: none;
    }

    a,
    button,
    .btn {
        -webkit-tap-highlight-color: transparent;
    }
}


/* =========================================================
   7. ACCESSIBILITÉ
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}