/**
 * Zamseed Events Widget
 *
 * @package Zamseed
 * @since 1.0.0
 */

/* ==========================================================================
   Section Header
   ========================================================================== */

.zs-events__header {
    display: flex;
    flex-direction: column;
    align-items: var(--zs-header-items, center);
    gap: 16px;
    max-width: 740px;
    margin-left: var(--zs-header-margin-left, auto);
    margin-right: var(--zs-header-margin-right, auto);
    margin-bottom: 60px;
    text-align: var(--zs-header-text-align, center);
}

.zs-events__eyebrow {
    display: block;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    /* Same gold, stated as the token so a palette change reaches it. */
    color: var(--zs-accent, #c48c33);
}

.zs-events__header-title {
    margin: 0;
    font-family: var(--zs-font-serif, 'Cormorant Garamond', serif);
    /* Section heading role. Figma 11096:35835 is 48/50; this was a flat 40/1.1. */
    font-size: var(--zs-heading, clamp(2rem, 3.33vw, 3rem));
    font-weight: 700;
    line-height: var(--zs-heading-lh, 1.083);
    color: var(--zs-primary, #2d5a27);
}

.zs-events__header-desc {
    margin: 0;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    color: #555555;
}

/* ==========================================================================
   View All Button
   ========================================================================== */

.zs-events__view-all-wrap {
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

/* Outlined pill, per Figma 11140:10866: 1.6px green rule, no fill, no shadow,
   50px tall. It read as a solid primary button here, which gave the section two
   competing filled CTAs against the frame's single quiet one. The fill is kept
   for hover/focus so the affordance still reads on interaction. */
.zs-events__view-all {
    --zs-events-view-all-hover-y: -2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 2px 18px;
    border: 1.6px solid var(--zs-primary, #2d5a27);
    border-radius: var(--zs-radius-pill, 999px);
    background-color: transparent;
    color: var(--zs-primary, #2d5a27);
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition:
        transform var(--zs-motion-fast, 220ms) var(--zs-ease-hover, cubic-bezier(0.2, 0.8, 0.2, 1)),
        background-color var(--zs-motion-fast, 220ms) var(--zs-ease-hover, cubic-bezier(0.2, 0.8, 0.2, 1)),
        border-color var(--zs-motion-fast, 220ms) var(--zs-ease-hover, cubic-bezier(0.2, 0.8, 0.2, 1)),
        color var(--zs-motion-fast, 220ms) var(--zs-ease-hover, cubic-bezier(0.2, 0.8, 0.2, 1)),
        box-shadow var(--zs-motion-fast, 220ms) var(--zs-ease-hover, cubic-bezier(0.2, 0.8, 0.2, 1));
}

.zs-events__view-all:hover,
.zs-events__view-all:focus-visible {
    transform: translateY(var(--zs-events-view-all-hover-y));
    border-color: var(--zs-primary-dark, #1f3f1d);
    background-color: var(--zs-primary-dark, #1f3f1d);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(45, 90, 39, 0.22);
}

.zs-events__view-all:focus-visible {
    outline: 3px solid rgba(196, 140, 51, 0.45);
    outline-offset: 3px;
}

.zs-events__view-all-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.zs-events__view-all-icon svg,
.zs-events__view-all-icon i,
.zs-events__view-all-icon img {
    width: 1em;
    height: 1em;
    font-size: 1em;
    object-fit: contain;
}

/* ==========================================================================
   List
   ========================================================================== */

/* A real <ul>. The reset is needed because Elementor pages inherit the theme's
   list styling, which would otherwise add bullets and an indent. */
/* 1040, not the 1200 the wider sections use — the frame gives this section its
   own narrower container (Figma 11096:35830, x=200 w=1040). The measure lives
   on the content rather than on a percentage width on the widget. */
.zs-events__list,
.zs-events__view-all-wrap {
    width: min(var(--zs-events-content-max, 1040px), calc(100% - var(--zs-container-padding, 20px) * 2));
    margin-inline: auto;
}

.zs-events__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /*
     * margin-block, not the margin shorthand.
     *
     * The reset exists to drop the browser's default list margin, which is
     * vertical. Written as `margin: 0` it also reset the inline auto margins
     * the measure rule above sets — same specificity, later in the file — so
     * the list took its 1040px measure but stayed hard against the left edge
     * of the 1152px widget: 144px of gutter on the left, 256px on the right.
     *
     * .zs-events__view-all-wrap shares that measure rule and has no reset of
     * its own, which is why the CTA was landing at the correct x=200 while the
     * cards under it sat 56px to the left.
     */
    margin-block: 0;
    padding: 0;
    list-style: none;
}

.zs-events__item {
    display: flex;
    width: 100%;
    margin: 0;
}

/* ==========================================================================
   Card
   ========================================================================== */

.zs-events__card {
    display: flex;
    align-items: center;
    gap: 60px;
    padding: 29px 33px;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease;
    width: 100%;
}

a.zs-events__card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

/* ==========================================================================
   Date Column
   ========================================================================== */

.zs-events__date-col {
    flex: 0 0 154px;
    width: 154px;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    border-right-style: solid;
    display: flex;
    align-items: center;
    align-self: stretch;
    padding-right: 40px;
}

/* Single date or same-month range */
.zs-events__date-single {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    width: 100%;
}

/* Cross-month range */
.zs-events__date-range {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.zs-events__date-part {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    flex: 1;
}

.zs-events__date-sep {
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 18px;
    font-weight: 600;
    color: #555555;
    padding-top: 10px;
    flex-shrink: 0;
}

/* Day number */
.zs-events__day {
    font-family: var(--zs-font-serif, 'Cormorant Garamond', serif);
    font-size: 44px;
    font-weight: 700;
    line-height: 1;
    color: var(--zs-primary, #2d5a27);
}

/* Month label */
.zs-events__month {
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.053em;
    text-transform: uppercase;
    color: #555555;
}

/* ==========================================================================
   Content Column
   ========================================================================== */

.zs-events__content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 0 0;
    min-width: 0;
}

/* Now a real heading element (h2–h5) by default, so the margins WordPress
   gives headings have to be reset here. */
.zs-events__title {
    margin: 0;
    font-family: var(--zs-font-serif, 'Cormorant Garamond', serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--zs-primary, #2d5a27);
}

.zs-events__desc {
    margin: 0;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    color: #555555;
}

/* ==========================================================================
   Location / Meta Column
   ========================================================================== */

.zs-events__meta-col {
    flex: 0 0 160px;
    width: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.zs-events__location {
    display: flex;
    /* flex-start, not center: once the text wraps to two or three lines the
       pin should sit against the first line rather than float mid-block. */
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.zs-events__location-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    /* centres the pin on the first text line now that align-items is
       flex-start: (14px * 1.6 - 16px) / 2 */
    margin-block-start: 3px;
    color: #555555;
}

.zs-events__location-text {
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: #555555;
    /*
     * Was white-space: nowrap. The meta column is a fixed 160px, so a
     * location longer than that did not clip or wrap — it ran straight past
     * the viewport and gave the whole page a horizontal scrollbar. Short
     * towns ("Ndola", "Lusaka") hid it; "MAFAFA Farm, Mpongwe, Copperbelt
     * Province" is 311px and overflowed at every width below 1440.
     * Wrapping inside the column is the behaviour a fixed column implies.
     */
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

/* Deliberate, not a blank band: this is what the section publishes whenever
   the repeater is empty or the Events CPT returns nothing. */
.zs-events__empty {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 40px;
    background-color: var(--zs-warm, #fdfcf9);
    border: 1px solid var(--zs-border, rgba(0, 0, 0, 0.08));
    border-radius: 12px;
    text-align: center;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    color: #555555;
}

.zs-events__empty-message {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--zs-text, #1c1c1c);
}

.zs-events__empty-note {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555555;
}

/* Editor-only diagnostic — never reaches a visitor. */
.zs-events__empty-hint {
    margin: 8px 0 0;
    padding-top: 12px;
    border-top: 1px dashed var(--zs-accent, #c48c33);
    font-size: 13px;
    line-height: 1.5;
    color: var(--zs-accent-text, #9a6c1f);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .zs-events__header-title {
        font-size: 32px;
    }

    .zs-events__card {
        gap: 32px;
    }

    .zs-events__date-col {
        flex: 0 0 110px;
        width: 110px;
        padding-right: 24px;
    }

    .zs-events__day {
        font-size: 36px;
    }

    .zs-events__month {
        font-size: 14px;
    }

    .zs-events__meta-col {
        flex: 0 0 120px;
        width: 120px;
    }
}

@media (max-width: 680px) {
    .zs-events__header {
        margin-bottom: 40px;
    }

    .zs-events__header-title {
        font-size: 26px;
    }

    .zs-events__view-all-wrap {
        margin-top: 40px;
    }

    .zs-events__view-all {
        width: 100%;
        max-width: 320px;
        text-align: center;
    }

    .zs-events__card {
        flex-wrap: wrap;
        gap: 20px;
        padding: 20px;
    }

    .zs-events__date-col {
        flex: 0 0 auto;
        width: auto;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding-right: 0;
        padding-bottom: 16px;
        width: 100%;
        align-self: auto;
    }

    .zs-events__date-single,
    .zs-events__date-range {
        flex-direction: row;
        align-items: baseline;
        gap: 12px;
    }

    .zs-events__date-part {
        flex-direction: row;
        align-items: baseline;
        gap: 6px;
    }

    .zs-events__day {
        font-size: 30px;
    }

    .zs-events__month {
        font-size: 14px;
    }

    .zs-events__content {
        flex: 1 1 100%;
    }

    .zs-events__meta-col {
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zs-events__view-all {
        transition: none !important;
    }

    .zs-events__view-all:hover,
    .zs-events__view-all:focus-visible {
        transform: none !important;
    }
}

/* ------------------------------------------------------------------
   Month-only entries.

   Some Zambian traditional ceremonies are set by a lunar or seasonal
   window rather than a calendar day, so the listing shows the month and
   says plainly that the day is not confirmed. Without the note a lone
   "OCT" reads as a date the organisers have not actually given.
   ------------------------------------------------------------------ */
.zs-events__date-single--month-only {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.zs-events__date-single--month-only .zs-events__month {
    font-size: var(--zs-events-day-size, 28px);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.zs-events__year {
    font-size: var(--zs-font-size-body-sm, 14px);
    font-weight: 600;
    opacity: 0.72;
}

.zs-events__date-note {
    margin-block-start: 6px;
    max-width: 11ch;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.74;
}

.zs-events__date-col--month-only {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Event category label — the zs_event_type term, shown above the title so a
   card says what kind of event it is before the reader parses the name. */
.zs-events__type {
    display: inline-block;
    margin-block-end: 6px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--zs-accent, #c8882a);
}

/* Homepage refinement. Match the saved Elementor control specificity so
   desktop padding/gaps cannot override the compact mobile composition. */
.home .elementor .elementor-element .zs-events .zs-events__header {
    gap: 12px;
    margin-bottom: 32px;
}
.home .elementor .elementor-element .zs-events .zs-events__list {
    width: min(1040px, calc(100% - 32px));
    gap: 16px;
}
.home .elementor .elementor-element .zs-events .zs-events__card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: start;
    column-gap: 24px;
    row-gap: 8px;
    padding: 24px;
    border: 1px solid rgba(45, 90, 39, 0.14);
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(45, 90, 39, 0.025);
    transition: border-color 180ms ease-out, box-shadow 180ms ease-out;
}
.home .elementor .elementor-element .zs-events .zs-events__date-col {
    grid-column: 1;
    grid-row: 1 / 5;
    align-self: start;
    width: 100%;
    padding: 14px 8px;
    border: 0;
    border-radius: 10px;
    background: #edf3e9;
    color: var(--zs-primary, #2d5a27);
}
.home .elementor .elementor-element .zs-events .zs-events__date-single,
.home .elementor .elementor-element .zs-events .zs-events__date-part {
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.home .elementor .elementor-element .zs-events .zs-events__date-range {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}
.home .elementor .elementor-element .zs-events .zs-events__month {
    font-size: 19px;
    line-height: 1.1;
    color: var(--zs-primary, #2d5a27);
}
.home .elementor .elementor-element .zs-events .zs-events__day { font-size: 30px; }
.home .elementor .elementor-element .zs-events .zs-events__year { font-size: 12px; }
.home .elementor .elementor-element .zs-events .zs-events__date-note {
    font-size: 10px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.home .elementor .elementor-element .zs-events .zs-events__content { display: contents; }
.home .elementor .elementor-element .zs-events .zs-events__title {
    grid-column: 2;
    grid-row: 1;
    font-size: 26px;
    line-height: 1.15;
    overflow-wrap: break-word;
}
.home .elementor .elementor-element .zs-events .zs-events__meta-col {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    min-width: 0;
    margin: 0;
}
.home .elementor .elementor-element .zs-events .zs-events__location { gap: 6px; }
.home .elementor .elementor-element .zs-events .zs-events__location-text {
    font-size: 13px;
    line-height: 1.5;
    color: #52634f;
}
.home .elementor .elementor-element .zs-events .zs-events__type {
    grid-column: 2;
    grid-row: 3;
    margin: 2px 0 0;
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: 0.08em;
    color: #846022;
}
.home .elementor .elementor-element .zs-events .zs-events__desc {
    grid-column: 2;
    grid-row: 4;
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
}
.home .elementor .elementor-element .zs-events .zs-events__view-all-wrap { margin-top: 28px; }
@media (hover: hover) and (pointer: fine) {
    .home .elementor .elementor-element .zs-events .zs-events__card:hover {
        border-color: rgba(45, 90, 39, 0.3);
        box-shadow: 0 5px 16px rgba(45, 90, 39, 0.06);
    }
}
@media (max-width: 680px) {
    .home .elementor .elementor-element .zs-events .zs-events__header-title {
        font-size: 30px;
        line-height: 1.1;
        max-width: 19ch;
    }
    .home .elementor .elementor-element .zs-events .zs-events__header-desc { font-size: 15px; }
    .home .elementor .elementor-element .zs-events .zs-events__card {
        grid-template-columns: 64px minmax(0, 1fr);
        column-gap: 14px;
        row-gap: 7px;
        padding: 18px 16px;
        border-radius: 12px;
    }
    .home .elementor .elementor-element .zs-events .zs-events__title { font-size: 23px; }
    .home .elementor .elementor-element .zs-events .zs-events__date-col { padding: 12px 5px; }
    .home .elementor .elementor-element .zs-events .zs-events__desc {
        grid-column: 1 / -1;
        padding-top: 5px;
    }
    .home .elementor .elementor-element .zs-events .zs-events__date-col { grid-row: 1 / 4; }
}

/* The homepage also supports a separate Elementor heading above the widget. */
.home .elementor .e-con:has(> .elementor-widget-zamseed-events) {
    row-gap: 20px;
}
.home .elementor .e-con:has(> .elementor-widget-zamseed-events) > .elementor-widget-heading .elementor-heading-title {
    font-size: clamp(30px, 3.33vw, 48px);
    line-height: 1.1;
    max-width: 20ch;
    margin-inline: auto;
}
