/**
 * Catálogo de Tosas — Frontend Gallery Styles
 *
 * Responsive grid: 4 columns (>1024px), 2 columns (600-1024px), 1 column (<600px)
 * Cards: 3:4 portrait aspect ratio for images
 */

/* ==========================================================================
   Gallery Wrapper
   ========================================================================== */

.ctosas-gallery-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 0;
}

/* ==========================================================================
   Breed Filter
   ========================================================================== */

.ctosas-breed-filter {
    margin-bottom: 2rem;
}

.ctosas-breed-filter ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ctosas-breed-filter li {
    margin: 0;
    padding: 0;
}

.ctosas-breed-filter a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 2rem;
    text-decoration: none;
    color: #333;
    font-size: 0.875rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ctosas-breed-filter a:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
    color: #111;
}

.ctosas-breed-filter__item--active a,
.ctosas-breed-filter li.ctosas-breed-filter__item--active a {
    background-color: #333;
    border-color: #333;
    color: #fff;
}

/* ==========================================================================
   Gallery Sections (grouped by estilo)
   ========================================================================== */

.ctosas-gallery-section {
    margin-bottom: 2.5rem;
}

.ctosas-gallery-section__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

/* ==========================================================================
   Gallery Grid — Responsive
   ========================================================================== */

.ctosas-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .ctosas-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 599px) {
    .ctosas-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Gallery Card
   ========================================================================== */

.ctosas-gallery-card {
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ctosas-gallery-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Image container with 3:4 aspect ratio */
.ctosas-gallery-card__media {
    position: relative;
    width: 100%;
    padding-top: 133.33%; /* 4/3 = 1.333 → 3:4 portrait */
    overflow: hidden;
    background-color: #f0f0f0;
}

.ctosas-gallery-card__media img,
.ctosas-gallery-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ctosas-gallery-card__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
}

/* Card info */
.ctosas-gallery-card__info {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ctosas-gallery-card__pet-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #222;
}

.ctosas-gallery-card__estilo {
    font-size: 0.8rem;
    color: #666;
}

.ctosas-gallery-card__date {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.125rem;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.ctosas-gallery-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.ctosas-gallery-empty p {
    font-size: 1rem;
    margin: 0;
}


/* ==========================================================================
   Lightbox
   ========================================================================== */

.ctosas-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.ctosas-lightbox--active {
    display: flex;
}

.ctosas-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ctosas-lightbox__close:hover,
.ctosas-lightbox__close:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

.ctosas-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.25rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s ease;
    will-change: transform;
}

/* Make media div clickable */
.ctosas-gallery-card__media[data-ctosas-lightbox] {
    cursor: zoom-in;
}
