/* Blocks catalog page: /blocks and its category and search views */

/* Sky background; the body class overrides the plain white from the home page styles */
body.catalog-page-block {
    background: #8fd3f4 url('../images/site/logoem.jpg') center / cover fixed no-repeat;
}

/* Fills the page so the pagination stays at the bottom, even on a short last page */
.hw {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    padding: 8px 0 48px;
    font-family: 'Baloo 2', Arial, sans-serif;
    color: var(--cartoon-ink);
}

/* Breadcrumb (items only; blocks have no breadcrumb) */
.hw-crumbs {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--gx-muted);
}

.hw-crumbs a {
    color: var(--gx-blue-dark);
    font-weight: 700;
    text-decoration: none;
}

.hw-crumbs a:hover {
    text-decoration: underline;
}

/* Page heading: the site logo, centred */
.hw-logo-link {
    display: block;
    margin: 0 auto;
    line-height: 0;
}

.hw-logo-link:focus-visible {
    outline: 3px solid rgba(76, 175, 36, 0.4);
    outline-offset: 4px;
    border-radius: 8px;
}

.hw-logo {
    display: block;
    width: 560px;
    max-width: 92vw;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 4px 10px rgba(31, 42, 68, 0.2));
}

.hw-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.hw-title {
    margin: 0;
    font-family: 'Baloo 2', Arial, sans-serif;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--cartoon-ink);
}

.hw-sub {
    margin: 6px 0 0;
    font-size: 15px;
    color: var(--gx-muted);
}

/* Search and category row */
.hw-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.catalog-search-wrap {
    position: relative;
    flex: 0 1 420px;
    max-width: 420px;
    min-width: 0;
}

/* Results sit just under the search row */
.catalog-search-wrap .home-hero-suggest {
    top: calc(100% + 6px);
    margin-top: 0;
}

.hw-search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.hw-search-input-wrap {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    align-items: center;
    height: 48px;
    padding: 0 14px 0 16px;
    background: #fff;
    border: 2px solid var(--cartoon-line);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(31, 45, 26, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hw-search-input-wrap:focus-within {
    border-color: var(--gx-blue);
    box-shadow: 0 0 0 4px rgba(76, 175, 36, 0.18);
}

.hw-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--cartoon-ink);
    outline: none;
}

.hw-search-input::placeholder {
    color: #7a869c;
    font-weight: 500;
}

.hw-search-clear {
    /* Always takes up its space, so the input and button don't shift when it appears */
    visibility: hidden;
    border: 0;
    background: transparent;
    padding: 4px;
    color: var(--gx-muted);
    line-height: 0;
    font-size: 16px;
    cursor: pointer;
}

.hw-search-clear.show {
    visibility: visible;
}

.hw-search-clear:hover {
    color: var(--gx-blue-dark);
}

/* "/ to search" keycap, shown on wider screens */
.sx-kbd-hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gx-muted);
    white-space: nowrap;
}

.sx-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--gx-blue-dark);
    background: var(--cartoon-soft);
    border: 1px solid var(--cartoon-line);
    border-radius: 7px;
    box-shadow: 0 2px 0 var(--cartoon-line);
}

@media (min-width: 768px) {
    .sx-kbd-hint {
        display: inline-flex;
    }
}

.hw-search-btn {
    flex: 0 0 auto;
    height: 48px;
    padding: 0 22px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--gx-blue);
    border: 1px solid var(--gx-blue-dark);
    border-radius: 14px;
    box-shadow: 0 3px 0 var(--gx-blue-dark);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.hw-search-btn:hover {
    background: #58b92e;
    transform: translateY(-1px);
    box-shadow: 0 4px 0 var(--gx-blue-dark);
}

.hw-search-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--gx-blue-dark);
}

/* Category dropdown toggle */
.hw-select {
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--cartoon-ink);
    background: #fff;
    border: 2px solid var(--cartoon-line);
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hw-select:hover,
.hw-select[aria-expanded="true"] {
    border-color: var(--gx-blue);
    background: var(--cartoon-soft);
}

/* Category menu: solid panel, same as the navbar dropdowns */
.hw-tools .dropdown-menu {
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--nav-border);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(32, 33, 36, 0.15);
    background: #fff;
}

.hw-tools .sidebar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--gx-muted);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.hw-tools .sidebar-dropdown-item:hover {
    background: var(--nav-hover);
    color: var(--cartoon-ink);
}

