/**
 * Nex Directory Free — shared frontend experience layer.
 *
 * This file intentionally sits after the legacy frontend bundle. It provides a
 * compact, consistent finish while older templates are progressively retired.
 */

body.nexdirectory-plugin-page {
    --nexdirectory-canvas: #f6f8fb;
    --nexdirectory-surface: #ffffff;
    --nexdirectory-ink: #111827;
    --nexdirectory-muted: #64748b;
    --nexdirectory-line: #e5eaf1;
    --nexdirectory-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
    --nexdirectory-shadow-md: 0 18px 50px -24px rgba(15, 23, 42, 0.28);
    background: var(--nexdirectory-canvas);
    color: var(--nexdirectory-ink);
}

body.nexdirectory-filter-dialog-open {
    overflow: hidden;
}

.nxd-ui :where(
    a,
    button,
    summary,
    [role="button"],
    [role="tab"]
):focus-visible {
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    outline: 3px solid var(--nexdirectory-focus-ring, #2563eb) !important;
    outline-offset: 2px !important;
}

/*
 * Edge-to-edge controls sit inside intentional overflow containers. Keep their
 * keyboard focus treatment visible by drawing it inward rather than clipping
 * the outer edge.
 */
.nxd-ui :where(
    .nexdirectory-platform-nav-mobile-trigger,
    .nexdirectory-account-subtabs button,
    .nexdirectory-account-mobile-nav button
):focus-visible {
    outline-offset: -3px !important;
}

.nxd-ui .nexdirectory-account-mobile-add:focus-visible {
    outline-color: #ffffff !important;
    outline-offset: -7px !important;
}

@media (forced-colors: active) {
    .nxd-ui :where(
        a,
        button,
        input,
        select,
        textarea,
        summary,
        [role="button"],
        [role="tab"]
    ):focus-visible {
        outline: 2px solid Highlight !important;
        outline-offset: 2px !important;
        box-shadow: none !important;
    }

    .nxd-ui :where(
        .nexdirectory-platform-nav-mobile-trigger,
        .nexdirectory-account-subtabs button,
        .nexdirectory-account-mobile-nav button
    ):focus-visible {
        outline-offset: -3px !important;
    }
}

body.nexdirectory-plugin-page :where(button, [role="button"], input[type="button"], input[type="submit"]) {
    touch-action: manipulation;
}

body.nexdirectory-plugin-page .nexdirectory-platform-nav {
    border-color: rgba(226, 232, 240, 0.86);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

body.nexdirectory-plugin-page .nexdirectory-platform-nav.is-scrolled {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 34px -24px rgba(15, 23, 42, 0.42);
}

.nexdirectory-platform-nav-inner {
    padding-inline: var(--nexdirectory-nav-side-padding-mobile, var(--nexdirectory-page-side-padding-mobile, 2%));
}

@media (max-width: 639px) {
    .nexdirectory-platform-nav-brand {
        flex: 1 1 auto !important;
        max-width: calc(100% - 7.5rem);
        overflow: hidden;
    }

    .nexdirectory-platform-nav-brand img {
        width: auto;
        max-width: 100% !important;
        max-height: 2.5rem;
        object-fit: contain;
    }

    .nexdirectory-platform-nav-brand-text {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 359px) {
    .nexdirectory-platform-nav .nexdirectory-platform-nav-brand-text {
        font-size: 0.95rem !important;
    }
}

.nexdirectory-platform-nav,
.nexdirectory-platform-nav * {
    box-sizing: border-box;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-summary] {
    list-style: none;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-summary]::-webkit-details-marker {
    display: none;
}

.nexdirectory-platform-nav svg {
    display: block;
    flex: 0 0 auto;
    overflow: visible;
    pointer-events: none;
}

.nexdirectory-platform-nav :is(
    [data-nexdirectory-nav-desktop-chevron],
    [data-nexdirectory-nav-mobile-group-chevron],
    .nexdirectory-platform-nav-link svg,
    .nexdirectory-platform-nav-mobile-link svg
) {
    width: 1rem !important;
    height: 1rem !important;
    max-width: 1rem !important;
    max-height: 1rem !important;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-icon-open],
.nexdirectory-platform-nav [data-nexdirectory-nav-icon-close],
.nexdirectory-platform-nav [data-nexdirectory-nav-close] svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-icon-close].hidden,
.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-shell].hidden {
    display: none !important;
}

.nexdirectory-platform-nav .nexdirectory-nav-mobile-shell {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group] {
    transition: background-color 260ms ease, border-color 260ms ease, box-shadow 260ms ease, transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group].is-open {
    background: #fff;
    border-color: rgba(var(--nexdirectory-primary-rgb, 255, 94, 20), 0.25);
    box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group-toggle] {
    transition: color 200ms ease;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group].is-open [data-nexdirectory-nav-mobile-group-toggle] {
    color: var(--nexdirectory-primary, #ff5e14);
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group-panel] {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 340ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease;
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-group].is-open [data-nexdirectory-nav-mobile-group-panel] {
    opacity: 1;
}

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

.nexdirectory-nav-dropdown-anim:not(.hidden) {
    animation: nexdirectoryNavDropdownIn 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nexdirectoryNavItemIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

.nexdirectory-platform-nav [data-nexdirectory-nav-mobile-shell]:not(.hidden) .nexdirectory-mobile-stagger {
    animation: nexdirectoryNavItemIn 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.nexdirectory-platform-nav :is(
    a.nexdirectory-nav-logout-link,
    a.nexdirectory-nav-signup-link
),
.nexdirectory-platform-nav :is(
    a.nexdirectory-nav-logout-link,
    a.nexdirectory-nav-signup-link
):is(:visited, :hover, :focus, :active) {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.nexdirectory-breadcrumb-shell {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem clamp(1rem, 2.4vw, 2rem) 0;
}

.nexdirectory-breadcrumb-shell .nexdirectory-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    max-width: none;
    margin: 0 0 1.5rem;
    padding: 0;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.45;
}

.nexdirectory-breadcrumb-shell .nexdirectory-breadcrumbs a {
    color: #4b5563;
    font-weight: 500;
    text-decoration: none;
    transition: color 200ms ease;
}

.nexdirectory-breadcrumb-shell .nexdirectory-breadcrumbs a:is(:hover, :focus) {
    color: var(--nexdirectory-primary, #f97316);
}

.nexdirectory-breadcrumb-shell .nexdirectory-breadcrumbs .is-current {
    color: #111827;
    font-weight: 600;
}

.nexdirectory-breadcrumb-shell .nexdirectory-breadcrumbs .nexdirectory-breadcrumb-sep {
    margin-inline: 0.2rem;
    color: #9ca3af;
}

body.nexdirectory-plugin-page .nexdirectory-platform-footer {
    display: block !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-inline: calc(50% - 50vw) !important;
}

body.nexdirectory-plugin-page :is(
    #colophon,
    .site-footer,
    footer.site-footer,
    #footer,
    .footer,
    .footer-widgets,
    .site-info,
    .elementor-location-footer,
    .ast-footer-overlay,
    .ast-footer-wrap
) {
    display: none !important;
}

.nexdirectory-platform-footer-inner {
    padding-inline: 1rem;
}

.nexdirectory-platform-footer-menus {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.nexdirectory-platform-footer a {
    color: #374151;
    text-decoration: none;
}

.nexdirectory-platform-footer a:hover {
    color: var(--nexdirectory-primary, #ff5e14);
}

.nexdirectory-platform-footer .nexdirectory-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #4b5563;
    font-size: 0.93rem;
    font-weight: 500;
    line-height: 1.45;
    transition: color 200ms ease;
}

.nexdirectory-platform-footer .nexdirectory-footer-legal-link {
    color: #6b7280;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 200ms ease;
}

.nexdirectory-platform-footer .nexdirectory-footer-col-title {
    margin: 0 0 0.9rem;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .nexdirectory-breadcrumb-shell {
        padding-top: 2rem;
    }
}

@media (min-width: 1024px) {
    .nexdirectory-platform-nav-inner {
        padding-inline: var(--nexdirectory-nav-side-padding-desktop, var(--nexdirectory-page-side-padding, 10%));
    }

    .nexdirectory-platform-footer-inner {
        padding-inline: 1.5rem;
    }

    .nexdirectory-platform-footer-menus {
        grid-template-columns: repeat(var(--nexdirectory-footer-menu-count, 3), minmax(0, 1fr));
        gap: 2rem;
    }
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-card,
    .nexdirectory-archive-event-card,
    .nexdirectory-map-item-card,
    .map-card,
    .nexdirectory-account-card,
    .nexdirectory-account-panel,
    .nexdirectory-form-section
) {
    border-color: var(--nexdirectory-line);
    border-radius: var(--nexdirectory-radius-lg, 16px);
    box-shadow: var(--nexdirectory-shadow-sm);
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-archive-event-card,
    .nexdirectory-map-item-card,
    .map-card
) {
    transform: translateZ(0);
    transition:
        transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 240ms ease,
        border-color 240ms ease;
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-archive-event-card,
    .nexdirectory-map-item-card,
    .map-card
):hover {
    border-color: color-mix(in srgb, var(--nexdirectory-primary, #ff5e14) 22%, var(--nexdirectory-line));
    box-shadow: var(--nexdirectory-shadow-md);
    transform: translateY(-4px);
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-archive-event-card,
    .nexdirectory-map-item-card,
    .map-card
):focus-within {
    border-color: color-mix(in srgb, var(--nexdirectory-primary, #ff5e14) 42%, var(--nexdirectory-line));
    box-shadow: var(--nexdirectory-shadow-md);
}

body.nexdirectory-plugin-page img[data-nexdirectory-hero-parallax="1"] {
    will-change: transform;
    transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1), filter 300ms ease;
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-form,
    .nexdirectory-auth-shell,
    .nexdirectory-account-dashboard,
    .nexdirectory-global-auth-form
) :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: 44px;
    border-color: #dce3ec;
    background-color: #fbfcfe;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

body.nexdirectory-plugin-page :where(
    .nexdirectory-form,
    .nexdirectory-auth-shell,
    .nexdirectory-account-dashboard,
    .nexdirectory-global-auth-form
) :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
    border-color: var(--nexdirectory-primary, #ff5e14);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--nexdirectory-primary, #ff5e14) 12%, transparent);
}

body.nexdirectory-plugin-page .nexdirectory-page-kicker {
    letter-spacing: 0.12em;
}

body.nexdirectory-plugin-page .nexdirectory-pagination {
    gap: 0.5rem;
    margin-top: clamp(2rem, 5vw, 3.5rem);
}

body.nexdirectory-plugin-page .nexdirectory-pagination .page-numbers {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--nexdirectory-line);
    border-radius: 12px;
    background: var(--nexdirectory-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.nexdirectory-plugin-page .nexdirectory-pagination .page-numbers.current {
    border-color: var(--nexdirectory-primary, #ff5e14);
    background: var(--nexdirectory-primary, #ff5e14);
    color: var(--nexdirectory-on-primary, #ffffff);
}

body.nexdirectory-plugin-page .nexdirectory-archive-page aside,
body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper .nexdirectory-map-sidebar {
    border-color: var(--nexdirectory-line);
    box-shadow: var(--nexdirectory-shadow-sm);
}

body.nexdirectory-plugin-page #nexdirectory-events-map {
    background: #e9eef4;
}

body.nexdirectory-plugin-page .nexdirectory-calendar-page .nexdirectory-calendar-cell {
    border-color: var(--nexdirectory-line);
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

body.nexdirectory-plugin-page .nexdirectory-calendar-page .nexdirectory-calendar-cell:hover {
    border-color: color-mix(in srgb, var(--nexdirectory-primary, #ff5e14) 24%, var(--nexdirectory-line));
    background: color-mix(in srgb, var(--nexdirectory-primary, #ff5e14) 3%, #ffffff);
}

body.nexdirectory-plugin-page [role="dialog"] > .nexdirectory-calendar-day-modal,
body.nexdirectory-plugin-page .nexdirectory-global-auth-modal__dialog {
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 32px 80px -20px rgba(15, 23, 42, 0.42);
}

@media (min-width: 1024px) {
    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-layout="three-column"] .nexdirectory-map-results-shell {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
        align-items: start;
    }

    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-layout="three-column"] .nexdirectory-map-results-section #nexdirectory-map-list {
        grid-template-columns: minmax(0, 1fr);
    }

    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-layout="below-list"] .nexdirectory-map-results-section #nexdirectory-map-list {
        grid-template-columns: minmax(0, 1fr);
    }

    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-layout="below-grid-large"] .nexdirectory-map-results-section #nexdirectory-map-list,
    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-layout="grid-no-map-large"] .nexdirectory-map-results-section #nexdirectory-map-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-density="compact"] .nexdirectory-map-results-section .nexdirectory-card-img-wrap {
    height: 9rem;
}

body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-map-density="compact"] .nexdirectory-map-results-section :is(.nexdirectory-card-body, .nexdirectory-event-content) {
    padding: 1rem;
}

@media (max-width: 1023px) {
    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-mobile-filter-mode="inline"] .nexdirectory-map-sticky-shell {
        position: relative;
        inset: auto;
        z-index: 30;
    }

    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-mobile-filter-mode="inline"] .nexdirectory-map-sidebar {
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    body.nexdirectory-plugin-page #nexdirectory-map-default-wrapper[data-nexdirectory-mobile-filter-mode="inline"] .nexdirectory-map-sidebar-scroll {
        padding-bottom: 1.5rem;
    }
}

body.nexdirectory-plugin-page .nexdirectory-account-dashboard > aside {
    border-color: var(--nexdirectory-line);
    box-shadow: 8px 0 30px -28px rgba(15, 23, 42, 0.45);
}

body.nexdirectory-plugin-page .nexdirectory-account-mobile-nav {
    inset-inline: 0;
    width: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

body.nexdirectory-plugin-page .nexdirectory-account-mobile-nav button {
    min-height: 50px;
}

body.nexdirectory-plugin-page .nexdirectory-account-mobile-nav .nexdirectory-account-mobile-add {
    border-radius: 999px !important;
}

@media (max-width: 639px) {
    body.nexdirectory-plugin-page .nexdirectory-listings-subtabs {
        display: flex;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline proximity;
    }

    body.nexdirectory-plugin-page .nexdirectory-listings-subtabs > button {
        flex: 1 0 8rem;
        width: auto;
        min-width: 8rem;
        scroll-snap-align: start;
    }
}

body.nexdirectory-plugin-page form[aria-busy="true"] :where(button[type="submit"], input[type="submit"]) {
    cursor: progress;
    opacity: 0.72;
    pointer-events: none;
}

body.nexdirectory-plugin-page [x-cloak] {
    display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
    body.nexdirectory-plugin-page .nexdirectory-reveal {
        opacity: 0;
        transform: translate3d(0, 14px, 0);
        transition:
            opacity 520ms cubic-bezier(0.22, 1, 0.36, 1) var(--nexdirectory-reveal-delay, 0ms),
            transform 520ms cubic-bezier(0.22, 1, 0.36, 1) var(--nexdirectory-reveal-delay, 0ms);
    }

    body.nexdirectory-plugin-page .nexdirectory-reveal.is-visible {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    body.nexdirectory-plugin-page .nexdirectory-platform-nav {
        transition: background-color 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
    }
}

@media (max-width: 782px) {
    body.nexdirectory-plugin-page :where(
        .nexdirectory-archive-page,
        .nexdirectory-calendar-page,
        #nexdirectory-map-default-wrapper,
        .nexdirectory-account-dashboard
    ) {
        --nexdirectory-mobile-gutter: clamp(1rem, 4vw, 1.25rem);
    }

    body.nexdirectory-plugin-page :where(
        .nexdirectory-form,
        .nexdirectory-auth-shell,
        .nexdirectory-account-dashboard,
        .nexdirectory-global-auth-form
    ) :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
        font-size: 16px;
    }

    body.nexdirectory-plugin-page :where(
        .nexdirectory-archive-event-card,
        .nexdirectory-map-item-card,
        .map-card
    ):hover {
        transform: none;
    }

    body.nexdirectory-plugin-page .nexdirectory-pagination {
        flex-wrap: wrap;
        padding-inline: var(--nexdirectory-mobile-gutter);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.nexdirectory-plugin-page *,
    body.nexdirectory-plugin-page *::before,
    body.nexdirectory-plugin-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body.nexdirectory-plugin-page .nexdirectory-reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}
