/* ── Gallery backdrop ────────────────────────────────────────────────────────── */
#gradient-gallery {
    position: fixed;
    inset: 0;
    z-index: 30;                           /* above panel (--z-panel: 10)        */
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
#gradient-gallery.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Modal box ───────────────────────────────────────────────────────────────── */
.gallery-modal {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border: var(--border-panel);
    border-radius: var(--radius-1);
    width: min(92vw, 800px);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Subtle lift on open */
    transform: translateY(6px);
    transition: transform 0.22s ease;
}
#gradient-gallery.open .gallery-modal {
    transform: translateY(0);
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--pad-header) var(--pad-outer);
    border-bottom: var(--border-sub);
    flex-shrink: 0;
}

.gallery-title {   /* s1 — heading: gallery panel title */
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-ui);
    text-transform: uppercase;
    color: var(--t-sidebar-title-color);
}

.gallery-close {
    width: var(--ctrl-height);
    height: var(--ctrl-height);
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-2);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--ease-fast), background var(--ease-fast);
}
.gallery-close::before {
    content: '';
    display: block;
    width: var(--icon-size);
    height: var(--icon-size);
    background-color: currentColor;
    -webkit-mask-image: url('/assets/icons/ui/ui_close.svg');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('/assets/icons/ui/ui_close.svg');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}
.gallery-close:hover {
    color: var(--text-hover);
    background: var(--surface-hover);
}

/* ── Tab bar ─────────────────────────────────────────────────────────────────── */
.gallery-tabs {
    display: flex;
    gap: var(--gap-content);
    padding: var(--pad-1) var(--pad-outer);
    border-bottom: var(--border-sub);
    flex-shrink: 0;
}

.gallery-tab {   /* s3 — button: Default / Community navigation tabs */
    flex: 1;
    padding: var(--pad-1) 0;
    background: var(--surface-input);
    border: var(--border-input);
    border-radius: var(--radius-2);
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    letter-spacing: var(--letter-spacing-sm);
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--ease-hover), border-color var(--ease-hover), color var(--ease-hover);
}
.gallery-tab:hover {
    background: var(--surface-hover);
    border-color: var(--border-color-hover);
    color: var(--text-hover);
}
.gallery-tab.active {
    background: var(--surface-active);
    border-color: var(--border-color-on);
    color: var(--text-hover);
}

/* ── Scrollable card grid ────────────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--pad-inner);
    padding: var(--pad-outer);
    overflow-y: auto;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.gallery-grid::-webkit-scrollbar { display: none; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.gallery-empty {   /* s3 — button: empty-state placeholder text */
    grid-column: 1 / -1;
    padding: var(--pad-outer) 0;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    letter-spacing: var(--letter-spacing-sm);
    text-transform: uppercase;
}

/* ── Card ────────────────────────────────────────────────────────────────────── */
.gallery-card {
    display: flex;
    flex-direction: column;
    gap: var(--pad-1);
    padding: var(--pad-1);
    background: var(--surface-input);
    border: var(--border-input);
    border-radius: var(--radius-2);
    cursor: pointer;
    font-family: var(--font-main);
    text-align: center;
    transition: background var(--ease-hover), border-color var(--ease-hover);
}
.gallery-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-color-hover);
}

/* ── Card canvas (square gradient preview) ───────────────────────────────────── */
.gallery-card-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: calc(var(--radius-2) - 2px);
}

/* ── Card text ───────────────────────────────────────────────────────────────── */
.gallery-card-name {   /* s3 — button: preset card name label */
    font-size: var(--font-size-sm);
    letter-spacing: var(--letter-spacing-sm);
    text-transform: uppercase;
    color: var(--text-secondary);
}

.gallery-card-author {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    opacity: 0.7;
}
