/* Mobile-specific improvements for navigation menu */

/* Improve mobile menu items spacing and alignment */
@media (max-width: 991.98px) {
    /* Make navbar collapse full width with square corners, and scrollable so
       that inline dropdowns (position: static) don't push items off-screen */
    #mainNav .navbar-collapse {
        background-color: rgba(var(--bs-dark-rgb), 100%);
        padding: 0;
        margin: 0;
        border-radius: 0;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        max-height: calc(100vh - 76px); /* 76px = fixed navbar height */
        overflow-y: auto;
    }
    
    /* Improve nav item spacing on mobile */
    #mainNav .navbar-nav li.nav-item {
        margin: 0;
    }
    
    /* Better link styling for mobile - square corners */
    #mainNav .navbar-nav li.nav-item a.nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 0;
        display: block;
        transition: background-color 0.2s ease;
    }
    
    /* Hover effect for mobile nav links */
    #mainNav .navbar-nav li.nav-item a.nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Active state for mobile */
    #mainNav .navbar-nav li.nav-item a.nav-link.active {
        background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity));
    }
    
    /* Dropdown menu improvements for mobile - square corners, no extra margin */
    #mainNav .dropdown-menu {
        background-color: transparent;
        border: none;
        margin: 0;
        padding: 0;
        border-radius: 0;
    }
    
    /* Dropdown items styling - same as regular nav items */
    #mainNav .dropdown-menu .dropdown-item {
        color: #fff;
        padding: 0.75rem 1rem !important;
        transition: background-color 0.2s ease;
        border-radius: 0;
    }
    
    /* Dropdown item hover - same style as nav links */
    #mainNav .dropdown-menu .dropdown-item:hover,
    #mainNav .dropdown-menu .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    
    /* Dropdown toggle styling on mobile */
    #mainNav .dropdown .nav-link.dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Adjust dropdown arrow */
    #mainNav .dropdown-toggle::after {
        margin-left: auto;
    }
    
    /* Ensure dropdowns are visible in collapsed menu with no indentation */
    #mainNav .navbar-nav .dropdown-menu {
        position: static !important;
        transform: none !important;
        float: none;
        width: 100%;
        margin-left: 0;
        background-color: var(--bs-gray-700);
    }
    
    /* Staff edit icons - better spacing on mobile */
    #mainNav .navbar-nav li.nav-item a i.fas {
        font-size: 1.2rem;
    }
    
    /* Navbar toggler improvements */
    #mainNav .navbar-toggler {
        border: 2px solid rgba(var(--bs-primary-rgb), var(--bs-bg-opacity));
        padding: 0.5rem 0.75rem;
    }
    
    #mainNav .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    }
}

/* Small mobile devices (phones in portrait) */
@media (max-width: 575.98px) {
    /* Slightly smaller font for very small screens */
    #mainNav .navbar-nav li.nav-item a.nav-link {
        font-size: 0.95rem;
    }
    
    /* Adjust dropdown items - same padding as nav items */
    #mainNav .dropdown-menu .dropdown-item {
        font-size: 0.95rem;
    }
}

/* ── Page layout ────────────────────────────────────────────────────────────── */

/* Reduce generous page-section padding on mobile */
@media (max-width: 767.98px) {
    .page-section {
        padding: 3rem 0;
    }
}

/* ── Masthead / header carousel ──────────────────────────────────────────────── */

/* Ensure carousel caption text is legible on small screens: add a subtle
   text-shadow and shrink the bottom gap so the image isn't hidden behind text */
@media (max-width: 767.98px) {
    .carousel-caption-center {
        top: 10%;
        width: 90%;
        margin-left: auto;
        margin-right: auto;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    }

    /* Limit masthead/header image height on small phones */
    #mastheadCarousel .carousel-item {
        max-height: 55vh;
    }

    /* Header images on article/contact pages */
    #articleHeader .carousel-item {
        max-height: 40vh;
    }
}

/* ── Article photo carousel ─────────────────────────────────────────────────── */

/* Constrain article section carousels so they don't dominate a small screen */
@media (max-width: 767.98px) {
    .article-carousel .carousel-item img {
        max-height: 55vh;
    }
}

/* ── Events / portfolio grid ─────────────────────────────────────────────────── */

/* On touch/mobile devices there is no hover. Always show the caption overlay
   so visitors can read the event title and reach the "Meer info" button. */
@media (max-width: 991.98px) {
    .portfolio .portfolio-item .portfolio-item-caption {
        opacity: 1;
        background-color: rgba(0, 0, 0, 0.55);
    }

    /* Scale down caption text so it fits the 300 px card height */
    .portfolio .portfolio-item .portfolio-item-caption-content {
        font-size: 1rem;
    }

    .portfolio .portfolio-item .portfolio-item-caption-content h5 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .portfolio .portfolio-item .portfolio-item-caption-content h6 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .portfolio .portfolio-item .portfolio-item-caption-content p {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        /* Limit quote text so the button always fits */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* ── Captcha ─────────────────────────────────────────────────────────────────── */

/* Prevent captcha image from overflowing on small screens */
.captcha img,
#id_captcha_0,
img[alt="captcha"] {
    max-width: 100%;
    height: auto;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */

@media (max-width: 767.98px) {
    .footer {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Add spacing between stacked footer columns */
    .footer .col-lg-4 {
        margin-bottom: 2rem;
    }
    .footer .col-lg-4:last-child {
        margin-bottom: 0;
    }
}

/* ── Markdown content inside article sections ────────────────────────────────── */

/* Prevent wide pre/code blocks from causing horizontal scroll */
@media (max-width: 767.98px) {
    .page-section pre,
    .page-section code {
        white-space: pre-wrap;
        word-break: break-word;
    }

    /* Ensure embedded images in markdown content don't overflow */
    .page-section img {
        max-width: 100%;
        height: auto;
    }

    /* Reduce xl button size slightly so it doesn't feel oversized */
    .btn-xl {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
    }
}
