/* ============================================
   TinyMCE content mobile overrides
   (inline styles from WYSIWYG editor)
   ============================================ */

@media (max-width: 768px) {
    /* Force inline flex layouts from TinyMCE to stack vertically */
    .animatrice-content .container > div[style*="display: flex"],
    .animatrice-content .container > div[style*="display:flex"],
    .services-content .container > div[style*="display: flex"],
    .services-content .container > div[style*="display:flex"],
    .animatrice-content div[style*="display: flex"],
    .services-content div[style*="display: flex"] {
        flex-direction: column !important;
    }

    /* Remove fixed flex-basis so items take full width */
    .animatrice-content [style*="flex: 0 0"],
    .services-content [style*="flex: 0 0"] {
        flex: none !important;
        max-width: 100% !important;
    }

    /* Constrain and center images within stacked layouts */
    .animatrice-content [style*="flex: 0 0"] img,
    .services-content [style*="flex: 0 0"] img {
        max-width: 300px !important;
        display: block;
        margin: 0 auto;
    }

    /* Handle floated images in TinyMCE content */
    .animatrice-content img[style*="float"],
    .services-content img[style*="float"] {
        float: none !important;
        display: block !important;
        margin: 15px auto !important;
        max-width: 100% !important;
    }
}

/* ============================================
   Tablet (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Grid - half width on tablet */
    .col-3, .col-4 {
        max-width: 50%;
        flex: 0 0 50%;
    }

    /* Navigation */
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--color-menu-bg);
        box-shadow: var(--shadow-md);
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu a {
        padding: 12px 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu a.active::after {
        display: none;
    }

    .main-nav .container {
        flex-wrap: wrap;
    }

    /* Slider */
    .hero-slider .slide img {
        height: 300px;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    /* Carousel */
    .carousel-item {
        flex: 0 0 50%;
    }

    /* Portfolio single */
    .portfolio-single-page .species-header {
        flex-direction: column;
    }

    .portfolio-single-page .species-image {
        flex: none;
        max-width: 350px;
    }

    /* Animatrice */
    .animatrice-content .profile-section {
        flex-direction: column;
    }

    .animatrice-content .profile-image {
        flex: none;
        max-width: 300px;
    }

    /* Home sections */
    .home-portfolio .section-header {
        flex-direction: column;
    }

    .home-portfolio .section-header .info {
        flex: none;
    }

    /* Footer */
    .footer-main .row {
        gap: 25px;
    }

    .footer-main .col-3 {
        max-width: 50%;
        flex: 0 0 50%;
    }

    /* Form rows */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Livre */
    .toc-overview-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .livre-orders-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .toc-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .family-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .related-families ul {
        columns: 1;
    }

    .livre-toc .toc-intro-links ul {
        columns: 1;
    }
}

/* ============================================
   Mobile (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    /* Grid - full width on mobile */
    .col-3, .col-4, .col-6 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Typography */
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    /* Logo */
    .logo img {
        max-height: 60px;
    }

    /* Slider */
    .hero-slider .slide img {
        height: 200px;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: 1fr;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Carousel */
    .carousel-item {
        flex: 0 0 100%;
    }

    /* Footer */
    .footer-main .col-3 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Section spacing */
    .content-section {
        padding: 25px 0;
    }

    /* Cards */
    .card-body {
        padding: 15px;
    }

    /* Back to top */
    .back-to-top {
        bottom: 15px;
        right: 15px;
    }

    /* Livre mobile */
    .toc-overview-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .toc-overview-item img {
        width: 45px;
        height: 45px;
    }

    .toc-overview-item span {
        font-size: 9px;
    }

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

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

    .specimen-gallery {
        grid-template-columns: 1fr;
    }

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

    .chapter-nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .livre-main .row {
        flex-direction: column;
    }

    .livre-main .col-4,
    .livre-main .col-8 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    .livre-cover {
        max-width: 250px;
        margin: 0 auto 20px;
    }
}