.hw-tools .sidebar-dropdown-item.active {
    color: var(--gx-blue-dark);
    font-weight: 700;
    background: var(--cartoon-soft);
}

.hw-tools .sidebar-dropdown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
}

.hw-tools .sidebar-dropdown-icon img {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
}

/* Entry grid: one card per block */
.hw-entries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.hw-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px 14px;
    background: #fff;
    border: 2px solid var(--cartoon-line);
    border-radius: 16px;
    color: var(--cartoon-ink);
    text-align: center;
    text-decoration: none;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease, background 0.15s ease;
}

.hw-entry:hover {
    transform: translateY(-3px);
    border-color: var(--gx-blue);
    background: var(--cartoon-soft);
    color: var(--cartoon-ink);
}

.hw-entry:focus-visible {
    outline: 3px solid rgba(76, 175, 36, 0.4);
    outline-offset: 2px;
}

.hw-entry-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--cartoon-soft);
    border: 2px solid var(--cartoon-line);
    color: var(--gx-blue-dark);
    font-size: 28px;
}

.hw-entry-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

.hw-entry-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

/* Empty state */
.hw-empty {
    padding: 48px 20px;
    text-align: center;
    border: 2px dashed var(--cartoon-line);
    border-radius: 18px;
    background: #fff;
}

.hw-empty i {
    font-size: 40px;
    color: var(--gx-blue);
}

.hw-empty h2 {
    margin: 12px 0 6px;
    font-family: 'Baloo 2', Arial, sans-serif;
    font-size: 22px;
    font-weight: 600;
}

.hw-empty p {
    color: var(--gx-muted);
}

/* Pagination */
.hw-pager {
    display: flex;
    justify-content: center;
    margin-top: auto;
    padding-top: 28px;
}

.hw-pager .pagination {
    gap: 6px;
}

/* Hide the "Showing x to y of z results" summary; the page links stay */
.hw-pager .small.text-muted {
    display: none;
}

.hw-pager .page-link {
    border: 2px solid var(--cartoon-line);
    border-radius: 10px !important;
    color: var(--gx-blue-dark);
    font-weight: 700;
}

.hw-pager .page-item.active .page-link {
    background: var(--gx-blue);
    border-color: var(--gx-blue-dark);
    color: #fff;
}

.hw-pager .page-link:hover {
    background: var(--cartoon-soft);
    border-color: var(--gx-blue);
    color: var(--gx-blue-dark);
}

@media (max-width: 575.98px) {
    .hw-title {
        font-size: 26px;
    }

    .hw-search-form {
        flex-wrap: wrap;
    }

    .hw-search-btn {
        width: 100%;
    }

    .hw-tools .dropdown {
        width: 100%;
    }

    .hw-select {
        width: 100%;
        text-align: left;
    }

    .hw-entries {
        grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hw-entry,
    .hw-search-btn,
    .hw-select,
    .hw-search-input-wrap {
        transition: none;
    }
}

/* Same width as the block detail pages */
.catalog-page-block main.container {
    max-width: 1140px;
}

/* Search section in its own panel, like the detail page cards */
.hw-search-panel {
    margin-bottom: 24px;
    padding: 18px;
    background: #fff;
    border: 2px solid var(--cartoon-line);
    border-radius: 18px;
    box-shadow: 0 3px 0 var(--cartoon-line);
}

.hw-search-panel .hw-tools {
    margin-bottom: 0;
}

/* Logo gap matches the home page (28px below the logo) */
.hw-list-head:has(.hw-logo-link) {
    margin-bottom: 0;
}

.hw-logo-link {
    margin-bottom: 28px;
}

/* Search button: no drop shadow */
.hw-search-btn,
.hw-search-btn:hover,
.hw-search-btn:active {
    box-shadow: none;
}

/* Final override: the search button never has a drop shadow */
.hw-search-btn {
    box-shadow: none !important;
}

/* Category dropdown matches the mobs page: same button width, menu width, padding and text size */
.hw-select {
    min-width: 220px;
}

.hw-tools .dropdown-menu {
    min-width: 280px;
    padding: 8px;
}

.hw-tools .sidebar-dropdown-item {
    display: block;
    padding: 12px 16px;
    font-size: 16px;
}

/* Category items are plain text, like the mobs dropdown */
.hw-tools .sidebar-dropdown-icon {
    display: none;
}
