/* Uniform Poem Card Sizing - Ensures all poem cards are exactly the same size */

/* Override existing poem card styles to ensure uniform sizing */
.poem-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
    margin-top: 2rem;
    align-items: stretch; /* Ensures all cards stretch to same height */
}

.poem-card {
    background: rgba(255, 248, 240, 0.9);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(160, 82, 45, 0.1);
    
    /* Fixed dimensions for uniform sizing */
    height: 480px !important; /* Fixed total height */
    display: flex !important;
    flex-direction: column !important;
    min-width: 300px;
    max-width: 400px;
}

.poem-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(139, 69, 19, 0.2);
}

/* Fixed image section */
.poem-image {
    height: 200px !important; /* Fixed height */
    min-height: 200px !important;
    max-height: 200px !important;
    background: linear-gradient(135deg, #f4f1e8 0%, #e8dcc0 100%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0; /* Prevent shrinking */
}

.poem-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.poem-card:hover .poem-image img {
    transform: scale(1.05);
}

.poem-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: rgba(139, 69, 19, 0.3);
    background: linear-gradient(135deg, rgba(255, 248, 240, 0.8) 0%, rgba(232, 220, 192, 0.8) 100%);
}

/* Fixed content section */
.poem-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1; /* Takes remaining space */
    min-height: 280px; /* Fixed minimum content height */
    max-height: 280px; /* Fixed maximum content height */
    overflow: hidden;
}

/* Fixed title height */
.poem-title {
    font-size: 1.3rem;
    color: #3d2914;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    min-height: 50px; /* Fixed title height */
    max-height: 50px; /* Fixed title height */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    line-clamp: 2; /* Standard property */
    -webkit-box-orient: vertical;
}

/* Fixed excerpt container */
.poem-excerpt-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 120px; /* Fixed excerpt area */
    max-height: 120px; /* Fixed excerpt area */
    margin-bottom: 1rem;
}

.poem-excerpt {
    color: #5a4037;
    line-height: 1.6;
    font-size: 0.95rem;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5; /* Limit to 5 lines */
    line-clamp: 5; /* Standard property */
    -webkit-box-orient: vertical;
    margin: 0;
}

/* Fixed meta section */
.poem-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #8b4513;
    border-top: 1px solid rgba(160, 82, 45, 0.1);
    padding-top: 1rem;
    margin-bottom: 1rem;
    min-height: 40px; /* Fixed meta height */
    max-height: 40px; /* Fixed meta height */
    flex-shrink: 0;
}

.poem-author {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.poem-date {
    opacity: 0.8;
    white-space: nowrap;
}

/* Fixed actions section */
.poem-actions {
    margin-top: auto; /* Push to bottom */
    flex-shrink: 0;
    min-height: 50px; /* Fixed actions height */
    max-height: 50px; /* Fixed actions height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.read-more-btn {
    background: #8b4513;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.read-more-btn:hover {
    background: #a0522d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
}

/* Category badge positioning */
.poem-category {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(139, 69, 19, 0.9);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .poem-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .poem-card {
        height: 450px !important; /* Slightly smaller on mobile */
        min-width: 280px;
        max-width: 100%;
    }
    
    .poem-content {
        padding: 1.2rem;
        min-height: 250px;
        max-height: 250px;
    }
    
    .poem-title {
        font-size: 1.2rem;
        min-height: 45px;
        max-height: 45px;
    }
    
    .poem-excerpt-container {
        min-height: 100px;
        max-height: 100px;
    }
    
    .poem-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }
}

@media (max-width: 480px) {
    .poem-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .poem-card {
        height: 420px !important;
        min-width: 260px;
    }
    
    .poem-content {
        padding: 1rem;
        min-height: 220px;
        max-height: 220px;
    }
    
    .poem-excerpt-container {
        min-height: 80px;
        max-height: 80px;
    }
    
    .poem-excerpt {
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}

/* Ensure poems grid container alignment */
.poems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    align-items: stretch;
}

/* For poems page specifically */
.poems-container .poem-card {
    height: 480px !important;
}

/* Ensure consistent sizing across all pages */
.poems-section .poem-card,
.poems-container .poem-card,
.poem-cards .poem-card {
    height: 480px !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Loading and error states for uniform sizing */
.loading-spinner,
.no-poems-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #8b4513;
}

/* View all card matching height */
.view-all-card {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.view-all-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(160, 82, 45, 0.1) 100%);
    border: 2px dashed rgba(139, 69, 19, 0.3);
    border-radius: 15px;
    text-decoration: none;
    color: #8b4513;
    transition: all 0.3s ease;
    min-height: 150px;
    justify-content: center;
}

.view-all-link:hover {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.15) 0%, rgba(160, 82, 45, 0.15) 100%);
    border-color: rgba(139, 69, 19, 0.5);
    transform: translateY(-2px);
}

/* Accessibility improvements */
.poem-card:focus {
    outline: 3px solid rgba(139, 69, 19, 0.5);
    outline-offset: 2px;
}

.poem-card:focus-visible {
    outline: 3px solid #8b4513;
    outline-offset: 2px;
}
