/*
Theme Name: Zag Store
Theme URI: https://zagstore.app
Description: Zag Store custom child theme for Blocksy.
Author: Zag Store
Template: blocksy
Version: 0.1.0
Text Domain: zagstore
*/

/* Zag Store — Design Foundation */

:root {
    --zag-background: #0b0b10;
    --zag-surface: #171720;
    --zag-accent: #8b5cf6;
    --zag-text: #f5f5f7;
    --zag-muted: #9898a6;
    --zag-radius: 18px;
}

body {
    background-color: var(--zag-background);
    color: var(--zag-text);
    -webkit-font-smoothing: antialiased;
}

body,
button,
input,
textarea,
select {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
        "Segoe UI", sans-serif;
}

a {
    transition: color 180ms ease;
}

a:hover {
    color: var(--zag-accent);
}

/* Zag Store homepage */

.zag-home {
    min-height: 100vh;
    background: var(--zag-background);
    color: var(--zag-text);
}

.zag-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 75vh;
    padding: 100px 24px;
    text-align: center;
}

.zag-hero__content {
    max-width: 780px;
}

.zag-hero__eyebrow {
    color: var(--zag-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.zag-hero h1 {
    margin: 24px 0;
    color: var(--zag-text);
    font-size: clamp(48px, 7vw, 88px);
    font-weight: 750;
    letter-spacing: -0.055em;
    line-height: 1.05;
}

.zag-hero h1 span {
    color: var(--zag-accent);
}

.zag-hero p {
    max-width: 560px;
    margin: 0 auto 32px;
    color: var(--zag-muted);
    font-size: 17px;
    line-height: 1.7;
}

.zag-hero__button {
    display: inline-flex;
    padding: 14px 28px;
    border-radius: 12px;
    background: var(--zag-accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.zag-hero__button:hover {
    background: #a78bfa;
    color: #fff;
}

.zag-discover {
    padding: 80px 24px 120px;
    text-align: center;
}

.zag-discover h2 {
    color: var(--zag-text);
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -0.035em;
}

.zag-discover p {
    color: var(--zag-muted);
}

/* Zag Store — Apps catalogue */
.zag-apps-page {
    min-height: 75vh;
    background: #0b0b10;
    color: #f5f5f7;
    padding: 100px 24px;
    text-align: center;
}

.zag-apps-page h1 {
    color: #f5f5f7;
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.1;
    margin: 0 0 20px;
}

.zag-apps-page p {
    color: #9898a6;
    font-size: 18px;
    line-height: 1.6;
}

/* Zag Store — Apps search */
.zag-apps-search {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 580px;
    margin: 42px auto 0;
    padding: 0 20px;
    background: #171720;
    border: 1px solid #30303d;
    border-radius: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.zag-apps-search:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.zag-apps-search svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    color: #9898a6;
}

.zag-apps-search input {
    flex: 1;
    min-width: 0;
    height: 58px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    color: #f5f5f7;
    font: inherit;
    font-size: 16px;
}

.zag-apps-search input::placeholder {
    color: #9898a6;
}

.zag-apps-search input:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}

/* Zag Store — Apps category filters */
.zag-apps-categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px auto 0;
}

.zag-apps-categories button {
    appearance: none;
    padding: 11px 20px;
    border: 1px solid #30303d;
    border-radius: 999px;
    background: #171720;
    color: #9898a6;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.zag-apps-categories button:hover {
    background: #242432;
    color: #f5f5f7;
}

.zag-apps-categories button.is-active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #ffffff;
}

.zag-apps-categories button:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 3px;
}

/* Zag Store — App catalogue */
.zag-apps-catalogue {
    width: 100%;
    max-width: 1200px;
    margin: 64px auto 0;
    text-align: left;
}

.zag-apps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.zag-app-card {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 26px;
    background: #171720;
    border: 1px solid #30303d;
    border-radius: 22px;
    transition: border-color 0.2s, transform 0.2s;
}

.zag-app-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-3px);
}

