/* Mobile Styles - Extracted from style.css */

/* Panel Grid (Cards) - Tablet */
@media (max-width: 992px) {
    .fd-panel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Panel Grid (Cards) - Mobile */
@media (max-width: 480px) {

    /* Use single column or tight 2-col on very small screens?
       Let's keep 2-col but adjust gap */
    .fd-panel-grid {
        gap: 12px;
    }

    .fd-card-base.card .body {
        padding: 1rem;
        /* Reduce padding inside cards */
    }

    .fd-card-base.card .title {
        font-size: 1rem;
    }
}

/* Floating Sidebar - Mobile */
@media (max-width: 768px) {

    /* Global variable resets for page-home to kill divider colors */
    .page-template-page-home,
    .front-page {
        --line: transparent;
        --surface: transparent;
        --fd-panel-bg-inner: transparent;
        --fd-panel-bg-outer: transparent;
        --fd-shadow: none;
        --fd-card-border: 0;
        --fd-card-shadow: none;
        --fd-outline: transparent;
    }

    .fd-right-sidebar {
        height: 65px;
        /* Slightly taller for touch */
        padding-bottom: 5px;
        /* Safe area */
        border-radius: 20px 20px 0 0;
    }

    .fd-sidebar-item {
        color: var(--fd-ink-secondary);
    }

    /* Active state indicator on mobile */
    .fd-sidebar-item:active {
        color: var(--fd-accent);
    }
}

/* My Cathedral Header Bar - Mobile */
@media (max-width: 600px) {
    .my-cathedral-header-bar-wrapper {
        gap: 8px;
        font-size: 0.75rem;
        overflow-x: auto;
        /* Allow horizontal scroll if too small */
        justify-content: flex-start;
        padding: 4px 10px;
    }

    .my-cathedral-contact-info {
        display: none;
        /* Hide contacts on small mobile to save vertical space */
    }
}

/* Modal Redesign - Mobile */
@media (max-width: 768px) {
    .my-cathedral-header-bar-wrapper {
        gap: 10px;
        padding: 10px 15px;
    }
}

/* Animated SVG Logo - Mobile */
@media (max-width: 768px) {
    .fd-logo-wrapper {
        display: flex;
        justify-content: center;
        margin-bottom: 1rem;
    }

    .fd-logo-svg {
        max-width: 220px;
        /* Limit width on mobile */
        max-height: 60px;
    }

    .fd-logo-text {
        font-size: 46px;
        stroke-width: 2.4px;
    }

    .fd-logo-flourish {
        display: none;
    }

    .fd-logo-path {
        stroke-width: 3px;
        /* Thicker on mobile for readability */
    }

    /* Align subtext on mobile */
    .fd-logo-subtext {
        text-align: center;
    }

    .fd-logo-wordmark {
        font-size: 24px;
        display: block;
        text-align: center;
        margin-bottom: 0.45rem;
    }

    .fd-logo-wordmark::after {
        bottom: -5px;
        height: 1.5px;
        width: 108%;
    }

    .fd-logo-wordmark::before {
        bottom: -5px;
        width: 38%;
        height: 1.5px;
    }
}

/* ==========================================================================
   Header - Modern Mobile Menu (Fullscreen Slide-In)
   Breakpoint: < 1024px
   ========================================================================== */

@media (max-width: 1023px) {

    .fd-site-header__inner {
        min-height: 54px;
        height: auto;
        padding: 0 14px;
        gap: 8px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .fd-site-header__actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        margin-left: 0;
    }

    .fd-site-header__actions::before,
    .fd-site-header__actions .fd-header-auth,
    .fd-site-header__actions .fd-header-utility--desktop {
        display: none;
    }

    /*
     * Plugin-heavy admin toolbars can wrap the account block onto a second
     * row and cover the site menu button. Keep the account control in the
     * toolbar's first row without changing the public header.
     */
    .admin-bar #wpadminbar #wp-admin-bar-top-secondary {
        position: absolute;
        top: 0;
        right: 0;
    }

    .admin-bar .fd-primary-nav {
        top: 46px;
        height: calc(100dvh - 46px);
        max-height: calc(100dvh - 46px);
    }

    .fd-nav-toggle {
        display: inline-flex;
    }

    .fd-language-picker--desktop {
        display: none;
    }

    .fd-mobile-nav-meta {
        display: block;
        width: calc(100% - 32px);
        margin: 0 auto 18px;
        padding: 56px 0 14px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .fd-language-picker--mobile {
        display: block;
        width: 100%;
        margin: 0 0 12px;
        padding: 0;
        border-bottom: none;
    }

    .fd-language-picker--mobile .fd-language-picker__select {
        width: 100%;
        height: 38px;
        font-size: 0.79rem;
    }

    .fd-mobile-nav-meta__actions {
        display: grid;
        gap: 10px;
    }

    .fd-header-utility--mobile {
        display: block;
    }

    .fd-header-utility--mobile .fd-header-utility__link {
        width: 100%;
        min-height: 40px;
        padding: 0 14px;
        border-color: rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.04);
        color: rgba(255, 255, 255, 0.88);
        font-size: 0.82rem;
    }

    .fd-header-auth--mobile {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
    }

    .fd-header-auth--mobile .fd-header-auth__btn {
        width: 100%;
        min-height: 40px;
        padding: 0 12px;
        justify-content: center;
        font-size: 0.82rem;
    }

    /* Hide desktop menu items */
    .fd-primary-nav:not(.is-open) .fd-primary-menu {
        display: none;
    }

    /* Smaller logo on mobile */
    .fd-site-header__title {
        font-size: 1.04rem;
    }

    /* --- Slide-in Menu Panel --- */
    .fd-primary-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(320px, 84vw);
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(180deg,
                rgba(14, 19, 28, 0.965) 0%,
                rgba(6, 9, 14, 0.975) 100%);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        z-index: var(--fd-z-mobile-nav, 120);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0 0 24px;
        box-shadow: -10px 0 28px rgba(0, 0, 0, 0.28);

        /* Hidden by default */
        transform: translateX(100%);
        opacity: 0.98;
        visibility: hidden;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.22s ease,
            visibility 0s linear 0.26s;
    }

    .fd-primary-nav.is-open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.22s ease,
            visibility 0s linear 0s;
    }

    .fd-primary-nav.is-open .fd-primary-menu {
        display: flex;
    }

    /* Close button in mobile menu */
    .fd-nav-close {
        display: flex;
        align-items: center;
        justify-content: center;
        top: 14px;
        right: 14px;
    }

    /* --- Mobile Menu Items --- */
    .fd-primary-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        overflow-y: auto;
        flex: 0 1 auto;
    }

    .fd-primary-menu>li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .fd-primary-menu>li>a {
        min-height: 44px;
        padding: 0 56px 0 20px;
        font-size: 0.88rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.9);
        border-radius: 0;
        justify-content: flex-start;
    }

    /* Remove underline effect on mobile */
    .fd-primary-menu>li>a::before {
        display: none;
    }

    .fd-primary-menu>li>a:hover,
    .fd-primary-menu>li.current-menu-item>a,
    .fd-primary-menu>li.current-menu-ancestor>a {
        background: rgba(255, 255, 255, 0.09);
        color: var(--fd-nav-accent);
    }

    .fd-primary-menu li.menu-item-has-children {
        position: relative;
    }

    .fd-primary-menu li.menu-item-has-children>a::after {
        display: none;
    }

    .fd-primary-menu .fd-submenu-toggle {
        position: absolute;
        top: 0;
        right: 8px;
        z-index: 2;
        display: inline-flex;
        width: 44px;
        height: 44px;
        padding: 0;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: rgba(255, 255, 255, 0.68);
        cursor: pointer;
    }

    .fd-primary-menu .fd-submenu-toggle::before {
        content: "";
        width: 7px;
        height: 7px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(45deg) translate(-1px, -1px);
        transition: transform 0.2s ease;
    }

    .fd-primary-menu li.is-open>.fd-submenu-toggle::before {
        transform: rotate(-135deg) translate(-1px, -1px);
    }

    .fd-primary-menu .fd-submenu-toggle:hover,
    .fd-primary-menu .fd-submenu-toggle:focus-visible {
        background: rgba(255, 255, 255, 0.1);
        color: var(--fd-nav-accent);
    }

    /* --- Mobile Submenus --- */
    .fd-primary-menu .sub-menu {
        position: static;
        transform: none;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 0;
        border: none;
        box-shadow: none;
        min-width: 100%;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        display: block;
        transition: max-height 0.24s ease;
    }

    .fd-primary-menu .sub-menu::before {
        display: none;
    }

    .fd-primary-menu li.is-open>.sub-menu {
        max-height: 720px;
        transform: none;
    }

    .fd-primary-menu .sub-menu a {
        min-height: 44px;
        padding: 10px 20px 10px 34px;
        display: flex;
        align-items: center;
        color: rgba(255, 255, 255, 0.75);
        font-size: 0.81rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .fd-primary-menu .sub-menu li:hover>a {
        background: rgba(255, 255, 255, 0.06);
        color: var(--fd-nav-accent);
        padding-left: 34px;
    }

    /* --- Mobile Menu Background Overlay --- */
    body.fd-menu-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: var(--fd-z-mobile-overlay, 118);
        animation: fdFadeIn 0.3s ease forwards;
    }

    /* Keep the slide-in nav above the body overlay while the menu is open. */
    body.fd-menu-open .fd-site-header {
        z-index: calc(var(--fd-z-mobile-nav, 120) + 1);
    }

    body.fd-menu-open .fd-primary-nav {
        z-index: calc(var(--fd-z-mobile-nav, 120) + 2);
    }

    body.fd-menu-open .fd-nav-toggle,
    body.fd-menu-open .fd-nav-close {
        z-index: calc(var(--fd-z-mobile-nav, 120) + 3);
    }

    body.fd-menu-open {
        overflow: hidden;
    }

    @keyframes fdFadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .fd-primary-nav,
        .fd-primary-nav.is-open,
        .fd-primary-menu .sub-menu,
        body.fd-menu-open::before {
            transition: none;
            animation: none;
        }
    }
}

