/* ==========================================================
   Responsive overrides for arthistorynews.com
   Applied AFTER master.css.
   All rules live inside @media (max-width: 768px) so desktop
   rendering is byte-identical above the breakpoint.
   Breakpoint 768px = iPad portrait and below.
============================================================ */

/* Mobile-only search form sits inside the header. Hidden by default
   (on desktop) so the sidebar search remains the primary search box. */
#mobileSearch { display: none; }

@media (max-width: 768px) {

    /* ---------- body: drop the 962px-tiled canvas, match wrapper bg so no
       stray cream strip shows between header and content --------- */
    body {
        background: #fff;
        text-align: left;
    }

    /* ---------- fluid container chain ---------- */
    #container {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0 auto;
        background-image: none;
    }

    #wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        font-size: 16px;
        line-height: 26px;
        box-sizing: border-box;
    }

    #content {
        width: 100%;
        max-width: 100%;
    }

    /* ---------- header: stack, drop header sprite, flush with content ---------- */
    #header {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0;
        padding: 6px 0 8px;
        background: #000;
        position: static;
    }

    /* #edited (image-replaced "edited by Bendor Grosvenor") hides on mobile */
    #edited { display: none; }

    /* #rss block: position the icons inline under the banner instead of the
       right-hand absolute offset that the desktop layout uses */
    #rss {
        float: none;
        width: auto;
        margin: 0 auto;
        padding: 6px 0;
        text-align: center;
    }
    #rss img { height: 22px; vertical-align: middle; margin: 0 6px; }

    /* ---------- banner image: scale, drop absolute positioning ---------- */
    #banner {
        position: static;
        width: 100%;
        max-width: 320px;
        height: auto;
        margin: 0 auto;
        padding: 6px 0;
        top: auto;
        left: auto;
    }
    #banner img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
    #banner p { text-align: center; }

    /* ---------- navigation: drop sprite, show the text spans ---------- */
    ul#navigation {
        float: none;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 6px 0;
        color: #e8dac1;
        text-align: center;
    }
    ul#navigation li,
    ul#navigation li.about,
    ul#navigation li.articles,
    ul#navigation li.contact {
        float: none;
        display: inline-block;
        width: auto !important;
        height: auto;
        margin: 0 10px !important;
    }
    ul#navigation li a,
    ul#navigation li.about a,
    ul#navigation li.articles a,
    ul#navigation li.contact a {
        background-image: none !important;
        background-position: 0 0 !important;
        display: inline-block;
        width: auto;
        height: auto;
        padding: 6px 10px;
        color: #e8dac1;
        font-family: Georgia, "Times New Roman", Times, serif;
        font-size: 17px;
        text-transform: lowercase;
    }
    ul#navigation li a:hover,
    ul#navigation li.about a:hover,
    ul#navigation li.articles a:hover,
    ul#navigation li.contact a:hover {
        color: #fff;
        text-decoration: underline;
    }
    /* The master stylesheet pushes all nav <span> text 5000px off-screen for
       sprite-replacement. Bring them back on mobile. */
    ul#navigation span {
        position: static;
        left: auto;
    }

    /* ---------- mobile search: editorial baseline input ---------- */
    #mobileSearch {
        display: block;
        margin: 0;
        padding: 10px 14px 14px;
        box-sizing: border-box;
        border-bottom: 1px solid #e4d8bd;
    }
    #mobileSearch form {
        display: flex;
        align-items: baseline;
        gap: 12px;
    }
    #mobileSearch input[type="text"] {
        flex: 1 1 auto;
        min-width: 0;
        height: auto;
        padding: 4px 2px 6px;
        font-size: 17px; /* >=16px stops iOS zoom-on-focus */
        font-family: Georgia, "Times New Roman", Times, serif;
        font-style: italic;
        color: #1c1a1a;
        background: transparent;
        border: 0;
        border-bottom: 1px solid #1c1a1a;
        border-radius: 0;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
    }
    #mobileSearch input[type="text"]:focus { border-bottom-color: #5d0505; }
    #mobileSearch input[type="text"]::placeholder {
        color: #9a8f78;
        font-style: italic;
        opacity: 1;
    }
    #mobileSearch input[type="submit"] {
        flex: 0 0 auto;
        padding: 4px 0 6px;
        font-size: 13px;
        font-family: Georgia, "Times New Roman", Times, serif;
        font-variant: small-caps;
        letter-spacing: 0.12em;
        color: #5d0505;
        background: transparent;
        border: 0;
        border-radius: 0;
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
    }
    #mobileSearch input[type="submit"]:hover { color: #1c1a1a; }

    /* Hide the sidebar search on mobile — the inline search replaces it. */
    #sidebar #searchdiv { display: none; }

    /* ---------- entries column becomes full width ---------- */
    #entries {
        float: none;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        background-image: none;
    }
    .wrp {
        float: none;
        width: 100%;
        max-width: 100%;
        margin-bottom: 12px;
    }
    .article {
        float: none;
        width: auto;
        max-width: 100%;
        padding: 14px 14px 0;
        margin-bottom: 16px;
        box-sizing: border-box;
    }
    .article img {
        max-width: 100%;
        height: auto;
        margin: 6px 0 12px;
    }
    .article img.float {
        float: none;
        clear: both;
        margin: 6px 0;
    }

    /* Callouts inside articles */
    span.contributor {
        display: block;
        width: auto;
        max-width: 100%;
        box-sizing: border-box;
    }
    .pullquote {
        float: none;
        width: auto;
        margin: 14px 0;
        padding-left: 12px;
    }

    /* Body paragraphs */
    p {
        font-size: 16px;
        line-height: 26px;
        margin-bottom: 18px;
    }

    /* Entry footer: stack the share/category rows */
    ul.entryfooter {
        background: none;
        padding: 6px 0 12px;
    }
    ul.entryfooter li {
        display: inline-block;
        margin: 2px 10px 4px 0;
    }
    ul.entryfooter ul,
    ul.entryfooter ul.categories {
        width: auto;
        background: none;
        padding: 4px 0 0;
    }

    /* ---------- sidebar below entries ---------- */
    #sidebar {
        float: none;
        width: 100%;
        max-width: 100%;
        padding: 16px 14px;
        border-top: 1px solid #c9b89a;
        margin-top: 16px;
        box-sizing: border-box;
    }
    #sidebar img { max-width: 100%; height: auto; display: block; margin: 0 auto 16px; }
    #sidebar ul,
    #sidebar ul ul { width: 100%; }
    #sidebar ul li { width: auto; }
    #sidebar ul.acitem li { width: auto; }
    #sidebar ul li a,
    #sidebar ul.acitem li a {
        width: auto;
        font-size: 15px;
        padding: 4px 6px;
    }
    #sidebar h2 { width: auto; font-size: 18px; padding-left: 6px; }

    /* Search box lives inside #sidebar on the public site */
    #searchdiv {
        float: none;
        width: auto;
        max-width: 100%;
        margin: 0 0 16px;
        padding: 0;
    }
    input#query {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: 32px;
        font-size: 16px; /* prevents iOS zoom-on-focus */
    }
    input#searchbutton {
        position: static;
        top: auto;
        left: auto;
        margin-top: 4px;
    }

    /* ---------- headings ---------- */
    h1 { font-size: 22px; width: auto; margin: 14px 14px 0; }
    h2 { font-size: 22px; width: auto; }
    #sidebar h2 { width: auto; }

    /* ---------- pagination ---------- */
    .pagenumbers {
        margin-left: 14px;
        margin-right: 14px;
    }
    .pagenumbers ul {
        float: none;
        padding-top: 16px;
        padding-left: 0;
    }
    .pagenumbers ul li {
        float: none;
        display: inline-block;
        margin: 0 4px 6px 0;
    }

    /* ---------- footer ---------- */
    #footer, .push { height: auto; }
    #container { margin-bottom: 0; }
    #inner_footer {
        width: 100%;
        padding: 16px 14px;
        box-sizing: border-box;
        height: auto;
    }
}
