/* Phase 1–7 mobile shell — section tabs + bottom nav + light header.
   Desktop (xl+) unchanged. */

:root {
  --mv-shell-green: #0c6b34;
  --mv-shell-green-soft: rgba(12, 107, 52, 0.12);
  --mv-shell-green-pale: rgba(12, 107, 52, 0.1);
  --mv-shell-bottom-h: 4.25rem;
  --mv-shell-header-h: 3.5rem;
  --mv-shell-gutter: 1rem;
  --mv-shell-radius-card: 0.875rem;
  --mv-shell-section-gap: 1rem;
  --mv-shell-icon: 1.25rem;
  --mv-shell-fg: #1f2a24;
  --mv-shell-muted: #5b6b62;
  --mv-shell-border: rgba(31, 42, 36, 0.12);
  --mv-shell-bg: #ffffff;
  --mv-shell-bg-soft: #f7f9f7;
  --mv-shell-shadow: 0 1px 0 rgba(31, 42, 36, 0.08);
  --mv-shell-shadow-soft: 0 4px 16px rgba(31, 42, 36, 0.08);
}

body.mv-mobile-shell-on {
  padding-bottom: calc(var(--mv-shell-bottom-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1280px) {
  body.mv-mobile-shell-on {
    padding-bottom: 0;
  }
}

/* Compact sticky header stack on mobile when redesign is on */
@media (max-width: 1279px) {
  /* Phase 7: white/off-white app header (desktop keeps dark green) */
  body.mv-mobile-shell-on .mv-navbar {
    height: var(--mv-shell-header-h);
    min-height: var(--mv-shell-header-h);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--mv-shell-bg) !important;
    background-image: none !important;
    color: var(--mv-shell-fg) !important;
    border-bottom: 1px solid var(--mv-shell-border) !important;
    box-shadow: var(--mv-shell-shadow) !important;
    backdrop-filter: none;
  }

  body.mv-mobile-shell-on .mv-navbar-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  body.mv-mobile-shell-on .mv-navbar-logo--on-dark,
  body.mv-mobile-shell-on .mv-brand-wordmark-desktop {
    display: none !important;
  }

  body.mv-mobile-shell-on .mv-navbar-logo--on-light {
    display: block;
  }

  body.mv-mobile-shell-on .mv-mobile-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.05;
  }

  body.mv-mobile-shell-on .mv-mobile-brand-text__name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mv-shell-green);
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  /* Protect brand + icons on narrow phones: drop wordmark before squeezing icons */
  @media (max-width: 379px) {
    body.mv-mobile-shell-on .mv-mobile-brand-text {
      display: none;
    }
  }

  /* Phase 5A: legacy burger / account chrome yield to app header + Smart Menu */
  body.mv-mobile-shell-on .mv-shell-hide-mobile,
  body.mv-mobile-shell-on .mv-nav-burger-btn {
    display: none !important;
  }

  body.mv-mobile-shell-on #mv-drawer-side,
  body.mv-mobile-shell-on .drawer-side {
    display: none !important;
  }

  /* Belt-and-suspenders with base.html Tailwind hidden xl:block */
  body.mv-mobile-shell-on footer.mv-site-footer[data-mv-site-footer="1"],
  body.mv-mobile-shell-on footer[data-mv-site-footer-mobile="hidden"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
  }

  body.mv-mobile-shell-on .mv-mobile-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
  }

  body.mv-mobile-shell-on .mv-mobile-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border-radius: 9999px;
    color: var(--mv-shell-green);
    background: transparent;
    border: 0;
    text-decoration: none;
    overflow: hidden;
    transition: background-color 0.15s ease, transform 0.12s ease;
  }

  body.mv-mobile-shell-on .mv-mobile-header-icon:hover,
  body.mv-mobile-shell-on .mv-mobile-header-icon:active {
    background: var(--mv-shell-green-pale);
  }

  body.mv-mobile-shell-on .mv-mobile-header-icon:active {
    transform: scale(0.96);
  }

  body.mv-mobile-shell-on .mv-mobile-header-icon:focus-visible {
    outline: 2px solid var(--mv-shell-green);
    outline-offset: 2px;
  }

  body.mv-mobile-shell-on .mv-mobile-header-icon svg {
    width: var(--mv-shell-icon);
    height: var(--mv-shell-icon);
  }

  /* Ask My-Village mic — navigation only (not Speak to Change / MC) */
  body.mv-mobile-shell-on .mv-mobile-header-stc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border-radius: 9999px;
    text-decoration: none;
    color: var(--mv-shell-green);
    flex-shrink: 0;
  }

  body.mv-mobile-shell-on .mv-mobile-header-stc__circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 9999px;
    background: var(--mv-shell-green-pale);
    border: 1px solid rgba(12, 107, 52, 0.18);
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  }

  body.mv-mobile-shell-on .mv-mobile-header-stc:hover .mv-mobile-header-stc__circle,
  body.mv-mobile-shell-on .mv-mobile-header-stc:focus-visible .mv-mobile-header-stc__circle {
    background: var(--mv-shell-green-soft);
    box-shadow: 0 0 0 2px rgba(12, 107, 52, 0.15);
  }

  body.mv-mobile-shell-on .mv-mobile-header-stc:active .mv-mobile-header-stc__circle {
    transform: scale(0.94);
    background: var(--mv-shell-green-soft);
  }

  body.mv-mobile-shell-on .mv-mobile-header-stc:focus-visible {
    outline: 2px solid var(--mv-shell-green);
    outline-offset: 2px;
  }

  body.mv-mobile-shell-on .mv-mobile-header-stc__mic {
    width: 1.15rem;
    height: 1.15rem;
  }

  body.mv-mobile-shell-on .mv-mobile-header-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    object-fit: cover;
  }

  body.mv-mobile-shell-on .mv-mobile-header-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
  }

  body.mv-mobile-shell-on .mv-mobile-header-auth--login {
    color: var(--mv-shell-green);
    background: var(--mv-shell-bg);
    border: 1px solid var(--mv-shell-border);
  }

  body.mv-mobile-shell-on .mv-mobile-header-auth--signup {
    color: #fff;
    background: var(--mv-shell-green);
    border: 1px solid var(--mv-shell-green);
  }

  @media (prefers-reduced-motion: reduce) {
    body.mv-mobile-shell-on .mv-mobile-header-icon,
    body.mv-mobile-shell-on .mv-mobile-header-stc__circle {
      transition: none;
    }

    body.mv-mobile-shell-on .mv-mobile-header-icon:active,
    body.mv-mobile-shell-on .mv-mobile-header-stc:active .mv-mobile-header-stc__circle {
      transform: none;
    }
  }
}