.zag-app-card-icon {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 17px;
    background: linear-gradient(135deg, #8b5cf6, #4f46e5);
}

.zag-app-card-content {
    min-width: 0;
}

.zag-app-card-category {
    display: block;
    margin-bottom: 8px;
    color: #a78bfa;
    font-size: 12px;
    font-weight: 600;
}

.zag-app-card h2 {
    margin: 0 0 10px;
    color: #f5f5f7;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.025em;
}

.zag-app-card p {
    margin: 0 0 18px;
    color: #9898a6;
    font-size: 14px;
    line-height: 1.6;
}

.zag-app-card-action {
    color: #a78bfa;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 1000px) {
    .zag-apps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .zag-apps-grid {
        grid-template-columns: 1fr;
    }

    .zag-app-card {
        padding: 20px;
    }
}

/* Zag Store — Empty app catalogue */
.zag-apps-empty {
    grid-column: 1 / -1;
    padding: 72px 24px;
    text-align: center;
    background: #171720;
    border: 1px solid #30303d;
    border-radius: 22px;
}

.zag-apps-empty h2 {
    margin: 0 0 12px;
    color: #f5f5f7;
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.025em;
}

.zag-apps-empty p {
    margin: 0;
    color: #9898a6;
    font-size: 15px;
    line-height: 1.6;
}

/* Zag Store — Real app icons */
.zag-app-card-icon {
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.zag-app-card-icon img.zag-app-icon-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Repository icons can contain transparent artwork: never tint them purple. */
.zag-repository-app-card .zag-app-card-icon {
    position: relative;
    background: transparent;
}

.zag-repository-app-card .zag-app-card-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(145deg, #30313c, #20212b);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-sizing: border-box;
}

.zag-repository-app-card .zag-app-card-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #b4a4e7;
    opacity: 0.9;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Crect x='22' y='22' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='38' y='22' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='22' y='38' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='38' y='38' width='12' height='12' rx='3' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Crect x='22' y='22' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='38' y='22' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='22' y='38' width='12' height='12' rx='3' fill='black'/%3E%3Crect x='38' y='38' width='12' height='12' rx='3' fill='black'/%3E%3C/svg%3E");
    pointer-events: none;
}

.zag-repository-app-card .zag-app-card-icon:has(img:not([hidden]))::before,
.zag-repository-app-card .zag-app-card-icon:has(img:not([hidden]))::after {
    display: none;
}

.zag-repository-app-card .zag-app-card-icon img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.zag-repository-app-card .zag-app-card-icon img[hidden] {
    display: none;
}

/* Zag Store — Individual app pages */
.zag-app-detail {
    text-align: left;
}

.zag-app-detail-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.zag-app-back {
    display: inline-block;
    margin-bottom: 48px;
    color: #a78bfa;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.zag-app-back:hover {
    color: #c4b5fd;
}

.zag-app-detail-header {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 64px;
}

.zag-app-detail-header .zag-app-card-icon {
    width: 128px;
    height: 128px;
    border-radius: 28px;
}

.zag-app-detail-header h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 56px);
    letter-spacing: -0.04em;
}

.zag-app-description {
    padding: 36px;
    background: #171720;
    border: 1px solid #30303d;
    border-radius: 22px;
}

.zag-app-description h2 {
    margin: 0 0 20px;
    color: #f5f5f7;
    font-size: 24px;
}

.zag-app-description p {
    color: #9898a6;
    font-size: 16px;
    line-height: 1.8;
}

@media (max-width: 650px) {
    .zag-app-detail-header {
        gap: 20px;
    }

    .zag-app-detail-header .zag-app-card-icon {
        width: 88px;
        height: 88px;
        border-radius: 20px;
    }

    .zag-app-description {
        padding: 24px;
    }
}

/* Zag Store — App Information */

.zag-app-information {
    margin-top: 32px;
    padding: 28px;
    background: var(--zag-surface, #171720);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--zag-radius, 18px);
}

.zag-app-information h2 {
    margin: 0 0 20px;
    color: var(--zag-text, #f5f5f7);
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -0.5px;
}

.zag-app-information-list {
    margin: 0;
}

.zag-app-information-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.zag-app-information-row:first-child {
    padding-top: 0;
}

.zag-app-information-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.zag-app-information-row dt {
    color: var(--zag-muted, #9898a6);
    font-size: 14px;
    font-weight: 500;
}

.zag-app-information-row dd {
    margin: 0;
    color: var(--zag-text, #f5f5f7);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    .zag-app-information {
        padding: 22px;
    }
}

/* Zag Store — Ensure filtered app cards disappear */
.zag-app-card[hidden] {
    display: none !important;
}

/* Zag Store — Hide empty state when results exist */
#zag-apps-no-results[hidden] {
    display: none !important;
}

/* Zag Store — App catalogue pagination */
.zag-apps-pagination {
    display: flex;
    justify-content: center;
    margin: 48px auto 64px;
}

.zag-apps-pagination:has(#zag-apps-load-more[hidden]) {
    display: none;
}

#zag-apps-load-more {
    appearance: none;
    min-width: 180px;
    padding: 14px 32px;
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 14px;
    background: #171720;
    color: #f5f5f7;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

#zag-apps-load-more:hover:not(:disabled) {
    background: #242034;
    border-color: #8b5cf6;
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.18);
    transform: translateY(-2px);
}

#zag-apps-load-more:active:not(:disabled) {
    transform: translateY(0);
}

#zag-apps-load-more:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 4px;
}

#zag-apps-load-more:disabled {
    opacity: 0.6;
    cursor: wait;
}

#zag-apps-load-more[hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    #zag-apps-load-more {
        transition: none;
    }
}
