/*
=================================================
BLOKS Shader Viewer
Version: 0.6.1-dev
=================================================
*/

:root {
    --bloks-sticky-header-offset: 96px;
}

/* =========================================================
   Viewer
========================================================= */

.bloks-shader-wrap {
    position: relative;
    width: 100%;
    min-height: 180px;
    border-radius: 18px;
    overflow: hidden;
    background: #050816;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.bloks-shader-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(74,125,255,0.08);
    box-shadow:
        inset 0 0 24px rgba(74,125,255,0.05),
        0 0 30px rgba(74,125,255,0.06);
}

.bloks-shader-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* =========================================================
   Fallback
========================================================= */

.bloks-shader-fallback {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #dbeafe;
    background:
        radial-gradient(circle at center, rgba(59,130,246,0.24) 0%, rgba(5,8,22,0.96) 68%),
        #050816;
    font-size: 14px;
    text-align: center;
}

.bloks-shader-fallback-inner {
    max-width: 420px;
}

.bloks-shader-fallback-icon {
    font-size: 34px;
    color: #67e8f9;
    margin-bottom: 12px;
    text-shadow: 0 0 22px rgba(103,232,249,0.65);
}

.bloks-shader-fallback h3 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 20px;
}

.bloks-shader-fallback p {
    margin: 0;
    color: #94a3b8;
    line-height: 1.6;
}

.bloks-shader-wrap.bloks-shader-error .bloks-shader-canvas {
    display: none;
}

.bloks-shader-wrap.bloks-shader-error .bloks-shader-fallback {
    display: flex;
}

/* =========================================================
   Controls
========================================================= */

.bloks-shader-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    gap: 8px;
}

