/* Global styles */
:root {
    --bg-color: #f5f5f5;
    --bg-color-dark: #d7d7d7;
    --text-color: rgb(0 0 0 / 0.81);
    --muted-color: #888888;
    --accent-color: #d81b60;
    /* For the red search placeholder text color */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    margin: 0;
}

a {
    text-decoration: none !important;
}

a:hover {
    text-decoration: none !important;
}

/* Mobile: darken main body background */
@media (max-width: 767px) {
    body {
        background-color: var(--bg-color-dark);
    }
}

/* Header & Logo */
.header-top {
    padding: 40px 0 20px 0;
    background-color: var(--bg-color);
}

.header-top img {
    max-height: 80px;
    display: block;
    margin: 0 auto;
}

.site-branding {
    text-align: center;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.mobile-icon {
    width: 40px;
    cursor: pointer;
    color: var(--text-color);
}

.site-branding .subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted-color);
}

/* Mobile Toolbar Bar */
.mobile-toolbar {
    display: none;
}

@media (max-width: 767px) {
    .mobile-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        background-color: var(--bg-color-dark);
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
        position: sticky;
        top: 0;
        z-index: 1020;
    }
    .mobile-toolbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
    }
    .mobile-toolbar-left .bi-list {
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-color);
    }
    .mobile-toolbar-title {
        font-size: 1rem;
        font-weight: 300;
        color: var(--text-color);
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }
    .mobile-toolbar-right {
        display: flex;
        align-items: center;
        gap: 14px;
    }
    .mobile-toolbar-right .toolbar-icon {
        cursor: pointer;
        color: var(--text-color);
        font-size: 1.1rem;
        background: none;
        border: none;
        padding: 0;
        display: flex;
        align-items: center;
    }
    /* Hide the old header mobile icons when toolbar is present */
    .header-top .mobile-icon {
        display: none !important;
    }
    /* Hide the desktop-only main heading + toggle row on mobile */
    .mobile-hide-heading {
        display: none !important;
    }
}

/* Toolbar Navigation */
.nav-toolbar {
    border-top: 1px solid #eee;
    padding: 15px 0;
}

.toolbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

@media (max-width: 767px) {
    .toolbar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .toolbar-left {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        display: block;
        /* Fallback for older browsers */
        display: flex;
    }

    .toolbar-left::-webkit-scrollbar {
        display: none;
    }

    .category-link {
        flex: 0 0 auto;
    }
}

.nav-link-custom {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.search-indicator {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.search-input-minimal {
    border: none;
    font-size: 0.85rem;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 2px 0;
    width: 200px;
    outline: none;
}

.search-btn-minimal {
    background: none;
    border: none;
    color: #000000;
    padding: 0 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Mobile Search Modal Input */
.search-input-full {
    border: none;
    border-bottom: 2px solid #333;
    padding: 15px 0;
    font-size: 1.2rem;
    background-color: var(--bg-color);
    outline: none;
}

.search-input-minimal::-webkit-input-placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}
.search-input-minimal::-moz-placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}
.search-input-minimal:-ms-input-placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}
.search-input-minimal::-ms-input-placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}
.search-input-minimal::placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}

@media (min-width: 768px) {
    .search-input-minimal::-webkit-input-placeholder {
        color: #888888 !important;
        opacity: 0.7 !important;
    }
    .search-input-minimal::-moz-placeholder {
        color: #888888 !important;
        opacity: 0.7 !important;
    }
    .search-input-minimal:-ms-input-placeholder {
        color: #888888 !important;
        opacity: 0.7 !important;
    }
    .search-input-minimal::-ms-input-placeholder {
        color: #888888 !important;
        opacity: 0.7 !important;
    }
    .search-input-minimal::placeholder {
        color: #888888 !important;
        opacity: 0.7 !important;
    }
}

.category-link {
    color: var(--muted-color);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.category-link:hover,
.category-link.active {
    color: var(--text-color);
}

/* Grid System */
.gallery-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -5px;
    /* Tight gaps */
}

.gallery-unit {
    padding: 0 5px;
    margin-bottom: 20px;
    transition: width 0.3s ease;
}

/* Default 6 Columns on PC */
.layout-6 .gallery-unit {
    width: calc(100% / 6);
}

/* 12 Columns on PC */
.layout-12 .gallery-unit {
    width: calc(100% / 12);
}

.thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    /* 3:4 aspect ratio */
    overflow: hidden;
    background-color: #f0f0f0;
}

.thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.gallery-unit:hover img {
    opacity: 0.8;
}

.caption {
    margin-top: 8px;
    font-size: 0.65rem;
    color: var(--muted-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Responsive Breakpoints Override */
@media (max-width: 1199px) {
    .gallery-unit {
        width: 25% !important;
    }
}

@media (max-width: 767px) {
    .layout-6 .gallery-unit {
        width: 100% !important;
    }

    .layout-12 .gallery-unit {
        width: 50% !important;
    }
}

/* Layout Icons */
.layout-toggle {
    display: flex;
    gap: 12px;
}

.layout-btn {
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: #f8f8f8;
}

.layout-btn.active {
    background: #444;
}

.icon-square {
    width: 16px;
    height: 16px;
    border: 1.5px solid #aaa;
    border-radius: 2px;
}

.layout-btn.active .icon-square {
    border-color: #fff;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 16px;
    height: 16px;
}

.icon-grid div {
    border: 1.5px solid #aaa;
    border-radius: 1px;
}

.layout-btn.active .icon-grid div {
    border-color: #fff;
}
