/* =========================================================
   FAYADH WEBSITE — SERVICES PAGE (services.html)
   Category tabs and the services of the selected category,
   built by js/components/service-catalog.js. The title band
   is the shared .title-band (base.css).
========================================================= */


/* =========================================================
   1. SECTION
========================================================= */

.catalog {
    padding-block: 40px 88px;

    background: var(--white);
}


/* =========================================================
   2. CATEGORY TABS
   One row; centred when it fits, scrolls sideways when not.
   Colours follow the category (same rules as the homepage
   cards: --category-bg as-is, --category-color as a tint).
========================================================= */

.catalog-tabs {
    display: flex;

    gap: 10px;

    padding: 4px 2px 12px;

    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

/* "Safe" centring: auto margins centre the row when it fits,
   and leave the start visible when it scrolls. */

.catalog-tabs > :first-child {
    margin-inline-start: auto;
}

.catalog-tabs > :last-child {
    margin-inline-end: auto;
}

.catalog-tab {
    padding: 6px 18px 6px 6px;

    display: inline-flex;
    align-items: center;

    flex-shrink: 0;

    gap: 10px;

    background: var(--white);
    color: var(--heading);

    border: 1px solid var(--border);
    border-radius: 999px;

    font-size: 14px;
    font-weight: 700;

    white-space: nowrap;

    scroll-snap-align: start;

    transition: var(--transition);
}

html[dir="rtl"] .catalog-tab {
    padding: 6px 6px 6px 18px;
}

.catalog-tab:hover {
    border-color: var(--primary-light);

    box-shadow: var(--shadow-sm);
}

.catalog-tab[aria-selected="true"] {
    background: var(--primary);
    color: var(--white);

    border-color: var(--primary);

    box-shadow: var(--shadow-md);
}

.catalog-tab-icon {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    /* Fallback for browsers without color-mix(). */
    background: var(--background);
    background: var(
        --category-bg,
        color-mix(in srgb, var(--category-color, var(--primary)) 13%, var(--white))
    );

    border-radius: 50%;
}

.catalog-tab[aria-selected="true"] .catalog-tab-icon {
    background: var(--white);
}

.catalog-tab-icon img {
    width: 22px;
    height: 22px;

    object-fit: contain;
}


/* =========================================================
   3. SERVICE GRID & CARDS
========================================================= */

.catalog-panel {
    margin-top: 28px;
}

.catalog-panel:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 6px;

    border-radius: 12px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));

    gap: 20px;

    list-style: none;
}

.service-card {
    height: 100%;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--white);

    border: 1px solid var(--border);
    border-radius: 18px;

    transition: var(--transition);
}

a.service-card:hover {
    border-color: var(--primary-light);

    box-shadow: var(--shadow-md);

    transform: translateY(-3px);
}


/* Photo (cover), or an icon shown smaller and centred */

.service-media {
    aspect-ratio: 4 / 3;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--background);
}

.service-media img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.service-media.is-icon {
    background: var(--primary-light);
}

.service-media.is-icon img {
    width: 42%;
    height: 42%;

    object-fit: contain;
}


/* Name, rating, call to action */

.service-body {
    flex: 1;

    padding: 16px 18px 18px;

    display: flex;
    flex-direction: column;

    gap: 8px;
}

.service-name {
    display: -webkit-box;

    overflow: hidden;

    color: var(--heading);

    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.service-rating {
    display: inline-flex;
    align-items: center;

    gap: 4px;

    color: var(--heading);

    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 700;
}

.service-star {
    color: var(--highlight);

    font-size: 15px;
    line-height: 1;
}

.service-rating-count {
    color: var(--text);

    font-weight: 500;
}

.service-book {
    margin-top: auto;
    padding-top: 6px;

    display: inline-flex;
    align-items: center;

    gap: 6px;

    color: var(--primary);

    font-size: 14px;
    font-weight: 700;
}

a.service-card:hover .service-book .button-arrow {
    transform: translateX(3px);
}

html[dir="rtl"] a.service-card:hover .service-book .button-arrow {
    transform: scaleX(-1) translateX(3px);
}


/* =========================================================
   4. LOADING PLACEHOLDERS
========================================================= */

.service-card.is-skeleton .service-media,
.skeleton-line {
    background: linear-gradient(
        90deg,
        var(--background) 25%,
        var(--border) 50%,
        var(--background) 75%
    );
    background-size: 200% 100%;

    animation: catalog-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line {
    display: block;

    width: 80%;
    height: 14px;

    border-radius: 7px;
}

.skeleton-line.is-short {
    width: 45%;
}

@keyframes catalog-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {

    .service-card.is-skeleton .service-media,
    .skeleton-line {
        animation: none;
    }

}


/* =========================================================
   5. STATUS (empty / error) & LOAD MORE
========================================================= */

.catalog-status {
    max-width: 460px;

    margin-inline: auto;
    padding-block: 32px;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 16px;

    color: var(--text);

    font-size: 16px;
    line-height: 1.7;

    text-align: center;
}

.catalog-status[hidden],
.catalog-status [hidden] {
    display: none;
}

.catalog-more {
    margin-top: 36px;

    display: flex;
    justify-content: center;
}

.catalog-more .button[hidden] {
    display: none;
}

.catalog-more .button:disabled {
    cursor: progress;

    opacity: 0.7;
}


/* =========================================================
   6. RESPONSIVE
========================================================= */

@media (max-width: 600px) {

    .catalog {
        padding-block: 28px 64px;
    }

    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 12px;
    }

    .service-body {
        padding: 12px 12px 14px;
    }

    .service-name {
        font-size: 14px;
    }

    .service-book {
        font-size: 13px;
    }

}
