/* Epicise Story Events - Frontend Styles */

.ese-story-events {
    width: 100%;
    padding: 40px 20px;
    background: #1a1a1a;
    border-radius: 8px;
}

/* Chapters Grid */
.ese-chapters-grid {
    display: grid !important;
    gap: 30px;
    margin-bottom: 40px;
    grid-template-columns: repeat(3, 1fr) !important;
}

.ese-columns-2 .ese-chapters-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

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

.ese-columns-4 .ese-chapters-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* Chapter Card */
.ese-chapter-card {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ese-chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 115, 170, 0.3);
    border-color: #0073aa;
}

.ese-chapter-image {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background: #1a1a1a;
    cursor: pointer; /* Ensure image itself shows pointer */
}

.ese-chapter-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer; /* Ensure image shows pointer */
}

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

.ese-no-image .ese-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4a4a4a;
    font-size: 60px;
}

.ese-no-image .dashicons {
    width: 60px;
    height: 60px;
    font-size: 60px;
}

.ese-chapter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 115, 170, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ese-chapter-card:hover .ese-chapter-overlay {
    opacity: 1;
}

.ese-view-posts {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ese-chapter-info {
    padding: 20px;
}

.ese-chapter-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.ese-chapter-count {
    color: #999;
    font-size: 14px;
    margin: 0;
}

/* Posts View */
.ese-posts-view {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ese-posts-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #3a3a3a;
}

.ese-back-btn {
    background: #3a3a3a;
    border: 1px solid #4a4a4a;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.ese-back-btn:hover {
    background: #0073aa;
    border-color: #0073aa;
}

.ese-back-btn .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.ese-current-chapter-title {
    color: #ffffff;
    font-size: 28px;
    margin: 0;
    font-weight: 700;
}

/* Posts Grid - Always 3 columns */
.ese-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* Post Card */
.ese-post-card {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ese-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 115, 170, 0.3);
    border-color: #0073aa;
}

.ese-post-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.ese-post-image {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background: #1a1a1a;
}

.ese-post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.ese-post-no-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4a4a4a;
    font-size: 40px;
}

.ese-post-no-image .dashicons {
    width: 40px;
    height: 40px;
    font-size: 40px;
}

.ese-post-info {
    padding: 20px;
}

.ese-post-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.ese-post-card:hover .ese-post-title {
    color: #0073aa;
}

/* No chapters message */
.ese-no-chapters {
    color: #999;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ese-columns-4 .ese-chapters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ese-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ese-story-events {
        padding: 30px 15px;
    }
    
    .ese-columns-3 .ese-chapters-grid,
    .ese-columns-4 .ese-chapters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ese-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .ese-current-chapter-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .ese-story-events {
        padding: 20px 10px;
    }
    
    .ese-chapters-grid,
    .ese-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ese-current-chapter-title {
        font-size: 20px;
    }
    
    .ese-chapter-title {
        font-size: 18px;
    }
    
    .ese-post-title {
        font-size: 16px;
    }
}

/* Loading State */
.ese-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.ese-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}
