/* =========================================================
   CNTS CONTENT RAIL
   v1.0.0
   ========================================================= */

.cnts-content-rail {
    width: 100%;
    color: var(--cnts-text-light, #b9b3aa);
    font-family: Arial, Helvetica, sans-serif;
}

.cnts-content-rail,
.cnts-content-rail * {
    box-sizing: border-box;
}

.cnts-rail-module {
    margin: 0 0 24px;
    padding: 22px;
    background: var(--cnts-charcoal, #151515);
    border: 1px solid var(--cnts-border, #333333);
}

.cnts-rail-module-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cnts-border, #333333);
}

.cnts-rail-module-header span {
    display: block;
    margin-bottom: 4px;
    color: var(--cnts-red, #d71920);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.cnts-rail-module-header h3 {
    margin: 0;
    color: var(--cnts-heading-light, #e8e3da);
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
}

.cnts-rail-event-list {
    display: grid;
}

.cnts-rail-event {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 13px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid #2c2c2c;
    color: inherit !important;
    text-decoration: none !important;
}

.cnts-rail-event:first-child {
    padding-top: 0;
}

.cnts-rail-event-date {
    min-height: 48px;
    padding: 7px 4px 5px;
    background: var(--cnts-black, #0b0b0b);
    border-left: 3px solid var(--cnts-red, #d71920);
    text-align: center;
}

.cnts-rail-event-date strong {
    display: block;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    font-weight: 900;
}

.cnts-rail-event-date span {
    display: block;
    margin-top: 4px;
    color: var(--cnts-muted-light, #8f8a82);
    font-size: .61rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .08em;
}

.cnts-rail-event-copy {
    min-width: 0;
}

.cnts-rail-event-title {
    display: block;
    color: var(--cnts-heading-light, #e8e3da);
    font-size: .88rem;
    line-height: 1.35;
    font-weight: 900;
}

.cnts-rail-event-location {
    display: block;
    margin-top: 5px;
    color: var(--cnts-muted-light, #8f8a82);
    font-size: .72rem;
    line-height: 1.35;
}

.cnts-rail-event:hover .cnts-rail-event-title,
.cnts-rail-news-item:hover strong {
    color: var(--cnts-red, #d71920);
}

.cnts-rail-more {
    display: inline-block;
    margin-top: 17px;
    color: var(--cnts-heading-light, #e8e3da) !important;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none !important;
}

.cnts-rail-more:hover {
    color: var(--cnts-red, #d71920) !important;
}

.cnts-rail-empty {
    margin: 0;
    color: var(--cnts-muted-light, #8f8a82);
    font-size: .82rem;
    line-height: 1.55;
}

.cnts-rail-news-list {
    display: grid;
}

.cnts-rail-news-item {
    display: block;
    padding: 13px 0;
    border-bottom: 1px solid #2c2c2c;
    text-decoration: none !important;
}

.cnts-rail-news-item:first-child {
    padding-top: 0;
}

.cnts-rail-news-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--cnts-muted-light, #8f8a82);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.cnts-rail-news-item strong {
    display: block;
    color: var(--cnts-heading-light, #e8e3da);
    font-size: .84rem;
    line-height: 1.4;
    font-weight: 800;
}

/* Helper class for any page section that uses the rail. */
.cnts-with-content-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 38px;
    align-items: start;
}

.cnts-with-content-rail > .cnts-content-rail {
    position: sticky;
    top: 110px;
}

/* Tablet */
@media (max-width: 1050px) {
    .cnts-with-content-rail {
        grid-template-columns: minmax(0, 1fr) 270px;
        gap: 26px;
    }

    .cnts-rail-module {
        padding: 18px;
    }

    .cnts-rail-event {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 11px;
    }
}

/* Mobile: rail becomes part of normal document flow. */
@media (max-width: 760px) {
    .cnts-with-content-rail {
        display: block;
    }

    .cnts-with-content-rail > .cnts-content-rail {
        position: static;
        margin-top: 30px;
    }
}


/* =========================================================
   EVENTS PAGE — MAIN LISTING + CONTENT RAIL
   ========================================================= */

.cnts-events-rail-section {
    padding: 36px 0 60px;
    background: var(--cnts-charcoal, #151515);
}

.cnts-events-with-rail {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 34px;
}

/* The event listing is already inside the CNTS container here,
   so do not let the Events Styles plugin create extra outer width. */
.cnts-events-with-rail .wpem-event-listings {
    max-width: none !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Two event cards per row inside the narrower main column. */
.cnts-events-with-rail .wpem-event-box-col {
    width: 50% !important;
    max-width: 50% !important;
    flex: 0 0 50% !important;
}

@media (max-width: 1050px) {

    .cnts-events-with-rail {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 24px;
    }

    .cnts-events-with-rail .wpem-event-box-col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

@media (max-width: 760px) {

    .cnts-events-rail-section {
        padding: 28px 0 46px;
    }

    .cnts-events-with-rail {
        display: block;
    }

    .cnts-events-with-rail .wpem-event-box-col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .cnts-events-with-rail > .cnts-content-rail {
        margin-top: 30px;
    }
}


/* =========================================================
   v1.1.0 — NATIVE CNTS EVENTS
   ========================================================= */

.cnts-events-with-rail .cnts-cm {
    width: 100%;
    max-width: none;
    margin: 0;
}

.cnts-events-with-rail .cnts-cm-event-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.cnts-events-with-rail .cnts-cm-event-card {
    min-width: 0;
}

@media (max-width: 1050px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   v1.1.1 — COMPACT NATIVE EVENT CARDS IN RAIL LAYOUT
   ========================================================= */

.cnts-events-with-rail .cnts-cm-event-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cnts-events-with-rail .cnts-cm-event-image {
    height: 165px;
    aspect-ratio: auto;
}

.cnts-events-with-rail .cnts-cm-event-image img {
    width: 100%;
    height: 165px;
    object-fit: cover;
}

.cnts-events-with-rail .cnts-cm-event-card-body {
    padding: 16px 17px 18px;
}

.cnts-events-with-rail .cnts-cm-event-date {
    margin-bottom: 6px;
    font-size: .68rem;
}

.cnts-events-with-rail .cnts-cm-event-card h3 {
    margin: 0 0 7px;
    font-size: 1.03rem;
    line-height: 1.2;
}

.cnts-events-with-rail .cnts-cm-event-location {
    font-size: .80rem;
    line-height: 1.4;
}

.cnts-events-with-rail .cnts-cm-attendees-compact {
    margin-top: 12px;
    padding-top: 12px;
    font-size: .72rem;
}

.cnts-events-with-rail .cnts-cm-event-card .cnts-cm-text-link {
    margin-top: 13px;
    font-size: .78rem;
}

@media (max-width: 1050px) {
    .cnts-events-with-rail .cnts-cm-event-image,
    .cnts-events-with-rail .cnts-cm-event-image img {
        height: 180px;
    }
}

@media (max-width: 760px) {
    .cnts-events-with-rail .cnts-cm-event-image,
    .cnts-events-with-rail .cnts-cm-event-image img {
        height: 210px;
    }

    .cnts-events-with-rail .cnts-cm-event-card-body {
        padding: 18px;
    }
}


/* =========================================================
   v1.1.2 — DENSER DESKTOP EVENT GRID
   ========================================================= */

/*
 * On wide desktop screens the native cards were still visually too large
 * because the main content area only used two columns.
 * Use three compact cards across when there is enough room.
 */
@media (min-width: 1280px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }

    .cnts-events-with-rail .cnts-cm-event-image,
    .cnts-events-with-rail .cnts-cm-event-image img {
        height: 125px;
    }

    .cnts-events-with-rail .cnts-cm-event-card-body {
        padding: 14px 15px 16px;
    }

    .cnts-events-with-rail .cnts-cm-event-card h3 {
        font-size: .94rem;
    }

    .cnts-events-with-rail .cnts-cm-event-location {
        font-size: .76rem;
    }
}

/*
 * Medium desktop / landscape tablet remains two columns.
 */
@media (min-width: 901px) and (max-width: 1279px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/*
 * Portrait tablet and mobile stack.
 */
@media (max-width: 900px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   v1.1.3 — MATCH /events-preview/ CARD SIZE ON LIVE EVENTS
   ========================================================= */

/*
 * The cards themselves were not the real problem.
 * /events-preview/ looks correct because its event grid has the full CNTS
 * content width. On /events/, the rail was taking that width away.
 *
 * Give the Events + Rail section a wider desktop canvas so the main event
 * grid can keep the same 3-card proportions as the preview page.
 */

.cnts-events-rail-section > .cnts-container {
    width: calc(100% - 48px) !important;
    max-width: 1600px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.cnts-events-with-rail {
    grid-template-columns: minmax(0, 1fr) 300px !important;
    gap: 30px !important;
}

/* Restore the native Community Manager card proportions. */
.cnts-events-with-rail .cnts-cm-event-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 22px !important;
}

.cnts-events-with-rail .cnts-cm-event-image {
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
}

.cnts-events-with-rail .cnts-cm-event-image img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
}

.cnts-events-with-rail .cnts-cm-event-card-body {
    padding: 22px !important;
}

.cnts-events-with-rail .cnts-cm-event-date {
    margin-bottom: 8px !important;
    font-size: .73rem !important;
}

.cnts-events-with-rail .cnts-cm-event-card h3 {
    margin: 0 0 9px !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.cnts-events-with-rail .cnts-cm-event-location {
    font-size: .88rem !important;
    line-height: normal !important;
}

.cnts-events-with-rail .cnts-cm-attendees-compact {
    margin-top: 18px !important;
    padding-top: 18px !important;
    font-size: .78rem !important;
}

.cnts-events-with-rail .cnts-cm-event-card .cnts-cm-text-link {
    margin-top: 18px !important;
    font-size: inherit !important;
}

/* Medium desktop / landscape tablet: two cards + rail. */
@media (max-width: 1250px) {
    .cnts-events-rail-section > .cnts-container {
        max-width: 1180px !important;
    }

    .cnts-events-with-rail {
        grid-template-columns: minmax(0, 1fr) 270px !important;
        gap: 24px !important;
    }

    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Portrait tablet: put the rail below so the event cards keep their shape. */
@media (max-width: 900px) {
    .cnts-events-rail-section > .cnts-container {
        width: calc(100% - 36px) !important;
    }

    .cnts-events-with-rail {
        display: block !important;
    }

    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .cnts-events-with-rail > .cnts-content-rail {
        margin-top: 30px !important;
    }
}

/* Mobile: one event per row. */
@media (max-width: 700px) {
    .cnts-events-with-rail .cnts-cm-event-grid {
        grid-template-columns: 1fr !important;
    }
}