.bloks-shader-retry,
.bloks-shader-audio,
.bloks-shader-fullscreen {
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.bloks-shader-retry:hover,
.bloks-shader-audio:hover,
.bloks-shader-fullscreen:hover {
    transform: translateY(-1px);
}

.bloks-shader-retry {
    margin-top: 18px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(103,232,249,0.45);
    background: rgba(14,165,233,0.14);
    color: #e0f2fe;
    cursor: pointer;
}

.bloks-shader-retry:hover {
    background: rgba(14,165,233,0.24);
}

.bloks-shader-audio,
.bloks-shader-fullscreen {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(120,170,255,0.35);
    background: rgba(5,8,18,0.72);
    color: rgba(220,235,255,0.92);
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.bloks-shader-audio:hover,
.bloks-shader-fullscreen:hover {
    border-color: rgba(120,190,255,0.8);
}

.bloks-shader-audio-active .bloks-shader-audio {
    border-color: rgba(120,255,220,0.95);
    color: rgba(170,255,235,1);
    box-shadow: 0 0 18px rgba(120,255,220,0.28);
}

.bloks-shader-audio-unavailable .bloks-shader-audio {
    border-color: rgba(255,120,150,0.55);
    color: rgba(255,170,190,0.95);
}

/* =========================================================
   Badges / Modes
========================================================= */

.bloks-shader-wrap.bloks-shader-slow::after {
    content: "Mobile preview mode";
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 4;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(5, 8, 22, 0.72);
    border: 1px solid rgba(103, 232, 249, 0.28);
    color: #bae6fd;
    font-size: 12px;
    pointer-events: none;
}

.bloks-shader-is-fullscreen {
    position: fixed !important;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 99999;
}

.bloks-shader-is-fullscreen .bloks-shader-canvas {
    width: 100%;
    height: 100%;
}

/* =========================================================
   Shader Library Layout
========================================================= */

.bloks-shader-library {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(380px, 2fr);
    gap: 1.75rem;
    align-items: start;
}

.bloks-shader-library-stage {
    position: sticky;
    top: var(--bloks-sticky-header-offset);
    z-index: 20;
}

.bloks-shader-library-browser {
    position: sticky;
    top: var(--bloks-sticky-header-offset);
    max-height: calc(100vh - var(--bloks-sticky-header-offset) - 24px);
    overflow-y: auto;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(5,8,22,0.88);
    backdrop-filter: blur(12px);
}

/* Scrollbar */

.bloks-shader-library-browser::-webkit-scrollbar {
    width: 10px;
}

.bloks-shader-library-browser::-webkit-scrollbar-track {
    background: rgba(15,23,42,0.65);
}

.bloks-shader-library-browser::-webkit-scrollbar-thumb {
    background: rgba(74,125,255,0.55);
    border-radius: 999px;
}

.bloks-shader-library-browser::-webkit-scrollbar-thumb:hover {
    background: rgba(74,125,255,0.85);
}

/* =========================================================
   Shader Info Panel
========================================================= */

.bloks-shader-info {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 0 1.25rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(56,189,248,0.18);
    background:
        linear-gradient(
            180deg,
            rgba(15,23,42,.96),
            rgba(5,8,22,.96)
        );
    color: #dbeafe;
    box-shadow: 0 18px 44px rgba(0,0,0,.32);
}

.bloks-shader-info-head {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.bloks-shader-info-thumb-link {
    display: block;
    width: 90px;
    height: 90px;
}

.bloks-shader-info-thumb {
    display: block;
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(56,189,248,.22);
    background: #050816;
    cursor: zoom-in;
}

.bloks-shader-info-thumb-link {
    position: relative;
}

.bloks-shader-thumb-preview {
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 100;

    width: 360px;
    aspect-ratio: 16 / 9;

    margin-left: 1rem;

    object-fit: cover;

    border-radius: 18px;
    border: 1px solid rgba(56,189,248,.26);

    background: #050816;

    box-shadow:
        0 24px 70px rgba(0,0,0,.55),
        0 0 38px rgba(56,189,248,.18);

    opacity: 0;
    visibility: hidden;

    transform: translateY(-4px) scale(.96);

    pointer-events: none;

    transition:
        opacity .18s ease,
        visibility .18s ease,
        transform .18s ease;
}

.bloks-shader-info-thumb-link:hover .bloks-shader-thumb-preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(-4px) scale(1);
}

.bloks-shader-info-copy {
    min-width: 0;
}

.bloks-shader-info-title {
    margin: 0 0 .35rem;
    color: #f8fafc;
    font-size: 1.25rem;
    line-height: 1.15;
    font-weight: 700;
}

.bloks-shader-info-description {
    margin: 0 0 .75rem;
    color: #94a3b8;
    font-size: .88rem;
    line-height: 1.45;
}

.bloks-shader-info-description:empty {
    display: none;
}

.bloks-shader-info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 .8rem;
}

.bloks-tag,
.bloks-shader-category {
    display: inline-flex;
    align-items: center;
    padding: .28rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(56,189,248,.22);
    background: rgba(56,189,248,.08);
    color: #94d8ff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.bloks-shader-info-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid rgba(255,255,255,.06);
    color: #bae6fd;
    font-size: .85rem;
}

.bloks-shader-info-identity {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.bloks-shader-author {
    color: #bae6fd;
    font-weight: 700;
}

.bloks-shader-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.bloks-badge {
    padding: .32rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(74,125,255,.35);
    background: rgba(47,82,255,.18);
    color: #dbeafe;
    font-size: .72rem;
    line-height: 1;
    font-weight: 800;
}

/* =========================================================
   Search
========================================================= */

.bloks-shader-library-search {
    margin: 0 0 1.25rem;
}

.bloks-shader-search {
    width: 100%;
    padding: .8rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(56,189,248,.18);
    background: rgba(15,23,42,.82);
    color: #f8fafc;
    font-size: .9rem;
    outline: none;
    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

.bloks-shader-search::placeholder {
    color: #94a3b8;
}

.bloks-shader-search:focus {
    border-color: rgba(56,189,248,.55);
    box-shadow: 0 0 0 3px rgba(56,189,248,.08);
}

.bloks-shader-no-results {
    margin: .8rem 0 0;
    padding: .9rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(56,189,248,.16);
    background: rgba(15,23,42,.65);
    color: #94a3b8;
    font-size: .9rem;
}

/* =========================================================
   Library Groups
========================================================= */

.bloks-shader-library-group {
    margin: 0 0 1.5rem;
}

.bloks-shader-library-group:last-child {
    margin-bottom: 0;
}

.bloks-shader-library-group h3 {
    margin: 0 0 .75rem;
    color: #f8fafc;
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.bloks-shader-library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
}

.bloks-shader-library-item {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: .6rem .75rem;
    border-radius: 999px;
    border: 1px solid rgba(74,125,255,0.25);
    background: rgba(15,23,42,0.85);
    color: #dbeafe;
    font-size: .78rem;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.bloks-shader-library-item:hover {
    border-color: rgba(74,125,255,0.8);
    transform: translateY(-1px);
}

.bloks-shader-library-item.is-active {
    border-color: #4A7DFF;
    background: rgba(47,82,255,0.24);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(74,125,255,0.35);
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 1100px) {
    .bloks-shader-library {
        grid-template-columns: minmax(0, 1fr);
    }

    .bloks-shader-library-stage,
    .bloks-shader-library-browser {
        position: relative;
        top: auto;
        max-height: none;
    }
}

@media (max-width: 700px) {
    .bloks-shader-library-grid {
        grid-template-columns: 1fr;
    }

    .bloks-shader-info-head {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .bloks-shader-info-thumb-link,
    .bloks-shader-info-thumb {
        width: 72px;
        height: 72px;
    }

    .bloks-shader-info-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .bloks-shader-badges {
        justify-content: flex-start;
    }
}

.bloks-shader-info {
    overflow: visible;
}

.bloks-shader-library-browser {
    overflow-x: visible;
}

.bloks-shader-info-thumb-link {
    overflow: visible;
}

.bloks-shader-thumb-preview {
    width: 300px;
    height: auto;
    max-width: none;
}

/* add image stuff */
.bloks-shader-wrap.bloks-shader-drop-active {
    outline: 2px solid rgba(56,189,248,.75);
    outline-offset: 4px;
}