/* Mobile shell v3: independent phone navigation, aligned to the Piper Apologetics brand. */
.mobile-app-header,
.mobile-app-drawer,
.mobile-app-scrim,
.mobile-bottom-nav { display: none; }

@media (max-width: 720px) {
  html {
    scroll-padding-top: calc(80px + env(safe-area-inset-top));
    scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  body.mobile-shell-v3 {
    padding-top: calc(76px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
  }

  body.mobile-shell-v3 .site-header {
    display: none !important;
  }

  body.mobile-shell-v3 .site-shell {
    padding-bottom: 0 !important;
  }

  /* Branded phone masthead: same dark/bronze identity as Piper Apologetics. */
  .mobile-app-header {
    display: flex;
    align-items: center;
    position: fixed;
    z-index: 1000;
    left: 0;
    right: 0;
    top: 0;
    min-height: calc(76px + env(safe-area-inset-top));
    padding: calc(11px + env(safe-area-inset-top)) 16px 11px;
    border-bottom: 1px solid rgba(154,128,90,.42);
    background: rgba(13,13,12,.985);
    box-shadow: 0 4px 16px rgba(0,0,0,.14);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #eee9df;
    text-align: left;
  }

  .mobile-brand-mark {
    position: relative;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(238,233,223,.18);
    border-radius: 50%;
    background-color: #191815;
    background-size: cover;
    background-position: center;
    color: #bca57f;
    box-shadow: 0 5px 15px rgba(0,0,0,.22);
  }

  .mobile-brand-mark > span {
    font-family: 'Cinzel', Georgia, serif;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .06em;
  }

  .mobile-brand-mark.has-brand-icon > span { display: none; }

  .mobile-brand-copy {
    display: block;
    min-width: 0;
  }

  .mobile-brand-copy strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eee9df;
    font-family: 'Cinzel', Georgia, serif;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .105em;
    line-height: 1.05;
    text-transform: uppercase;
  }

  .mobile-brand-copy > span {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #bca98b;
    font-family: 'Cinzel', Georgia, serif;
    font-size: .49rem;
    font-weight: 500;
    letter-spacing: .07em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .mobile-app-scrim {
    display: block;
    position: fixed;
    z-index: 1010;
    inset: 0;
    background: rgba(8,8,7,.54);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-app-scrim[hidden] { display: none !important; }

  /* Secondary menu uses the same dark visual language as the masthead/tab bar. */
  .mobile-app-drawer {
    display: block;
    position: fixed;
    z-index: 1020;
    left: 10px;
    right: 10px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    max-height: min(58dvh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 9px;
    border: 1px solid rgba(154,128,90,.48);
    border-radius: 16px 16px 10px 10px;
    background: #171715;
    box-shadow: 0 18px 48px rgba(0,0,0,.38);
  }

  .mobile-app-drawer[hidden] { display: none !important; }

  .mobile-app-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 8px 10px;
    border-bottom: 1px solid #413b33;
  }

  .mobile-app-drawer-head strong {
    color: #eee9df;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
  }

  .mobile-app-drawer-head span {
    display: block;
    margin-top: 2px;
    color: #aaa39a;
    font-size: .63rem;
  }

  .mobile-app-drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding-top: 9px;
  }

  .mobile-app-drawer-item {
    min-width: 0;
    min-height: 68px;
    padding: 11px 12px;
    border: 1px solid #413b33;
    border-radius: 12px;
    background: #1d1c19;
    color: #eee9df;
    font: inherit;
    text-align: left;
  }

  .mobile-app-drawer-item strong {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
  }

  .mobile-app-drawer-item span {
    display: block;
    margin-top: 4px;
    color: #aaa39a;
    font-size: .61rem;
    line-height: 1.3;
  }

  .mobile-app-drawer-item.active {
    border-color: #a58d68;
    background: rgba(154,128,90,.17);
    color: #fffaf1;
  }

  /* True app-style bottom tab bar: flush, dark, and visually continuous with the brand. */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    align-items: stretch;
    gap: 0;
    position: fixed;
    z-index: 1030;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid rgba(154,128,90,.54);
    border-radius: 0;
    background: rgba(13,13,12,.985);
    box-shadow: 0 -4px 16px rgba(0,0,0,.22);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-bottom-nav button {
    position: relative;
    min-width: 0;
    min-height: 48px;
    padding: 9px 2px 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #c9c1b6;
    font-family: 'Cinzel', Georgia, serif;
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: .025em;
    line-height: 1.05;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-bottom-nav button.active {
    background: transparent;
    color: #e3cba5;
  }

  .mobile-bottom-nav button.active::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 1px;
    width: 26px;
    height: 2px;
    transform: translateX(-50%);
    border-radius: 99px;
    background: #a98e63;
  }

  .mobile-bottom-nav button.active::after { display: none; }

  body.mobile-shell-v3 > .mobile-nav-scrim,
  body.mobile-shell-v3 > .mobile-header-menu-button {
    display: none !important;
  }

  main, .screen, .site-shell { max-width: 100%; overflow-x: clip; }
}

@media (max-width: 380px) {
  .mobile-app-header { padding-left: 12px; padding-right: 12px; }
  .mobile-brand-mark { flex-basis: 38px; width: 38px; height: 38px; }
  .mobile-brand-copy strong { font-size: .75rem; }
  .mobile-brand-copy > span { font-size: .44rem; }
  .mobile-app-drawer-grid { grid-template-columns: 1fr; }
  .mobile-app-drawer-item { min-height: 58px; }
  .mobile-bottom-nav { padding-left: 3px; padding-right: 3px; }
  .mobile-bottom-nav button { font-size: .54rem; }
}
