/* Avatar News / Newspaper compatible mobile menu. Desktop remains untouched. */
.avatar-mm-toggle,
.avatar-mm-panel,
.avatar-mm-overlay { display: none; }

@media (max-width: 767px) {
    /* Hide Newspaper's own mobile drawer trigger/content only after this plugin is active. */
    body.avatar-mm-plugin-active .td-mobile-container { visibility: hidden; pointer-events: none; }

    .avatar-mm-toggle {
        display: flex; position: fixed; z-index: 999990; right: 14px; top: 12px;
        width: 46px; height: 46px; padding: 0; align-items: center; justify-content: center;
        border: 2px solid #e52e2e; border-radius: 3px; background: #131f49;
        box-shadow: 0 2px 10px rgba(0,0,0,.24); cursor: pointer;
    }
    .avatar-mm-toggle-bars { display: grid; gap: 5px; width: 22px; }
    .avatar-mm-toggle-bars i { display: block; height: 2px; background: #fff; border-radius: 2px; }
    .avatar-mm-overlay { display: block; position: fixed; inset: 0; z-index: 999991; background: rgba(19,31,73,.76); }
    .avatar-mm-panel {
        display: flex; position: fixed; z-index: 999992; inset: 0; width: 100vw; height: 100dvh;
        max-width: none; flex-direction: column; background: #fff; transform: translateX(-102%);
        transition: transform .25s ease; overflow: hidden; visibility: visible;
    }
    .avatar-mm-panel.avatar-mm-open { transform: translateX(0); }
    .avatar-mm-header { display: flex; min-height: 68px; box-sizing: border-box; align-items: center; justify-content: space-between; padding: 14px 18px; background: #131f49; border-bottom: 3px solid #e52e2e; color: #fff; }
    .avatar-mm-brand { color: #fff !important; font-size: 19px; font-weight: 800; letter-spacing: .6px; text-decoration: none !important; }
    .avatar-mm-close { padding: 0 4px; border: 0; color: #fff; background: transparent; font-size: 34px; line-height: 1; cursor: pointer; }
    .avatar-mm-nav { flex: 1; padding: 0 0 34px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .avatar-mm-list { margin: 0; padding: 0; list-style: none; }
    .avatar-mm-list li { margin: 0; border-bottom: 1px solid #e5e7ed; }
    .avatar-mm-list a { display: flex; min-height: 52px; box-sizing: border-box; align-items: center; padding: 14px 21px; color: #131f49; font-size: 16px; font-weight: 700; line-height: 1.35; text-decoration: none; }
    .avatar-mm-list a:hover, .avatar-mm-list a:focus { color: #e52e2e; background: #fff3f3; }
    .avatar-mm-account-list { background: #f7f8fb; }
    .avatar-mm-account-list a { font-size: 16px; }
    .avatar-mm-icon { width: 28px; margin-right: 8px; color: #e52e2e; font-size: 21px; font-weight: 800; text-align: center; }
    .avatar-mm-wordpress-list { border-top: 6px solid #e52e2e; }
    .avatar-mm-wordpress-list .menu-item-has-children > a { padding-right: 55px; }
    .avatar-mm-wordpress-list .sub-menu { display: none; margin: 0; padding: 0; background: #f7f8fb; list-style: none; }
    .avatar-mm-wordpress-list .sub-menu a { padding-left: 45px; font-size: 15px; font-weight: 600; }
    .avatar-mm-wordpress-list .menu-item-has-children.avatar-mm-submenu-open > .sub-menu { display: block; }
    .avatar-mm-wordpress-list .menu-item-has-children > a { position: relative; }
    .avatar-mm-wordpress-list .menu-item-has-children > a::after { content: '+'; position: absolute; right: 21px; color: #e52e2e; font-size: 23px; }
    .avatar-mm-wordpress-list .menu-item-has-children.avatar-mm-submenu-open > a::after { content: '−'; }
    body.avatar-mm-lock { overflow: hidden; }
}

/* Avatar News Modern theme-style sticky bar and News Snap. */
@media (max-width: 767px) {
    .avatar-mm-bottom {
        display: grid; position: fixed; z-index: 999980; right: 0; bottom: 0; left: 0;
        grid-template-columns: repeat(4, 1fr); height: 68px; padding-bottom: env(safe-area-inset-bottom);
        background: #131f49; border-top: 2px solid #e52e2e; box-shadow: 0 -3px 15px rgba(0,0,0,.25);
    }
    .avatar-mm-bottom a { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff !important; font-size: 11px; font-weight: 700; line-height: 1.15; text-decoration: none !important; }
    .avatar-mm-bottom a:hover, .avatar-mm-bottom a:focus { color: #ffd2d2 !important; background: rgba(255,255,255,.08); }
    .avatar-mm-bottom span { color: #fff; font-size: 22px; line-height: 1; }
    .avatar-mm-bottom b { overflow: hidden; max-width: 100%; padding: 0 2px; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
    body.avatar-mm-lock .avatar-mm-bottom { pointer-events: none; opacity: .2; }
    .avatar-mm-snap { display: none; position: fixed; z-index: 999995; inset: 0; width: 100vw; height: 100dvh; background: linear-gradient(180deg,#0b0b0b,#181818); overflow: hidden; visibility: hidden; pointer-events: none; }
    .avatar-mm-snap.avatar-mm-snap-open { display: block; visibility: visible; pointer-events: auto; }
    .avatar-mm-snap-head { display: flex; height: 54px; box-sizing: border-box; align-items: center; justify-content: space-between; padding: 0 15px; background: #131f49; border-bottom: 2px solid #e52e2e; color: #fff; }
    .avatar-mm-snap-head strong { font-size: 18px; font-weight: 800; }
    .avatar-mm-snap-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #e52e2e; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
    .avatar-mm-snap-deck { position: relative; width: 100%; height: calc(100dvh - 54px); overflow: hidden; touch-action: none; }
    .avatar-mm-snap-card { position: absolute; top: 3%; left: 5%; display: flex; width: 90%; height: 92%; max-height: calc(100dvh - 84px); flex-direction: column; overflow: hidden; border-radius: 18px; background: #fff; color: #181818; box-shadow: 0 12px 32px rgba(0,0,0,.45); transform-origin: center; transition: transform .2s ease, opacity .2s ease; }
    .avatar-mm-snap-card.avatar-mm-snap-current { transform: translateY(0) scale(1); }
    .avatar-mm-snap-card.avatar-mm-snap-next { transform: translateY(18px) scale(.965); }
    .avatar-mm-snap-card.avatar-mm-snap-third { transform: translateY(34px) scale(.93); }
    .avatar-mm-snap-card.avatar-mm-snap-out { pointer-events: none; }
    .avatar-mm-snap-image { display: flex; width: 100%; height: 40%; min-height: 180px; align-items: center; justify-content: center; flex: 0 0 auto; overflow: hidden; background: #e9e9e9; color: #131f49; font-size: 22px; font-weight: 900; text-decoration: none; }
    .avatar-mm-snap-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .avatar-mm-snap-body { display: flex; min-height: 0; padding: 13px 15px 14px; flex: 1; flex-direction: column; }
    .avatar-mm-snap-body small { margin-bottom: 5px; color: #777; font-size: 11px; }
    .avatar-mm-snap-body h2 { margin: 0 0 8px; font-size: 20px; font-weight: 900; line-height: 1.3; }
    .avatar-mm-snap-body h2 a { color: inherit; text-decoration: none; }
    .avatar-mm-snap-body p { display: -webkit-box; margin: 0; overflow: hidden; font-size: 14px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 7; }
    .avatar-mm-snap-share { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
    .avatar-mm-snap-share a, .avatar-mm-snap-share button { flex: 1; padding: 10px 4px; border: 0; border-radius: 7px; background: #168b3b; color: #fff; font-size: 11px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
    .avatar-mm-snap-share button { background: #555; }
    .avatar-mm-snap-empty { padding: 30px; color: #fff; text-align: center; }
}
@media (min-width: 768px) { .avatar-mm-bottom, .avatar-mm-snap { display: none !important; } }

/* If Avatar News Modern theme is active, let this plugin be the single mobile controller. */
@media (max-width: 767px) {
    body.avatar-mm-plugin-active .an-mobile-bottom,
    body.avatar-mm-plugin-active .an-mobile-menu,
    body.avatar-mm-plugin-active #an-news-snap,
    body.avatar-mm-plugin-active .an-nav-wrap .an-menu-toggle { display: none !important; }
}

/* Desktop city menu and adjacent quick links. */
@media (min-width: 768px) {
    .avatar-mm-desktop-tools { display: flex; position: fixed; z-index: 999970; top: 220px; right: 22px; align-items: center; gap: 5px; font-family: inherit; }
    .avatar-mm-desktop-tools.avatar-mm-tools-mounted { position: absolute; top: auto; right: 18px; bottom: 7px; }
    .avatar-mm-desktop-tools button { min-height: 34px; border: 1px solid #e52e2e; border-radius: 3px; background: #131f49; color: #fff; font-size: 13px; font-weight: 800; line-height: 1; cursor: pointer; }
    .avatar-mm-city-trigger { padding: 8px 12px; }
    .avatar-mm-quick-trigger { width: 36px; padding: 8px 0; font-size: 18px !important; }
    .avatar-mm-desktop-tools button:hover, .avatar-mm-desktop-tools button[aria-expanded="true"] { background: #e52e2e; }
    .avatar-mm-city-panel, .avatar-mm-quick-panel { position: absolute; top: calc(100% + 7px); right: 0; min-width: 300px; max-width: min(620px, 80vw); padding: 10px; border-top: 3px solid #e52e2e; background: #fff; box-shadow: 0 8px 25px rgba(0,0,0,.28); }
    .avatar-mm-quick-panel { min-width: 240px; max-width: 300px; }
    .avatar-mm-panel-title { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #e5e7ed; color: #131f49; font-size: 14px; font-weight: 900; }
    .avatar-mm-city-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); max-height: 52vh; overflow-y: auto; }
    .avatar-mm-city-grid a, .avatar-mm-quick-panel a { display: block; padding: 8px 9px; border-bottom: 1px solid #edf0f4; color: #131f49 !important; font-size: 13px; font-weight: 700; text-decoration: none !important; }
    .avatar-mm-city-grid a:hover, .avatar-mm-quick-panel a:hover { color: #e52e2e !important; background: #fff3f3; }
    .avatar-mm-quick-panel a { padding: 11px 10px; }
}
@media (max-width: 767px) { .avatar-mm-desktop-tools { display: none !important; } }

.avatar-mm-city-panel[hidden], .avatar-mm-quick-panel[hidden] { display: none !important; }

/* Newspaper correction: never create a fixed fallback button above Subscribe. */
@media (min-width: 768px) {
    .avatar-mm-desktop-tools { display: none !important; }
    .avatar-mm-desktop-tools.avatar-mm-theme-mounted { display: flex !important; position: fixed !important; top: auto !important; right: auto !important; bottom: auto !important; }
    .avatar-mm-desktop-tools.avatar-mm-theme-mounted .avatar-mm-city-trigger { display: none !important; }
    .avatar-mm-desktop-tools.avatar-mm-theme-mounted .avatar-mm-quick-trigger { width: 30px; min-height: 30px; padding: 6px 0; }
}

/* tagDiv Modal Popup integration: content is rendered inside the theme's existing modal. */
.avatar-mm-tagdiv-content { display: none; width: 100%; box-sizing: border-box; padding: 8px 4px 18px; }
.avatar-mm-desktop-tools { display: none !important; }
.avatar-mm-tagdiv-quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid #e4e7ee; }
.avatar-mm-tagdiv-quick-links a { display: inline-block; padding: 9px 16px; border-radius: 3px; background: #131f49; color: #fff !important; font-size: 14px; font-weight: 700; text-decoration: none !important; }
.avatar-mm-tagdiv-quick-links a:hover { background: #e52e2e; }
.avatar-mm-tagdiv-title { margin-bottom: 11px; padding-left: 3px; color: #131f49; font-size: 20px; font-weight: 900; }
.avatar-mm-tagdiv-city-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px; max-height: 58vh; overflow-y: auto; }
.avatar-mm-tagdiv-city-grid a { display: block; padding: 11px 12px; border: 1px solid #e3e6ec; border-left: 3px solid #e52e2e; border-radius: 2px; background: #fff; color: #131f49 !important; font-size: 14px; font-weight: 700; text-decoration: none !important; }
.avatar-mm-tagdiv-city-grid a:hover { background: #fff3f3; color: #e52e2e !important; }
@media (max-width: 767px) {
    .avatar-mm-tagdiv-city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
    .avatar-mm-tagdiv-title { font-size: 18px; }
}

/* The tagDiv wrapper stays display:flex even when visually closed; use its open class. */
.tdm-popup-modal-wrap:not(.tdm-popup-modal-open) .avatar-mm-tagdiv-content { display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.tdm-popup-modal-wrap.tdm-popup-modal-open .avatar-mm-tagdiv-content { display: block !important; visibility: visible !important; opacity: 1 !important; pointer-events: auto !important; }

/* Safety gate: desktop city content exists only while tagDiv's modal is open. */
body:not(.avatar-mm-tagdiv-open) .avatar-mm-tagdiv-content { display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
@media (max-width: 767px) {
    .avatar-mm-tagdiv-content { display: none !important; visibility: hidden !important; pointer-events: none !important; }
}

/* Mobile drawer must overlay the homepage, never push or reflow it. */
@media (max-width: 767px) {
    .avatar-mm-panel { width: min(86vw, 390px) !important; max-width: 390px !important; position: fixed !important; inset: 0 auto 0 0 !important; }
    .avatar-mm-overlay { position: fixed !important; inset: 0 !important; background: rgba(19,31,73,.42) !important; }
    html.avatar-mm-overlay-open, body.avatar-mm-overlay-open { width: 100% !important; max-width: 100% !important; overflow: hidden !important; transform: none !important; }
    body.avatar-mm-overlay-open #td-mobile-nav,
    body.avatar-mm-overlay-open .td-menu-background,
    body.avatar-mm-overlay-open .td-mobile-container { display: none !important; visibility: hidden !important; pointer-events: none !important; }
}