/* Colour mark hidden until shell + mobile applies (avoids flash on desktop) */
.mv-navbar-logo--on-light,
.mv-mobile-brand-text {
  display: none;
}

.mv-mobile-section-tabs {
  background: var(--mv-shell-bg);
  border-bottom: 1px solid var(--mv-shell-border);
  color: var(--mv-shell-fg);
}

.mv-mobile-section-tabs__scroller {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.35rem 0.75rem 0.15rem;
  scroll-snap-type: x proximity;
}

.mv-mobile-section-tabs__scroller::-webkit-scrollbar {
  display: none;
}

.mv-mobile-section-tabs__tab {
  flex: 1 1 0;
  scroll-snap-align: start;
  padding: 0.55rem 0.35rem;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mv-shell-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-align: center;
}

.mv-mobile-section-tabs__label-short {
  display: none;
}

.mv-mobile-section-tabs__tab.is-active {
  color: var(--mv-shell-green);
  border-bottom-color: var(--mv-shell-green);
}

.mv-mobile-section-tabs__tab:focus-visible {
  outline: 2px solid var(--mv-shell-green);
  outline-offset: 2px;
}

/* Keep all four tabs visible at narrow widths (Clubs clipping fix) */
@media (max-width: 360px) {
  .mv-mobile-section-tabs__scroller {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    gap: 0;
  }

  .mv-mobile-section-tabs__tab {
    padding: 0.5rem 0.2rem;
    font-size: 0.72rem;
  }

  .mv-mobile-section-tabs__label-full {
    display: none;
  }

  .mv-mobile-section-tabs__label-short {
    display: inline;
  }
}

