/* Mobile app navigation. Desktop navigation keeps its existing layout. */
:root { --app-nav-height: calc(76px + env(safe-area-inset-bottom, 0px)); }
.app-nav, .app-menu { display: none; }

@media (max-width: 1080px) {
  html { scroll-padding-bottom: calc(var(--app-nav-height) + 20px); }
  body {
    padding-bottom: calc(var(--app-nav-height) + 16px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .app-nav-ready .nav-toggle, .app-nav-ready .main-nav { display: none !important; }
  .app-nav-ready .header-inner { flex-wrap: nowrap; }
  .app-nav-ready .header-inner > .brand { flex: 1 1 auto; min-width: 0; max-width: 300px; }
  .app-nav {
    display: block;
    position: fixed;
    z-index: 60;
    inset: auto 0 0;
    padding: 7px max(10px, env(safe-area-inset-right, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    border-top: 1px solid #c6d5bf;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -7px 30px #243b3712;
  }
  .app-nav-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    max-width: 720px;
    margin-inline: auto;
  }
  .app-nav-ready .app-nav-inner { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 60px;
    min-width: 0;
    padding: 7px 3px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #5d6c62;
    text-align: center;
    text-decoration: none;
    font: 700 .66rem/1.25 var(--sans);
    overflow-wrap: anywhere;
    transition: background .18s, color .18s;
  }
  .app-nav-item svg { flex-shrink: 0; width: 23px; height: 23px; stroke-width: 1.8; }
  .app-nav-item > span { max-width: 100%; }
  .app-nav-item[aria-current], .app-nav-item.is-current { background: var(--sage); color: var(--green); }
  .app-nav-item:hover { color: var(--green); background: var(--sage-pale); }
  .app-nav-item[aria-expanded="true"] { background: var(--yellow); color: var(--ink); }
  .app-nav-item:focus-visible { outline-offset: -3px; }
  .app-nav-more { display: none; }
  .app-nav-ready .app-nav-more { display: flex; }
  .app-menu {
    position: fixed;
    inset: auto 0 calc(var(--app-nav-height) + 12px);
    width: min(560px, calc(100% - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    max-height: calc(100dvh - var(--app-nav-height) - 36px - env(safe-area-inset-top, 0px));
    margin: 0 auto;
    padding: 22px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #c6d5bf;
    border-radius: 23px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 15px 60px #243b3733;
  }
  .app-menu[open] { display: block; animation: app-menu-enter .2s ease-out both; }
  .app-menu::backdrop { background: #142e27a6; }
  .app-menu-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
  .app-menu-heading h2 { font-size: 1.65rem; }
  .app-menu-close { min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--sage-pale); color: var(--green); font-size: .8rem; }
  .app-menu-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .app-menu-links a { display: flex; align-items: center; min-height: 52px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-size: .85rem; font-weight: 700; line-height: 1.4; }
  .app-menu-links a[aria-current] { background: var(--green); border-color: var(--green); color: #fff; }
  .app-menu-links a:hover { background: var(--sage); color: var(--ink); }
  .app-menu-legal { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
  .app-menu-legal a, .app-menu-legal button { display: inline-flex; align-items: center; min-height: 44px; padding: 7px 0; border: 0; background: transparent; color: var(--muted); font-size: .74rem; line-height: 1.5; text-align: left; text-decoration: underline; }
  .app-menu-open { overflow: hidden; }
  .motion-paused .app-menu[open] { animation: none !important; }
  #tcf-consent { bottom: calc(var(--app-nav-height) + 12px); max-height: calc(100dvh - var(--app-nav-height) - 24px); overflow: auto; }
  .field input, .field textarea, .field select { scroll-margin-bottom: calc(var(--app-nav-height) + 24px); }
}
@media (max-width: 360px) {
  .app-nav { padding-left: max(7px, env(safe-area-inset-left, 0px)); padding-right: max(7px, env(safe-area-inset-right, 0px)); }
  .app-nav-inner { gap: 2px; }
  .app-nav-item { font-size: .62rem; }
  .app-menu { padding: 18px; }
  .app-menu-links a { padding: 10px; font-size: .78rem; }
}
@keyframes app-menu-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .app-menu[open] { animation: none; } }
@media print { .app-nav, .app-menu { display: none !important; } body { padding-bottom: 0 !important; } }
