/* SOAG Responsive 1.1 -- phone & tablet layout rules.
 * Phone   = up to 767px wide (Divi's phone breakpoint)
 * Tablet  = 768px to 980px  (Divi's tablet breakpoint)
 * Scoped to page content (#main-content) and the footer; the header is left as designed.
 */

/* Phone header extras (search + social/map icons) -- added by soag-responsive.js, phones only. */
.soag-phone-extras { display: none; }

/* ---------- PHONE ---------- */
@media (max-width: 767px) {

    /* One consistent text margin: every row spans the screen with 20px each side,
       so text never touches the edge (rows set to 100% wide in Divi included). */
    html body #main-content .et_pb_section .et_pb_row,
    html body .et-l--footer .et_pb_section .et_pb_row {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }
    html body #main-content .et_pb_row_inner {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Everything in a single column. */
    html body #main-content .et_pb_column,
    html body .et-l--footer .et_pb_column {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        float: none !important;
    }
    html body #main-content .et_pb_row > .et_pb_column:not(:last-child),
    html body #main-content .et_pb_row_inner > .et_pb_column:not(:last-child),
    html body .et-l--footer .et_pb_row > .et_pb_column:not(:last-child) {
        margin-bottom: 32px !important;
    }

    /* Grids of posts / products / galleries: one per row. */
    html body #main-content ul.products li.product {
        width: 100% !important;
        margin-right: 0 !important;
        float: none !important;
    }

    /* Long words and links (emails, URLs, artwork titles) wrap instead of running off screen. */
    #main-content p, #main-content li, #main-content h1, #main-content h2,
    #main-content h3, #main-content h4, #main-content td, #main-content a {
        overflow-wrap: break-word;
    }

    /* Big headings scaled down so a show title fits in two or three lines. */
    #main-content .et_pb_text h1, #main-content .et_pb_slide_title, #main-content .entry-title { font-size: clamp(26px, 8vw, 34px) !important; line-height: 1.2 !important; }
    #main-content .et_pb_text h2 { font-size: clamp(22px, 7vw, 30px) !important; line-height: 1.25 !important; }

    /* Form fields at 16px so phones don't zoom in when tapped. */
    #main-content input[type="text"], #main-content input[type="email"], #main-content input[type="number"],
    #main-content input[type="search"], #main-content input[type="tel"], #main-content input[type="password"],
    #main-content select, #main-content textarea,
    .et-l--footer input[type="text"], .et-l--footer input[type="email"] {
        font-size: 16px !important;
    }

    /* Search box and Facebook / Instagram / map icons under the menu button. */
    .et-l--header .soag-phone-extras {
        display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px;
        padding: 14px 20px 16px; box-sizing: border-box; width: 100%;
    }
    .et-l--header .soag-phone-extras .et_pb_social_media_follow { order: 1; flex: 0 0 auto; margin: 0 !important; padding: 0 !important; display: flex; gap: 6px; }
    .et-l--header .soag-phone-extras .et_pb_social_media_follow li { margin: 0 !important; }
    .et-l--header .soag-phone-extras .et_pb_search { order: 2; flex: 1 1 100% !important; max-width: none !important; width: auto !important; margin: 0 !important; }
    .et-l--header .soag-phone-extras .et_pb_search form,
    .et-l--header .soag-phone-extras .et_pb_search .et_pb_searchform > div { width: 100% !important; max-width: none !important; }
    .et-l--header .soag-phone-extras .et_pb_search input.et_pb_s { font-size: 16px !important; }

    /* Mobile menu: bigger, easier-to-tap items. */
    .et_mobile_menu li a {
        font-size: 16px !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    /* Buttons: comfortable tap size, never wider than the screen. */
    #main-content .et_pb_button, #main-content .button, #main-content button {
        max-width: 100%;
        white-space: normal;
    }

    /* Post sliders (home page "Look Club / First Fridays") become a single-column list -- see soag-responsive.js. */
    html body #main-content .ds_blog_slider .swiper-container { padding-left: 0 !important; padding-right: 0 !important; }
    html body #main-content .ds_blog_slider.soag-stacked .ds-blog-slider-wrapper,
    html body #main-content .ds_blog_slider.soag-stacked .swiper-wrapper { display: block !important; transform: none !important; height: auto !important; }
    html body #main-content .ds_blog_slider.soag-stacked .ds-blog-post { width: 100% !important; margin: 0 0 40px !important; height: auto !important; }
    html body #main-content .ds_blog_slider.soag-stacked .ds-blog-post:last-child { margin-bottom: 0 !important; }
    html body #main-content .ds_blog_slider.soag-stacked [class*="swiper-button"],
    html body #main-content .ds_blog_slider.soag-stacked [class*="swiper-pagination"] { display: none !important; }

    /* Exhibits page: the collapsed category filter had no words on it. */
    .el-dbe-mobile-active-category:empty::before { content: "Filter: Current / Past exhibits"; }

    /* Artist Dashboard: the artwork table scrolls sideways inside its box instead of breaking the page. */
    .soag-ad-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .soag-ad-table img { width: 72px !important; height: 72px !important; }
    .soag-ad-table th, .soag-ad-table td { padding: 8px !important; white-space: nowrap; }
    .soag-ad-table td:nth-child(3) { white-space: normal; min-width: 140px; }
    #acf-form input[type=text], #acf-form input[type=number], #acf-form textarea, #acf-form select,
    .soag-ad-field input, #soag_description, #soag_price, #soag-ad-search { font-size: 16px !important; max-width: 100% !important; }

    /* Home page: tighten the gap between the header and the Current Exhibit slider. */
    body.home #main-content .et_pb_section_0 { padding-top: 0 !important; }
    body.home #main-content .et_pb_row_0 { padding-top: 12px !important; }
}

/* ---------- TABLET ---------- */
@media (min-width: 768px) and (max-width: 980px) {

    /* Same text margin idea, a little wider. */
    html body #main-content .et_pb_section .et_pb_row,
    html body .et-l--footer .et_pb_section .et_pb_row {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 40px !important;
        padding-right: 40px !important;
        box-sizing: border-box !important;
    }
    html body #main-content .et_pb_row_inner {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Headings in half-width columns kept to a sensible size. */
    #main-content .et_pb_text h1, #main-content .et_pb_slide_title { font-size: clamp(28px, 3.6vw, 34px) !important; line-height: 1.2 !important; }

    #main-content input[type="text"], #main-content input[type="email"], #main-content select, #main-content textarea { font-size: 16px !important; }

    .soag-ad-table { display: block; overflow-x: auto; }
}
