/* ==========================================================================
   KHALA STUDIO — SOFTWARE MODULE
   Extends resourcehub.css tokens. One vibe: Apple + Google, simple, easy,
   modern, fast, clean, no stress. One box type (rounded), hover = background
   fade only, no transform / no shadow / no font-weight tricks.
   ========================================================================== */

:root {
    /* Card gradient — light sky blue to soft cyan (see reference design) */
    --sw-grad-start: #BFEBFB;
    --sw-grad-end:   #6FD3EE;
    --sw-label-bg:   rgba(255, 255, 255, 0.55);
    --sw-label-bg-hover: rgba(255, 255, 255, 0.75);
    --sw-dl-btn-bg:  rgba(255, 255, 255, 0.85);
    --sw-dl-btn-bg-hover: #ffffff;
}

/* --------------------------------------------------------------------------
   Top bar — back button + title. Only 50px from the very top to here,
   nothing else adds space above it.
   -------------------------------------------------------------------------- */
.sw-top-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 50px 0 20px;
}

/* --------------------------------------------------------------------------
   Search — same pill language as the hub, sized for a sub-page.
   Icon + input + arrow submit, matching the hub search shell.
   -------------------------------------------------------------------------- */
.sw-search-shell {
    width: 100%;
    height: 60px;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 12px 0 22px;
    background: var(--hub-soft);
    border-radius: 32px; /* rounded box type */
    transition: background-color .18s ease;
}

.sw-search-shell:focus-within {
    background: var(--hub-soft-hover);
}

.sw-search-shell .material-symbols-outlined {
    font-size: 24px;
    color: var(--hub-text);
    flex: 0 0 auto;
}

.sw-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--hub-title);
    font: inherit;
    font-size: 1.125rem;
}

.sw-search-input::placeholder {
    color: #a9a9b3;
    opacity: 1;
}

.sw-search-submit {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--hub-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease;
}

.sw-search-submit:hover {
    color: var(--hub-accent);
    background: var(--hub-soft-hover);
}

.sw-search-submit .material-symbols-outlined {
    font-size: 28px;
}

/* --------------------------------------------------------------------------
   Software grid — gradient icon card, name + download badge on a bottom
   label bar. Tap the whole card (or the badge) to download.
   -------------------------------------------------------------------------- */
.sw-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--hub-gap);
    width: 100%;
}

.sw-card {
    min-width: 0;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: linear-gradient(160deg, var(--sw-grad-start), var(--sw-grad-end));
    border-radius: var(--hub-radius); /* rounded box type, matches hub */
    cursor: pointer;
    transition: filter .18s ease;
}

.sw-card:hover,
.sw-card:focus-visible {
    filter: brightness(0.97);
}

.sw-card:focus-visible {
    outline: 2px solid var(--hub-accent);
    outline-offset: 2px;
}

.sw-icon-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Image fills the whole card top-to-bottom, cropped to center, width auto
   (object-fit: cover) — no inner white box around it. */
.sw-icon-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Plain overlay — no pill/box behind the text, just the name + a small
   download icon sitting on top of the image. */
.sw-label-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 22px 14px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.sw-name {
    min-width: 0;
    flex: 1;
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-dl-btn {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 0;
    background: transparent;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity .18s ease;
}

.sw-dl-btn:hover {
    opacity: 1;
}

.sw-dl-btn .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings: 'wght' 500;
}

/* --------------------------------------------------------------------------
   Responsive — same step-down pattern as the main category grid
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
    .sw-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .sw-top-bar {
        margin-top: 50px;
    }

    .sw-search-shell {
        height: 52px;
        padding: 0 8px 0 18px;
        margin-bottom: 18px;
    }

    .sw-search-submit {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }

    .sw-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sw-label-bar {
        padding: 18px 10px 10px;
    }

    .sw-name {
        font-size: 0.85rem;
    }

    .sw-dl-btn {
        width: 24px;
        height: 24px;
        flex: 0 0 24px;
    }

    .sw-dl-btn .material-symbols-outlined {
        font-size: 16px;
    }
}

@media (max-width: 460px) {
    .sw-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}