/*
 * ABIFF Lodge Events — Shortcode Styles
 * Lodge color palette: gold #aa8e4c · black #111827 · white #fff
 * All classes are namespaced .abiff-* — no conflicts with WP core or themes.
 *
 * ── Easy overrides (paste into WordPress Customizer › Additional CSS) ──────
 *
 *   Card title size:
 *   .abiff-card__title { font-size: 1.5rem; }
 *
 *   Gold accent color:
 *   .abiff-card__type, .abiff-event__type,
 *   .abiff-card__detail .abiff-icon, .abiff-event__meta-row .abiff-icon,
 *   .abiff-type-icon { color: #aa8e4c; }
 *   .abiff-register-btn:hover { background: #aa8e4c; }
 *
 *   Grid column count:
 *   .abiff-events__grid { grid-template-columns: repeat(3, 1fr); }
 *
 *   Max width:
 *   .abiff-events__grid { max-width: 860px; }
 */

/* ── Shared ──────────────────────────────────────────────────────────────── */
.abiff-events {
    font-family: inherit;
    line-height: 1.5;
    color: #111827;
}

.abiff-events__heading {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
    color: #111827;
}

.abiff-events__empty,
.abiff-events__error {
    color: #6b7280;
    font-style: italic;
    padding: 1rem 0;
}

/* ── Badge (category pill) ───────────────────────────────────────────────── */
.abiff-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.6;
}
.abiff-badge--blue   { background: #dbeafe; color: #1e40af; }
.abiff-badge--purple { background: #ede9fe; color: #5b21b6; }
.abiff-badge--gold   { background: #fef3c7; color: #92400e; }
.abiff-badge--green  { background: #d1fae5; color: #065f46; }
.abiff-badge--gray   { background: #f3f4f6; color: #374151; }

/* ── Shared icon sizing ──────────────────────────────────────────────────── */
.abiff-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

.abiff-type-icon {
    width: 1.125em;
    height: 1.125em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
    color: #aa8e4c;
}

/* ── Register button (shared across list + cards) ────────────────────────── */
.abiff-register-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    background: #111827;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55em 1.1em;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    line-height: 1.4;
}
.abiff-register-btn:hover,
.abiff-register-btn:focus {
    background: #aa8e4c;
    color: #fff;
    text-decoration: none;
    outline: 2px solid #aa8e4c;
    outline-offset: 2px;
}

/* ── Card grid (mode="cards") ────────────────────────────────────────────── */
.abiff-events__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 640px) {
    .abiff-events__grid {
        grid-template-columns: 1fr;
    }
}

/* ── Single card ─────────────────────────────────────────────────────────── */
.abiff-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.2s, transform 0.15s;
}

.abiff-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.11);
    transform: translateY(-1px);
}

/* Card image */
.abiff-card__img-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111827;
    flex-shrink: 0;
}

.abiff-card__img-wrap--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.abiff-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.abiff-card:hover .abiff-card__img {
    transform: scale(1.04);
}

.abiff-card__img-placeholder {
    color: #c9931a;
    opacity: 0.4;
    font-size: 2rem;
}

/* Card body */
.abiff-card__body {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

/* Event type row */
.abiff-card__type {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #aa8e4c;
    margin-bottom: 0.3rem;
}

/* Title */
.abiff-card__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.6rem;
    line-height: 1.3;
}

/* Date / location detail rows */
.abiff-card__details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.abiff-card__detail {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.abiff-card__detail .abiff-icon {
    color: #aa8e4c;
    margin-top: 0.1em;
    flex-shrink: 0;
}

.abiff-card__detail-sub {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.1em;
}

/* Description (clamped to 4 lines) */
.abiff-card__desc {
    font-size: 0.875rem;
    color: #4b5563;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.abiff-card__desc p { margin: 0 0 0.4em; }
.abiff-card__desc p:last-child { margin: 0; }

/* CTA — pinned to bottom */
.abiff-card__cta {
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ── List mode ───────────────────────────────────────────────────────────── */
.abiff-events__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 760px;
}

/* Single list item */
.abiff-event {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.abiff-event:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

/* List item image — full width banner */
.abiff-event__img-wrap {
    aspect-ratio: 21 / 6;
    overflow: hidden;
    background: #111827;
}

.abiff-event__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
}

/* List item body */
.abiff-event__body {
    padding: 1rem 1.25rem 1.25rem;
}

.abiff-event__type {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #aa8e4c;
    margin-bottom: 0.35rem;
}

.abiff-event__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.abiff-event__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.abiff-event__meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 0.6rem;
}

.abiff-event__meta-row {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.abiff-event__meta-row .abiff-icon {
    color: #aa8e4c;
    margin-top: 0.1em;
    flex-shrink: 0;
}

.abiff-event__meta-sub {
    font-size: 0.78rem;
    color: #6b7280;
    display: block;
}

.abiff-event__desc {
    font-size: 0.875rem;
    color: #4b5563;
    margin: 0.5rem 0 0.75rem;
}

.abiff-event__desc p { margin: 0 0 0.4em; }
.abiff-event__desc p:last-child { margin: 0; }

@media (max-width: 480px) {
    .abiff-event__header {
        flex-direction: column;
    }
}

/* ── Modal overlay ───────────────────────────────────────────────────────── */
#abiff-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#abiff-modal[aria-hidden="false"] {
    display: flex;
}

.abiff-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    animation: abiffFadeIn 0.2s ease;
}

.abiff-modal__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 980px;
    height: 92vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    animation: abiffSlideUp 0.25s ease;
}

/* Header bar — houses the close button, keeps it off the form content */
.abiff-modal__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.55rem 0.75rem 0.55rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    min-height: 48px;
}

.abiff-modal__close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.abiff-modal__close:hover {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

#abiff-modal-frame {
    width: 100%;
    flex: 1;
    border: none;
    display: block;
    background: #fff;
    min-height: 0; /* prevents flex overflow on some browsers */
}

/* Prevent body scroll when modal is open */
body.abiff-modal-open {
    overflow: hidden;
}

@keyframes abiffFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes abiffSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .abiff-modal__box {
        height: 95vh;
        border-radius: 10px 10px 0 0;
        align-self: flex-end;
        margin: 0 -1rem -1rem;
        width: calc(100% + 2rem);
        max-width: none;
        animation: abiffSlideUpMobile 0.25s ease;
    }
    @keyframes abiffSlideUpMobile {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0);    }
    }
}
