/* features/static/features/css/front/catalog.css */
/* =============================================================
   Catalog tab of the card (features/front/catalog.html)
   Same tile language as the Media and Gallery tabs: rounded tile, picture on top,
   category / title / price / description below, a full-width action at the bottom.
   ============================================================= */

#catalog {
    --ct-accent: var(--primary-color, #0d6efd);
    --ct-on-accent: var(--on-primary, #fff);
    --ct-accent-soft: color-mix(in srgb, var(--ct-accent) 12%, #fff);
    --ct-border: #e9ecef;
    --ct-muted: #6c757d;
    --ct-radius: 12px;
}

/* ---------- category chips ---------- */
#catalog .ct-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 10px;
}

#catalog .ct-chips::-webkit-scrollbar {
    display: none;
}

#catalog .ct-chip {
    flex: 0 0 auto;
    padding: 5px 12px;
    border: 1px solid var(--ct-border);
    border-radius: 999px;
    background: #fff;
    color: inherit;
    font-size: 0.78rem;
    white-space: nowrap;
}

#catalog .ct-chip span {
    color: var(--ct-muted);
    font-size: 0.7rem;
}

#catalog .ct-chip.active {
    border-color: var(--ct-accent);
    background: var(--ct-accent-soft);
    color: var(--ct-accent);
    font-weight: 600;
}

#catalog .ct-chip:focus {
    outline: none;
}

#catalog .ct-chip:focus-visible {
    outline: 2px solid var(--ct-accent);
    outline-offset: 2px;
}

/* ---------- grid ---------- */
#catalog .ct-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 420px) {
    #catalog .ct-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

#catalog .ct-card[hidden] {
    display: none !important;
}

/* ---------- tile ---------- */
#catalog .ct-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

#catalog .ct-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

#catalog .ct-card.is-featured {
    border-color: #ffb648;
}

/* picture */
#catalog .ct-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: var(--ct-accent-soft);
    overflow: hidden;
}

#catalog .ct-media img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

#catalog .ct-card:hover .ct-media img {
    transform: scale(1.04);
}

#catalog .ct-icon {
    font-size: 2rem;
    color: var(--ct-accent);
    opacity: 0.7;
}

#catalog .ct-badges {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: calc(100% - 48px);
}

#catalog .ct-badge {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* the provider's badge: the card's own colour with a text colour that stays readable on it */
#catalog .ct-badge-custom {
    background: var(--ct-accent);
    color: var(--ct-on-accent);
}

#catalog .ct-badge-sale {
    background: #e03131;
    color: #fff;
}

#catalog .ct-featured {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ff9900;
    color: #fff;
    font-size: 0.7rem;
}

/* body */
#catalog .ct-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
    text-align: start;
}

#catalog .ct-category {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ct-accent);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

#catalog .ct-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--dark-color, #212529);
    unicode-bidi: plaintext;
}

#catalog .ct-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
}

#catalog .ct-price-now {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ct-accent);
}

#catalog .ct-price-old {
    font-size: 0.75rem;
    color: var(--ct-muted);
    text-decoration: line-through;
}

/* description: clamped, "Read more" opens it */
#catalog .ct-desc-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.6;
    color: #495057;
}

#catalog .ct-desc.open .ct-desc-text {
    display: block;
    overflow: visible;
}

#catalog .ct-desc-text p,
#catalog .ct-desc-text ul,
#catalog .ct-desc-text ol {
    margin: 0 0 6px;
}

#catalog .ct-desc-text h1,
#catalog .ct-desc-text h2,
#catalog .ct-desc-text h3 {
    margin: 6px 0 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

#catalog .ct-lead {
    font-weight: 500;
    color: #343a40;
}

#catalog .ct-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ct-accent);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

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

#catalog .ct-more i {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

#catalog .ct-more-close,
#catalog .ct-desc.open .ct-more-open {
    display: none;
}

#catalog .ct-desc.open .ct-more-close {
    display: inline;
}

#catalog .ct-desc.open .ct-more i {
    transform: rotate(180deg);
}

/* actions */
#catalog .ct-actions {
    display: flex;
    margin-top: auto;
    padding-top: 8px;
}

#catalog .ct-btn {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--ct-border);
    border-radius: 8px;
    background: #fff;
    color: #343a40;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

#catalog .ct-btn-primary {
    border-color: var(--ct-accent);
    background: var(--ct-accent);
    color: var(--ct-on-accent);
}

#catalog .ct-btn-primary:hover {
    background: color-mix(in srgb, var(--ct-accent) 88%, #000);
    color: var(--ct-on-accent);
}

#catalog .ct-btn-meta {
    opacity: 0.8;
    font-size: 0.68rem;
}

#catalog .ct-btn:focus-visible {
    outline: 2px solid var(--ct-accent);
    outline-offset: 2px;
}

/* no photo: a shorter band with the type icon instead of a big empty picture */
#catalog .ct-media:not(:has(img)) {
    aspect-ratio: 16 / 6;
}
