/*
 * Responsive laag voor Trommeltoko.
 * Desktop (>= 960px) blijft exact zoals style.css het tekent: alles hieronder
 * staat in een media query, behalve het verbergen van de mobiele knop/overlay.
 */

/* Telefoonnummer in het menu is een tel:-link, maar ziet er op desktop uit als de oude tekst */
#nav li.contact a.tel-link,
#hoofd_menu li.contact a.tel-link {
    display: inline;
    width: auto;
    padding: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
}

/* Elementen die alleen op mobiel bestaan */
.menu-toggle,
.menu-overlay { display: none; }

@media (max-width: 959px) {

    /* ---------- Basis ---------- */
    html { -webkit-text-size-adjust: 100%; }
    body { overflow-x: hidden; }
    *, *::before, *::after { box-sizing: border-box; }

    #container,
    #header,
    #content,
    #right,
    #right_content,
    #right_content_left,
    #right_content_right {
        float: none;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
    }

    #container { padding: 0 0 24px; }

    img, iframe, video, embed, object, table { max-width: 100%; }
    img { height: auto; }

    /* ---------- Kopbalk (altijd bereikbaar) ---------- */
    #header {
        position: sticky;
        top: 0;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 8px 0 16px;
        background: rgba(20, 22, 24, 0.92);
    }
    #header .logo-link {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        margin-right: 12px;
    }
    #header img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        padding: 0;
        border: 0;
        border-radius: 4px;
        background: #c00000;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .menu-toggle span,
    .menu-toggle span::before,
    .menu-toggle span::after {
        display: block;
        width: 24px;
        height: 3px;
        background: #fff;
        border-radius: 2px;
        transition: transform .2s ease, opacity .2s ease;
        content: "";
    }
    .menu-toggle span { position: relative; }
    .menu-toggle span::before { position: absolute; top: -8px; left: 0; }
    .menu-toggle span::after  { position: absolute; top:  8px; left: 0; }
    /* Kruisje als het menu open is */
    .menu-open .menu-toggle span { background: transparent; }
    .menu-open .menu-toggle span::before { transform: translateY(8px) rotate(45deg); }
    .menu-open .menu-toggle span::after  { transform: translateY(-8px) rotate(-45deg); }
    .menu-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

    /* ---------- Uitklapmenu ---------- */
    #menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        z-index: 999;
        float: none;
        width: 100%;
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        padding: 8px 16px 16px;
        background: rgba(20, 22, 24, 0.97);
        box-shadow: 0 8px 16px rgba(0, 0, 0, .4);
    }
    .menu-open #menu { display: block; }

    .menu-overlay {
        position: fixed;
        inset: 60px 0 0 0;
        z-index: 998;
        background: rgba(0, 0, 0, .5);
    }
    .menu-open .menu-overlay { display: block; }

    #nav ul,
    #hoofd_menu {
        float: none;
        margin: 0;
        padding: 0;
    }
    #nav ul li {
        margin: 0 0 6px;
        text-align: left;
    }
    #nav a,
    #hoofd_menu li a {
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 10px 14px;
        font-size: 17px;
        text-align: left;
    }
    #nav ul li.contact,
    #hoofd_menu li.contact { width: 100%; margin-right: 0; padding: 0; background: none; }
    #nav li.contact a.tel-link,
    #hoofd_menu li.contact a.tel-link {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 48px;
        padding: 10px 14px;
        font-size: 17px;
        font-weight: bold;
        font-style: italic;
        color: #fff;
        background: #c00000;
    }
    #nav li.contact a.tel-link::before,
    #hoofd_menu li.contact a.tel-link::before {
        content: "\260E"; /* telefoonsymbool */
        margin-right: 10px;
        font-style: normal;
    }
    /* Submenu's: op touch geen hover, dus altijd tonen, ingesprongen */
    #nav ul ul,
    #nav ul li:hover > ul {
        display: block;
        position: static;
        padding-left: 16px;
        margin-top: 6px;
    }
    #menu a.social {
        float: none;
        display: inline-block;
        margin: 8px 0 0;
        padding: 4px 0;
        font-size: 40px;
    }

    /* ---------- Inhoud ---------- */
    #content { padding: 12px 16px 0; }

    #right_content {
        padding: 16px;
        font-size: 15px;
        line-height: 1.5;
        overflow-wrap: anywhere; /* lange URL's niet buiten beeld */
    }
    #right_content h1 { font-size: 22px; line-height: 1.25; }

    #right_content_right { margin-top: 24px; }
    #nieuws_list { float: none; width: 100%; }
    #nieuws_list li a { padding: 10px; font-size: 15px; }

    /* Home: grote foto en fotobalk onder elkaar */
    #right > img,
    #right img[width="735"] { width: 100%; }
    #fader1,
    #fader2 {
        float: none;
        width: 100%;
        margin: 12px 0 0;
    }
    #fader1 img,
    #fader2 img {
        width: 100%;
        aspect-ratio: 360 / 195; /* zelfde verhouding als op desktop */
        object-fit: cover;
    }

    /* Agenda */
    #agenda_list { float: none; width: 100%; }
    #agenda_list li a { display: block; padding: 6px 0; line-height: 1.4; }

    /* Fotoboek: tegels die de breedte vullen */
    ul.gallerys { display: flex; flex-wrap: wrap; gap: 8px; }
    ul.gallerys li { float: none; width: calc(50% - 4px); }
    ul.gallerys li a,
    ul.gallerys li a.photo { width: 100%; height: auto; }
    ul.gallerys li img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
    ul.gallerys h1 { width: 100%; }

    /* Contact: formulier en kaart volle breedte */
    .text_input,
    .text_area {
        height: 44px;
        padding: 8px;
        font-size: 16px; /* voorkomt automatisch inzoomen op iOS */
    }
    .text_area { height: 160px; }
    .submit { padding: 12px 18px; font-size: 16px; }
    #map_canvas { float: none; width: 100%; height: 300px; }
    #gegevens { float: none; margin: 16px 0 0; }

    /* Paginering: grotere tikdoelen */
    .pagination-centered ul { padding: 0; }
    .pagination-centered ul li a { display: inline-block; padding: 8px 10px; }

    a.back { width: auto; }

    /* ---------- Fotolightbox (Colorbox) ---------- */
    /* Sluitknop: groot, altijd rechtsboven in beeld */
    #cboxClose,
    #cboxClose:hover {
        position: fixed;
        top: 12px;
        right: 12px;
        bottom: auto;
        z-index: 10000;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: rgba(0, 0, 0, .75);
        text-indent: 0;
        font-size: 0;
        color: #fff;
    }
    #cboxClose::before {
        content: "\2715";
        font-size: 24px;
        line-height: 48px;
    }
    #cboxClose:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
}

/* Tablet: fotobalk op de homepage naast elkaar */
@media (min-width: 600px) and (max-width: 959px) {
    #fader1,
    #fader2 { float: left; width: calc(50% - 6px); }
    #fader2 { margin-left: 12px; }
    #right::after { content: ""; display: table; clear: both; }
}

@media (max-width: 340px) {
    ul.gallerys li { width: 100%; }
}
