/* Mobile-only styles. Desktop layout stays unchanged above 880px. */

.mobile-chrome {
    display: none;
}

/* ---- Splash (index.htm) ---- */
.splash-logo-mobile {
    display: none;
}

@media (max-width: 880px) {
    body.splash {
        margin: 0;
        padding: 0;
        text-align: center;
    }

    body.splash table {
        width: 100%;
        max-width: 100%;
        border-collapse: collapse;
        margin-left: auto;
        margin-right: auto;
    }

    body.splash td {
        text-align: center;
    }

    body.splash td.splash-spacer {
        height: 24px !important;
    }

    body.splash .splash-logo-desktop {
        display: none;
    }

    body.splash .splash-logo-mobile {
        display: inline-block;
        max-width: 92%;
        width: auto;
        height: auto !important;
        margin-left: auto;
        margin-right: auto;
    }

    body.splash p {
        width: auto;
        max-width: 100%;
        padding-right: 0;
    }
}

/* ---- Section shells (index_*.htm) ---- */
@media (max-width: 880px) {
    html,
    body.shell {
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden;
    }

    body.shell.nav-open {
        overflow: hidden;
    }

    .mobile-chrome {
        display: block;
    }

    .mobile-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1002;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 56px;
        padding: 0 12px;
        box-sizing: border-box;
        background: #202914;
        border-bottom: 1px solid #3a4a28;
    }

    .mobile-logo {
        display: block;
        line-height: 0;
        position: relative;
        z-index: 1;
    }

    .mobile-title {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        height: 26px;
        width: auto;
        max-width: calc(100% - 110px);
        border: 0;
        pointer-events: none;
    }

    .mobile-logo img {
        height: 23px;
        width: auto;
        border: 0;
    }

    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
        height: 44px;
        padding: 6px;
        box-sizing: border-box;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .mobile-nav-toggle img {
        display: block;
        width: 33px;
        height: 16px;
        border: 0;
        transition: transform 0.2s ease;
    }

    .mobile-nav-toggle[aria-expanded="true"] img {
        transform: rotate(180deg);
    }

    .mobile-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.45);
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .mobile-backdrop[hidden],
    .mobile-drawer[hidden] {
        display: none !important;
    }

    .mobile-drawer {
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        z-index: 1001;
        width: min(280px, 85vw);
        background: #202914;
        border-left: 1px solid #3a4a28;
        box-sizing: border-box;
        padding: 1.25rem 0;
        overflow-y: auto;
    }

    .mobile-drawer nav {
        display: flex;
        flex-direction: column;
        padding: 0.5rem 0;
    }

    .mobile-drawer a {
        display: block;
        padding: 0.35rem 1.25rem;
        line-height: 0;
        text-decoration: none;
        border: 0;
    }

    .mobile-drawer a img {
        display: block;
        height: 72px;
        width: auto;
        border: 0;
    }

    .mobile-drawer a .nav-img-active {
        display: none;
    }

    .mobile-drawer a:hover,
    .mobile-drawer a:focus {
        background: transparent;
        outline: none;
    }

    body.shell-n .mobile-drawer a[data-section="n"] .nav-img,
    body.shell-p .mobile-drawer a[data-section="p"] .nav-img,
    body.shell-s .mobile-drawer a[data-section="s"] .nav-img,
    body.shell-o .mobile-drawer a[data-section="o"] .nav-img,
    body.shell-k .mobile-drawer a[data-section="k"] .nav-img {
        display: none;
    }

    body.shell-n .mobile-drawer a[data-section="n"] .nav-img-active,
    body.shell-p .mobile-drawer a[data-section="p"] .nav-img-active,
    body.shell-s .mobile-drawer a[data-section="s"] .nav-img-active,
    body.shell-o .mobile-drawer a[data-section="o"] .nav-img-active,
    body.shell-k .mobile-drawer a[data-section="k"] .nav-img-active {
        display: block;
    }

    .shell-frames {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        text-align: left !important;
        overflow: hidden;
    }

    .shell-frames iframe[name="contents"] {
        display: none !important;
    }

    .shell-frames iframe[name="glavni"] {
        display: block;
        width: 100% !important;
        height: 100% !important;
        border: 0;
    }
}

/* Content inside glavni iframe: activated by js/mobile-content.js when
   the parent window is <= 880px. Avoids @media here so the 680px desktop
   iframe keeps its original layout. */

.mobile-detail-nav,
.mobile-fallback-links {
    display: none;
}

body.mobile-view {
    margin: 0;
    padding: 8px;
}

body.mobile-view table {
    width: 100% !important;
    max-width: 100%;
}

body.mobile-view.gallery-grid table {
    display: flex;
    flex-wrap: wrap;
    width: 100% !important;
}

body.mobile-view.gallery-grid tbody,
body.mobile-view.gallery-grid tr {
    display: contents;
}

body.mobile-view.gallery-grid td {
    display: none;
    height: auto !important;
    width: auto !important;
    padding: 4px;
    box-sizing: border-box;
}

body.mobile-view.gallery-grid td.has-thumb {
    display: block;
    flex: 0 0 33.333%;
    max-width: 33.333%;
}

body.mobile-view.gallery-grid td.page-arrow {
    display: block;
    flex: 0 0 100%;
    max-width: 100%;
    text-align: center;
    padding: 12px 4px;
}

body.mobile-view.gallery-grid td.has-thumb img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto !important;
}

body.mobile-view.gallery-grid td.page-arrow img {
    width: auto;
    height: 40px !important;
    max-width: 40px;
}

body.mobile-view.detail-page table,
body.mobile-view.detail-page td {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}

body.mobile-view.detail-page tr:first-child {
    display: none;
}

body.mobile-view.detail-page img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

body.mobile-view .mobile-detail-nav,
body.mobile-view .mobile-fallback-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.75rem 0.25rem 1.5rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 1rem;
}

body.mobile-view .mobile-detail-nav a,
body.mobile-view .mobile-fallback-links a {
    color: Maroon;
    text-decoration: none;
}

body.mobile-view .mobile-fallback-links {
    flex-direction: column;
}

@media (max-width: 400px) {
    body.mobile-view.gallery-grid td.has-thumb {
        flex-basis: 50%;
        max-width: 50%;
    }
}
