/**
 * Hawaii Magazine Content Lists Styles
 * Version: 3.0
 */

/* Base Layout */
.hm-content-list {
    /*margin: 40px 0;*/
    margin: 20px 0;
    clear: both;
}

.hm-list-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 30px;
    text-transform: uppercase;
    border-bottom: 3px solid #000;
    padding-bottom: 10px;
}

/* Grid Layout */
.hm-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.hm-grid-4 { grid-template-columns: repeat(4, 1fr); }
.hm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.hm-grid-2 { grid-template-columns: repeat(2, 1fr); }
.hm-grid-1 { grid-template-columns: 1fr; }

/* Card Base */
.hm-card {
    height: 100%;
}

/* Only use flex for list layouts */
.hm-list .hm-card {
    display: flex;
    flex-direction: column;
}

/* Grid cards should be block */
.hm-grid .hm-card {
    display: block;
}

.hm-card-grid {
    /*background: #fff;*/
    /*border-radius: 8px;*/
    border-radius:0;
    overflow: hidden;
    /*box-shadow: 0 2px 8px rgba(0,0,0,0.1);*/
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hm-card-grid:hover {
    transform: translateY(-2px);
    /*box-shadow: 0 4px 12px rgba(0,0,0,0.15);*/
}

/* List Layout */
.hm-list .hm-card-list {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e0e0e0;
}

.hm-list-left .hm-card-image {
    order: -1;
}

.hm-list-right .hm-card-image {
    order: 1;
}

.hm-list .hm-card-image {
    flex: 0 0 var(--image-width, 30%);
}

.hm-list .hm-card-content {
    flex: 1;
}

/* Card Image */
.hm-card-image {
    position: relative;
    overflow: hidden;
}

/* Complete the aspect ratio technique */
.hm-card-image.hm-aspect-ratio {
    height: 0;
    position: relative;
    overflow: hidden;
}

.hm-aspect-wrapper {
    position: relative;
    height: 0;
    overflow: hidden;
    /* padding-bottom is set inline by PHP */
}

.hm-aspect-wrapper a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.hm-aspect-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-card-image.hm-aspect-ratio .hm-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hm-card-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.hm-card:hover .hm-card-image img {
    transform: scale(1.05);
}

/* Blurred Background for Vertical Images */
.hm-image-bg {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    opacity: 0.3;
    z-index: -1;
}

/* Card Content - FIXED VERSION */
.hm-card-content {
    padding: 20px;
    /* REMOVED: flex: 1; */
    /* REMOVED: display: flex; */
    /* REMOVED: flex-direction: column; */
}

/* Only use flex for basic list layout, not grid */
.hm-list .hm-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.hm-grid .hm-card-content {
    /*padding: 15px;*/
    padding:0;
    /* Grid items should NOT be flex containers */
    display: block;
}

/* Keep the rest of your styles as-is, but ensure grid layout */
.hm-grid {
    display: grid !important;
    gap: 20px;
}

.hm-grid-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* Prevent flex from interfering with grid items */
.hm-grid .hm-card {
    display: block !important;
    height: 100%;
}

.hm-card-primary-category {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.hm-card-primary-category a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.hm-card-tags {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hm-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 12px;
    text-decoration: none;
    color: #666;
    transition: background 0.2s;
}

.hm-tag:hover {
    background: #e0e0e0;
    color: #333;
}

.hm-card-title {
    font-size: 20px;
    line-height: 1.3;
    margin: 0 0 10px;
}

.hm-card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.hm-card-title a:hover {
    color: #0073aa;
}

.hm-card-subtitle {
    /*font-size: 16px;*/
    font-size:13px;
    color: #666;
    margin-bottom: 10px;
    /*font-style: italic;*/
    font-style:normal;
}

.hm-card-meta {
    font-size: 14px;
    color: #999;
    /*margin-bottom: 12px;*/
    margin-bottom:5px;
    display: flex;
    gap: 10px;
}

.hm-card-author a {
    color: #999;
    text-decoration: none;
}

.hm-card-author a:hover {
    color: #666;
}

.hm-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
    flex-grow: 1;
}

.hm-card-categories {
    font-size: 13px;
    color: #999;
    margin-top: auto;
}

.hm-card-categories a {
    color: #999;
    text-decoration: none;
}

.hm-card-categories a:hover {
    color: #0073aa;
    text-decoration: underline;
}

/* Carousel */
.hm-carousel {
    position: relative;
    overflow: hidden;
    margin: 30px 0;
}

.hm-carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    gap: 20px;
}

.hm-carousel-slide {
    flex: 0 0 100%;
}

.hm-carousel[data-cards="2"] .hm-carousel-slide {
    flex: 0 0 calc(50% - 10px);
}

.hm-carousel[data-cards="3"] .hm-carousel-slide {
    flex: 0 0 calc(33.333% - 14px);
}

.hm-carousel[data-cards="4"] .hm-carousel-slide {
    flex: 0 0 calc(25% - 15px);
}

/* Carousel Controls */
.hm-carousel-prev,
.hm-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 2;
}

.hm-carousel-prev {
    left: 10px;
}

.hm-carousel-next {
    right: 10px;
}

.hm-carousel-prev:hover,
.hm-carousel-next:hover {
    background: #fff;
    border-color: #999;
}

.hm-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.hm-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.3s;
}

.hm-carousel-dot.active {
    background: #333;
}

/* Footer */
.hm-list-footer {
    text-align: right;
    /*margin-top: 20px;*/
    /*padding-top: 20px;*/
    padding-bottom:20px;
    /*border-top: 1px solid #e0e0e0;*/
}

.hm-archive-link {
    font-size: 16px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    text-transform: uppercase;
}

.hm-archive-link:hover {
    text-decoration: underline;
}

/* Pagination */
.hm-pagination {
    margin: 30px 0;
    text-align: center;
}

.hm-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    background: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 3px;
    transition: all 0.2s;
}

.hm-pagination .page-numbers:hover,
.hm-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hm-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hm-carousel[data-cards="4"] .hm-carousel-slide {
        flex: 0 0 calc(33.333% - 14px);
    }
}

@media (max-width: 768px) {
    .hm-grid-4,
    .hm-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .hm-list .hm-card-list {
        flex-direction: column;
    }
    
    .hm-list .hm-card-image {
        flex: none;
        width: 100%;
    }
    
    .hm-carousel[data-cards]:not([data-cards="1"]) .hm-carousel-slide {
        flex: 0 0 100%;
    }
    
    .hm-card-title {
        font-size: 18px;
    }
    
    .hm-card-excerpt {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .hm-grid-4,
    .hm-grid-3,
    .hm-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .hm-list-title {
        font-size: 22px;
    }
    
    .hm-carousel-prev,
    .hm-carousel-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    .hm-carousel-prev,
    .hm-carousel-next,
    .hm-carousel-dots,
    .hm-pagination {
        display: none;
    }
    
    .hm-carousel-track {
        display: block;
    }
    
    .hm-carousel-slide {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}