.mv-mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 0.15rem;
  min-height: var(--mv-shell-bottom-h);
  padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: var(--mv-shell-bg);
  border-top: 1px solid var(--mv-shell-border);
  box-shadow: 0 -4px 18px rgba(15, 30, 20, 0.06);
}

.mv-mobile-bottom-nav__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 2.75rem;
  padding: 0.2rem;
  border: 0;
  background: transparent;
  color: var(--mv-shell-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  border-radius: 0.65rem;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.mv-mobile-bottom-nav__item:active {
  background: var(--mv-shell-green-pale);
}

.mv-mobile-bottom-nav__item.is-active {
  color: var(--mv-shell-green);
}

.mv-mobile-bottom-nav__icon {
  width: 1.35rem;
  height: 1.35rem;
}

.mv-mobile-bottom-nav__icon-wrap {
  position: relative;
  display: inline-flex;
}

.mv-mobile-bottom-nav__badge {
  position: absolute;
  top: -0.35rem;
  right: -0.45rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  border-radius: 9999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6rem;
  line-height: 1rem;
  text-align: center;
}

.mv-mobile-bottom-nav__create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 3.15rem;
  height: 3.15rem;
  margin-top: -0.85rem;
  border: 0;
  border-radius: 9999px;
  background: var(--mv-shell-green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(12, 107, 52, 0.28);
  cursor: pointer;
}

.mv-mobile-bottom-nav__create:focus-visible,
.mv-mobile-bottom-nav__item:focus-visible {
  outline: 2px solid var(--mv-shell-green);
  outline-offset: 2px;
}

.mv-mobile-bottom-nav__create-glyph {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
}

.mv-mobile-create-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.mv-mobile-create-sheet[hidden] {
  display: none !important;
}

.mv-mobile-create-sheet.is-open {
  display: block;
}

.mv-mobile-create-sheet__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 20, 14, 0.45);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mv-mobile-create-sheet.is-open .mv-mobile-create-sheet__backdrop {
  opacity: 1;
}

.mv-mobile-create-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(70vh, 28rem);
  overflow: auto;
  padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-radius: 1rem 1rem 0 0;
  background: var(--mv-shell-bg);
  color: var(--mv-shell-fg);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.mv-mobile-create-sheet.is-open .mv-mobile-create-sheet__panel {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .mv-mobile-create-sheet__backdrop,
  .mv-mobile-create-sheet__panel,
  .mv-mobile-bottom-nav__item {
    transition: none;
  }

  .mv-mobile-create-sheet__panel {
    transform: none;
  }
}

.mv-mobile-create-sheet__handle {
  width: 2.5rem;
  height: 0.28rem;
  margin: 0.15rem auto 0.85rem;
  border-radius: 9999px;
  background: rgba(31, 42, 36, 0.18);
}

.mv-mobile-create-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.mv-mobile-create-sheet__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.mv-mobile-create-sheet__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--mv-shell-muted);
  cursor: pointer;
}

.mv-mobile-create-sheet__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.mv-mobile-create-sheet__lead {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--mv-shell-muted);
}

.mv-mobile-create-sheet__context-label {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mv-shell-muted);
}

.mv-mobile-create-sheet__contexts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.mv-mobile-create-sheet__context {
  min-height: 2.4rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--mv-shell-border);
  border-radius: 9999px;
  background: transparent;
  color: var(--mv-shell-fg);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.mv-mobile-create-sheet__context.is-active {
  border-color: var(--mv-shell-green);
  background: var(--mv-shell-green-soft);
  color: var(--mv-shell-green);
}