/* Small Mobile Adjustments */
@media (max-width: 480px) {
    .fd-site-header__inner {
        padding: 0 12px;
    }

    .fd-site-header__title {
        font-size: 0.98rem;
    }

    .fd-primary-nav {
        width: min(100%, 100vw);
    }
}

/* User Bar - Mobile adjustments */
@media (max-width: 600px) {
    .fd-user-bar {
        padding: 6px 0;
        font-size: 0.85rem;
    }

    .fd-user-bar__greeting {
        font-size: 0.85rem;
    }

    .fd-user-bar__avatar {
        width: 18px;
        height: 18px;
    }
}

/* Minimal Mobile: remove extra lines, borders, and margins */
@media (max-width: 768px) {

    /* Remove decorative lines in section headers */
    .fd-section-header::before,
    .fd-section-header::after {
        display: none;
    }

    /* Top login bar: no border or background lines */
    .fd-top-login-bar {
        border-bottom: none;
        background: transparent;
    }

    .fd-top-login-bar__toggle {
        border: none;
        background: transparent;
        box-shadow: none;
    }

    /* Card base: flatten shadows and outlines on mobile */
    .fd-integrated-home .fd-card-base {
        box-shadow: none;
        border: none;
    }

    /* My Cathedral header: remove subtle separators */
    .my-cathedral-header-bar-wrapper {
        border-bottom: none;
    }

    .my-cathedral-contact-info {
        border-left: none;
        padding-left: 8px;
        /* keep spacing minimal */
    }

    /* Mobile rail pages: no gradient, borders, or shadow */
    .fd-mobile-pages {
        background: none;
    }

    .fd-mobile-page {
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 12px;
        /* tighter padding */
    }

    /* Compress vertical rhythm across homepage sections */
    .fd-homepage-section {
        padding: 8px 0;
    }

    .fd-container {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Page-Home specific trims: remove dividers up to hero/candle */
@media (max-width: 768px) {

    /* Panel container and cards: remove outlines & shadows */
    .page-template-page-home #fd-panel-001 .outer-bg,
    .front-page #fd-panel-001 .outer-bg {
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .page-template-page-home #fd-panel-001 .panel,
    .front-page #fd-panel-001 .panel,
    .page-template-page-home #fd-panel-001 .card,
    .front-page #fd-panel-001 .card {
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .page-template-page-home #fd-panel-001 .head,
    .front-page #fd-panel-001 .head {
        border-bottom: none;
        background: transparent;
    }

    /* Hero background decorative lines: hide for clean mobile */
    .page-template-page-home .fd-hero__background-svg,
    .front-page .fd-hero__background-svg {
        display: none;
    }
}

/* Dashboard Widget - Mobile Full Width */
@media (max-width: 768px) {

    /* Counteract .fd-naver-side padding (14px) to make the widget edge-to-edge */
    .fd-naver-side>.fd-naver-widget-box.full-width-on-mobile,
    .full-width-on-mobile.fd-unified-widget {
        margin-left: -14px;
        margin-right: -14px;
        width: calc(100% + 28px);
        max-width: none;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .full-width-on-mobile .fd-dash-mod__action-item {
        padding: 7px 14px;
        /* Reduced vertical padding */
        border-radius: 0;
    }

    .full-width-on-mobile .fd-dash-mod__action-item--mbj,
    .full-width-on-mobile .fd-dash-mod__action-item--church {
        margin: 10px 12px;
        padding: 14px 14px;
        border-radius: 16px;
        border: 1px solid rgba(47, 41, 36, 0.12);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 20px rgba(30, 24, 20, 0.1);
    }

    .full-width-on-mobile .fd-dash-mod__action-item--mbj .fd-dash-mod__icon-box {
        background: linear-gradient(140deg, #6ee7b7, #059669);
        color: #fff;
        border: none;
        box-shadow: 0 6px 12px rgba(5, 150, 105, 0.25);
    }

    .full-width-on-mobile .fd-dash-mod__action-item--church .fd-dash-mod__icon-box {
        background: linear-gradient(140deg, #93c5fd, #2563eb);
        color: #fff;
        border: none;
        box-shadow: 0 6px 12px rgba(37, 99, 235, 0.25);
    }

    /* Mobile Link Visibility */
    .fd-desktop-link {
        display: none;
    }

    .fd-mobile-link {
        display: inline-flex;
    }
}

/* Global full-width content containers on mobile */
@media (max-width: 768px) {

    html,
    body {
        width: 100%;
        min-height: 100%;
    }

    body {
        margin: 0;
        overflow-x: hidden;
    }

    body,
    input,
    select,
    textarea {
        font-size: 16px;
    }

    body {
        line-height: 1.6;
        text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%;
    }

    h1 {
        font-size: 1.7rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.4rem;
        line-height: 1.25;
    }

    h3 {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    h4 {
        font-size: 1.05rem;
        line-height: 1.35;
    }

    h5 {
        font-size: 1rem;
        line-height: 1.4;
    }

    h6 {
        font-size: 0.95rem;
        line-height: 1.45;
    }

    p,
    ul,
    ol,
    li {
        font-size: 1rem;
        line-height: 1.6;
    }

    body .grid-container,
    body .container.grid-container {
        max-width: 100%;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .site,
    .site-content,
    .content-area,
    .site-main,
    .separate-containers .site-main,
    .one-container .site-content {
        margin: 0;
        padding: 0;
    }

    .separate-containers .inside-article,
    .separate-containers .comments-area,
    .separate-containers .page-header,
    .separate-containers .paging-navigation,
    .contained-content.separate-containers .inside-article,
    .contained-content.one-container .site-content,
    .inside-page-header {
        margin: 0;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .entry-content {
        padding-left: 0;
        padding-right: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {

    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    .button,
    .wp-block-button__link,
    .fd-nav-toggle {
        min-height: 44px;
        min-width: 44px;
    }

    .site-content,
    .content-area,
    .site-main,
    .entry-content {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .entry-content .alignwide,
    .entry-content .alignfull,
    .entry-content .wp-block-group,
    .entry-content .wp-block-cover,
    .entry-content .wp-block-columns,
    .entry-content .wp-block-media-text,
    .entry-content .wp-block-gallery,
    .entry-content .wp-block-image,
    .entry-content .wp-block-embed {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        width: 100%;
    }

    .entry-content .wp-block-group__inner-container,
    .entry-content .wp-block-cover__inner-container,
    .entry-content .wp-block-media-text__content {
        padding-left: 0;
        padding-right: 0;
        max-width: 100%;
    }
}
