/**
 * Categories Drawer Styles
 * Displays category cards stacked one below the other (single column)
 * with the exact same design, overlay, and white banner as the Categories section.
 */

.categories-drawer .drawer-content {
    inset-inline-start: auto;
    inset-inline-end: 0;
    transform: translateX(100%);
    width: 85%;
    max-width: 360px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

.codleade-drawer.categories-drawer.is-active .drawer-content {
    transform: translateX(0);
}

.categories-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--codleade-border, #e2e8f0);
    background: #ffffff;
    flex-shrink: 0;
}

.categories-drawer .drawer-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--codleade-text-primary, #1e293b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.categories-drawer .drawer-close {
    color: var(--codleade-text-primary, #1e293b) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.categories-drawer .drawer-close svg {
    width: var(--codleade-icon-size-2xl);
    height: var(--codleade-icon-size-2xl);
    stroke: currentColor;
    display: block;
}

.categories-drawer .drawer-body {
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* The highlighted link above the grid: full width. `hidden` (Customizer toggle)
   must win over the grid display, hence the second rule. */
.categories-drawer .categories-highlights {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 16px 0;
}

.categories-drawer .categories-highlights[hidden] {
    display: none;
}

.categories-drawer .categories-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 8px;
    border: 1px solid var(--codleade-border, #e5e7eb);
    border-radius: 13px;
    color: var(--codleade-text-primary, #1e293b);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    text-decoration: none;
}

.categories-drawer .categories-highlight:hover,
.categories-drawer .categories-highlight:focus-visible {
    border-color: var(--codleade-text-primary, #1e293b);
}

/* Two columns of square tiles. minmax(0, …) lets a long category name wrap
   instead of widening its column. */
.categories-drawer .categories-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 12px;
    padding: 20px 16px 24px;
    box-sizing: border-box;
}

.categories-drawer .category-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--codleade-text-primary, #1e293b);
    text-decoration: none;
}

.categories-drawer .category-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 13px;
    overflow: hidden;
    background-color: #f8fafc;
}

.categories-drawer .category-image-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border: none;
}

.categories-drawer .category-name {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
    /* Two lines at most, then an ellipsis. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.categories-drawer .category-count {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    color: #707070;
}

.categories-drawer .no-categories {
    padding: 24px;
    text-align: center;
    color: var(--codleade-text-secondary, #64748b);
    font-size: 0.85rem;
}

@media (max-width: 767px) {
    .categories-drawer .drawer-content {
        width: 86%;
        max-width: 340px;
    }

    .categories-drawer .categories-highlights,
    .categories-drawer .categories-list {
        padding-left: 14px;
        padding-right: 14px;
    }
}