.mv-mobile-create-sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.mv-mobile-create-sheet__action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-height: 2.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: var(--mv-shell-green-soft);
  color: var(--mv-shell-green);
  text-decoration: none;
  font-weight: 600;
}

.mv-mobile-create-sheet__action-label {
  line-height: 1.25;
}

.mv-mobile-create-sheet__action-desc {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mv-shell-muted);
  line-height: 1.3;
}

.mv-mobile-create-sheet__action--upgrade {
  background: rgba(31, 42, 36, 0.05);
  color: var(--mv-shell-fg);
  border: 1px dashed var(--mv-shell-border);
}

.mv-mobile-create-sheet__cancel {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  min-height: 2.75rem;
  border: 1px solid var(--mv-shell-border);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--mv-shell-muted);
  font-weight: 600;
  cursor: pointer;
}

/* Cookie banner sits above bottom nav when shell is active */
@media (max-width: 1279px) {
  body.mv-mobile-shell-on #cookie-banner.cookie-banner {
    bottom: calc(var(--mv-shell-bottom-h) + env(safe-area-inset-bottom, 0px));
    z-index: 110;
  }
}

/* Phase 5A Smart Menu */
.mv-mobile-smart-menu {
  position: fixed;
  inset: 0;
  z-index: 125;
}

.mv-mobile-smart-menu[hidden] {
  display: none !important;
}

.mv-mobile-smart-menu.is-open {
  display: block;
}

.mv-mobile-smart-menu__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 20, 14, 0.45);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mv-mobile-smart-menu.is-open .mv-mobile-smart-menu__backdrop {
  opacity: 1;
}

.mv-mobile-smart-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(22rem, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--mv-shell-bg);
  color: var(--mv-shell-fg);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.14);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  padding-top: env(safe-area-inset-top, 0px);
}

.mv-mobile-smart-menu.is-open .mv-mobile-smart-menu__panel {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .mv-mobile-smart-menu__backdrop,
  .mv-mobile-smart-menu__panel {
    transition: none;
  }

  .mv-mobile-smart-menu__panel {
    transform: none;
  }
}

.mv-mobile-smart-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--mv-shell-border);
}

.mv-mobile-smart-menu__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.mv-mobile-smart-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--mv-shell-muted);
  cursor: pointer;
}

.mv-mobile-smart-menu__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.mv-mobile-smart-menu__body {
  flex: 1;
  overflow: auto;
  padding: 0.5rem 0 calc(1rem + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.mv-mobile-smart-menu__group {
  padding: 0.65rem 0.85rem 0.35rem;
}

.mv-mobile-smart-menu__group-title {
  margin: 0 0 0.35rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mv-shell-muted);
}

.mv-mobile-smart-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mv-mobile-smart-menu__link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.75rem;
  color: var(--mv-shell-fg);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.mv-mobile-smart-menu__link:hover,
.mv-mobile-smart-menu__link:focus-visible {
  background: var(--mv-shell-green-soft);
  color: var(--mv-shell-green);
  outline: none;
}

.mv-mobile-smart-menu__link--danger {
  color: #b91c1c;
}

.mv-mobile-smart-menu__logout-form {
  margin: 0;
}

.mv-mobile-smart-menu__lang {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0.35rem 0.65rem;
}

.mv-mobile-smart-menu__chip {
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--mv-shell-border);
  background: transparent;
  color: var(--mv-shell-fg);
  font-weight: 600;
  cursor: pointer;
}

.mv-mobile-smart-menu__chip.is-active {
  border-color: var(--mv-shell-green);
  background: var(--mv-shell-green-soft);
  color: var(--mv-shell-green);
}

.mv-mobile-smart-menu__appearance {
  padding: 0.25rem 0.35rem 0.65rem;
}
