/* Core Grid Container Matrix remains untouched to keep page layout grid intact */
.events-loop-container {
    width: 100%;
    margin: 2rem 0;
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    align-items: stretch; 
}

/* Individual Card Structural Core Elements Layout */
.event-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0px;
    /*box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);*/
    overflow: hidden;
    display: flex;
    flex-direction: column; /* Stacked layout style rules for small mobile screen paths */
    height: 100%; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Horizontal alignment rules on tablet devices and desktop view screens */
@media (min-width: 768px) {
    .events-grid {
        /* FIX: If cards are wider, we increase the grid track size parameter to balance horizontal row spaces */
        grid-template-columns: 1fr; 
    }
    
    .event-card {
        /* FIX: Split card into 2 columns (Left Image space - Right Content space) */
        display: grid;
        grid-template-columns: 350px 1fr; 
    }
}

/* Left-Side Image Container Layout with Adaptive Height Controls */
.event-card-image {
    width: 100%;
    height: 240px; /* FIX: Restricts image container block to exactly 200px tall on mobile screens */
    position: relative;
    background-color: #f7fafc;
    flex-shrink: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .event-card-image {
        height: 100%; /* FIX: Completely fills the full vertical layout track of the horizontal card grid column cell */
    }
}

.event-card-image img {
    width: 100%;
    height: 100%!important;
    object-fit: cover; /* Prevents image proportions from looking squished or stretched */
}

/* Fallback Feature Image Placeholder Layout */
.event-placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
}

.event-placeholder-image svg {
    width: 48px;
    height: 48px;
    color: #fff;
    display: block;
}

/* Right-Side Card Text Content Wrapping Controller Area */
.event-card-content {
    padding: 1.25rem 1.25rem 0.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.event-title {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: clamp(2rem, 7vw, 2.55rem);
    color: #000;
    line-height: 1.3;
    font-family: var(--wp--preset--font-family--ivypresto-headline-serif) !important;
}

/* Side-by-Side Date and Time Grid Row Layout */
.event-datetime-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 0.5rem;
}

.event-datetime-row .event-meta-item {
    margin-bottom: 0;
    flex: 1 1 calc(50% - 0.5rem); 
    min-width: 130px;
}

.event-meta-item {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #000;
}

.meta-label {
    font-weight: 600;
    color: #000;
}

.event-card-content .event-location {
    margin-top: 0.5rem;
}

.event-map-link {
    color: var(--wp--preset--color--secondary);
    text-decoration: none;
}

.event-map-link:hover {
    text-decoration: underline;
}

.directions-tag {
    font-size: 1rem;
    font-weight: normal;
}

/* Descriptive Excerpt Constraints Wrapper Layout */
.event-excerpt {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #000;
    flex-grow: 1; 
}

.event-excerpt p {
    margin: 0;
}

/* Calendar Add Sync Target Elements Section Layout */
.event-calendar-export {
    padding: 0.75rem 0;
    border-top: 1px dashed #e2e8f0;
    font-size: 1rem;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.export-label {
    font-weight: 600;
    color: #000;
}

.export-links {
    display: flex;
    gap: 0.5rem;
}

.cal-link {
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #cbd5e0;
    color: #000;
    background-color: #f7fafc;
    transition: all 0.2s ease;
}

.cal-link:hover {
    background-color: #edf2f7;
    border-color: #a0aec0;
    color: var(--wp--preset--color--secondary);
}

/* Primary Action Button Area Layout Adjustments */
.event-actions {
    padding: 0 1.25rem 1.25rem 1.25rem;
    margin-top: auto; 
}

@media (min-width: 768px) {
    /* FIX: Integrates padding into the single right-hand tracking grid sector wrapper */
    .event-actions {
        padding: 0 1.25rem 1.25rem 1.25rem; 
    }
}

.event-button {
    display: inline-block;
    width: 100%;
    text-align: center;
    background-color: var(--wp--preset--color--secondary);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    transition: background-color 0.2s ease;
}

.event-button:hover {
    background-color: var(--wp--preset--color--primary);
    color: #ffffff;
}

/* Past Archive Variant Custom Overrides */
.past-event-card {
    opacity: 0.85;
    border-color: #cbd5e0;
}

.past-event-card .event-card-image {
    filter: grayscale(30%);
}

.event-archive-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #718096;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    z-index: 2;
}

.event-button.archive-button {
    background-color: #4a5568;
}

.event-button.archive-button:hover {
    background-color: #2d3748;
}

/* Pagination Section Layout Wrappers */
.events-pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.events-pagination ul.page-numbers {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    align-items: center;
}

.events-pagination ul.page-numbers li {
    margin: 0;
}

.events-pagination .page-numbers a,
.events-pagination .page-numbers span {
    display: inline-block;
    padding: 0.5rem 1rem;
    min-width: 40px;
    text-align: center;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.events-pagination .page-numbers a:hover {
    background-color: #edf2f7;
    border-color: #a0aec0;
    color: #2d3748;
}

.events-pagination .page-numbers .current {
    background-color: #3182ce;
    border-color: #3182ce;
    color: #ffffff;
}

/* Structural Header Elements Rules */
h2.events-section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

h2.events-section-title.past-title {
    color: #4a5568;
    border-top: 2px dashed #e2e8f0;
    padding-top: 2.5rem;
}

#past-events-ajax-wrapper {
    transition: opacity 0.25s ease-in-out;
}

#past-events-ajax-wrapper.is-loading {
    opacity: 0.4;
    pointer-events: none;
    cursor: wait;
}

.no-events-fallback {
    color: #718096;
    font-style: italic;
    text-align: center;
    padding: 2rem;
    width: 100%;
}


/* Block Theme Custom Sidebar Card Container Overrides */
.single-event-logistics-sidebar {
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 2rem;
}

.single-event-featured-media img {
    width: 100%;
    height: auto;
    max-height: 440px;
    object-fit: cover;
}

.single-event-block-main .wp-block-columns {
    align-items: flex-start;
}

/* Fix calendar layout hover animations inside single widgets track styles */
.single-event-sidebar-widget .cal-link:hover {
    background-color: #f7fafc !important;
    border-color: #a0aec0 !important;
    color: #1a202c !important;
}
