/* ==========================================================================
   DashboardFox Gallery Styles
   Always-visible two-column layout: scrollable picker + sticky preview panel
   ========================================================================== */

/* --------------------------------------------------------------------------
   Gallery Hero
   -------------------------------------------------------------------------- */
.gallery-hero {
    padding: calc(var(--header-height) + 60px) 24px 60px;
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-subtle) 100%);
    text-align: center;
}

.gallery-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.gallery-hero h1 {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.gallery-hero p {
    font-size: 19px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
}

.gallery-hero-ctas {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Gallery Stage
   -------------------------------------------------------------------------- */
.gallery-stage {
    background: var(--color-bg-subtle);
    padding: 32px 24px 80px;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.gallery-stage-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

/* --------------------------------------------------------------------------
   Picker — left column, independently scrollable
   -------------------------------------------------------------------------- */
.gallery-picker {
    /* Natural page flow — scrolls with the page, no independent scrollbar */
}

/* Sticky category nav inside picker */
.picker-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg-subtle);
    padding: 0 0 10px;
    margin-bottom: 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border-subtle);
}

.picker-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    white-space: nowrap;
    transition: all 0.15s;
    cursor: pointer;
}

.picker-nav-pill:hover,
.picker-nav-pill.is-active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.picker-nav-pill svg {
    width: 12px;
    height: 12px;
}

/* --------------------------------------------------------------------------
   Dashboard card — featured item at top of picker
   -------------------------------------------------------------------------- */
.picker-dashboard-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    background: var(--color-primary-soft);
    border: 2px solid var(--color-primary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.picker-dashboard-card:hover {
    background: rgba(37, 99, 235, 0.12);
    box-shadow: var(--shadow-md);
}

.picker-dashboard-card.is-selected {
    background: var(--color-primary);
}

.picker-dashboard-card.is-selected::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 10px;
    background-position: center;
    background-repeat: no-repeat;
}

.picker-dashboard-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: rgba(37, 99, 235, 0.12);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.picker-dashboard-card.is-selected .picker-dashboard-icon {
    background: rgba(255,255,255,0.2);
}

.picker-dashboard-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

.picker-dashboard-card.is-selected .picker-dashboard-icon svg {
    color: white;
}

.picker-dashboard-body { flex: 1; min-width: 0; }

.picker-dashboard-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.picker-dashboard-card.is-selected .picker-dashboard-name { color: white; }

.picker-dashboard-sub {
    font-size: 13px;
    color: var(--color-primary);
    opacity: 0.75;
}

.picker-dashboard-card.is-selected .picker-dashboard-sub {
    color: rgba(255,255,255,0.8);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Viz Category + Cards
   -------------------------------------------------------------------------- */
.viz-category {
    margin-bottom: 24px;
}

.viz-category:last-child {
    margin-bottom: 0;
    padding-bottom: 24px;
}

.viz-category-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.viz-category-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
}

.viz-category-header h3 svg {
    width: 14px;
    height: 14px;
    color: var(--color-primary);
}

.viz-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.viz-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    position: relative;
}

.viz-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.viz-card:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.viz-card.is-selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    box-shadow: var(--shadow-sm);
}

.viz-card.is-selected::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 8px;
    background-position: center;
    background-repeat: no-repeat;
}

.viz-card-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 8px;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.viz-card.is-selected .viz-card-icon { background: var(--color-primary); }

.viz-card-icon svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    transition: color 0.15s;
}

.viz-card.is-selected .viz-card-icon svg { color: white; }

.viz-card-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.viz-card-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    padding: 2px 5px;
    border-radius: 3px;
    margin-top: 4px;
}

.viz-card.is-selected .viz-card-tag {
    background: var(--color-primary);
    color: white;
}

/* --------------------------------------------------------------------------
   Preview Panel — right sticky column
   -------------------------------------------------------------------------- */
.gallery-panel {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    height: calc(100vh - var(--header-height) - 48px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.gallery-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.gallery-panel-info { flex: 1; min-width: 0; }

.gallery-preview-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-success);
    margin-bottom: 4px;
}

.gallery-preview-label::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.gallery-preview-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 3px;
    line-height: 1.2;
    transition: opacity 0.15s;
}

.gallery-preview-description {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
    transition: opacity 0.15s;
}

.gallery-panel.is-transitioning .gallery-preview-title,
.gallery-panel.is-transitioning .gallery-preview-description {
    opacity: 0.3;
}

.gallery-panel-actions { flex-shrink: 0; }

/* Embed container — fills remaining height */
.gallery-panel-embed {
    flex: 1;
    min-height: 0;
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.gallery-panel-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    transition: opacity 0.2s;
}

.gallery-panel-embed.is-loading iframe { opacity: 0.15; }

/* Static screenshot fallback (used while embed bug is fixed) */
.gallery-panel-embed__screenshot {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
}

.gallery-panel-embed.is-screenshot iframe { display: none; }
.gallery-panel-embed.is-screenshot .gallery-panel-embed__screenshot { display: block; }
.gallery-panel-embed.is-screenshot.is-loading .gallery-preview-loader { display: none; }

.gallery-preview-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--color-text-muted);
    z-index: 10;
}

.gallery-panel-embed.is-loading .gallery-preview-loader { display: flex; }

.gallery-preview-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.gallery-preview-loader span {
    font-size: 13px;
    font-weight: 500;
}

/* Hints */
.gallery-preview-hints {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 0;
}

.gallery-preview-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.gallery-preview-hint svg {
    width: 14px;
    height: 14px;
    color: var(--color-success);
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Features Section
   -------------------------------------------------------------------------- */
.gallery-features {
    padding: 60px 24px;
    background: var(--color-bg-subtle);
}

.gallery-features-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.gallery-features-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-features-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
}

.gallery-features-header p {
    font-size: 17px;
    color: var(--color-text-secondary);
}

.gallery-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.gallery-feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
}

.gallery-feature-card svg {
    width: 36px;
    height: 36px;
    color: var(--color-primary);
    margin-bottom: 14px;
}

.gallery-feature-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.gallery-feature-card p {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* --------------------------------------------------------------------------
   CTA
   -------------------------------------------------------------------------- */
.gallery-cta {
    padding: 80px 24px;
    text-align: center;
}

.gallery-cta-inner {
    max-width: 600px;
    margin: 0 auto;
}

.gallery-cta h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 16px;
}

.gallery-cta p {
    font-size: 18px;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
}

.gallery-cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .gallery-stage-inner {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 860px) {
    .gallery-stage-inner {
        grid-template-columns: 1fr;
    }

    .picker-nav { position: static; }

    .gallery-panel {
        position: static;
        height: auto;
    }

    .gallery-panel-embed { height: 480px; }

    .gallery-panel-embed iframe { height: 100%; }

    .viz-grid { grid-template-columns: repeat(4, 1fr); }

    .gallery-features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .gallery-stage { padding: 20px 16px 48px; }
    .gallery-panel-embed { height: 400px; }
    .viz-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .viz-card { padding: 10px 8px; }
    .viz-card-icon { width: 30px; height: 30px; }
    .viz-card-icon svg { width: 15px; height: 15px; }
    .viz-card-name { font-size: 13px; }
    .gallery-features-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .gallery-preview-spinner { animation: none; opacity: 0.5; }
    .gallery-preview-label::before { animation: none; }
    .gallery-panel-embed iframe { transition: none; }
    .viz-card { transition: none; transform: none !important; }
    .gallery-preview-title,
    .gallery-preview-description { transition: none; }
}