/* Six mobile navigation items, including the birthday page. */
.mobile-bottom-nav { display: none; }

@media (max-width: 1024px), (max-width: 1100px) and (max-height: 550px) {
  :root {
    --bottom-nav-height: 70px;
    --bottom-nav-gap: 12px;
    --bottom-nav-inset: max(12px, env(safe-area-inset-bottom, 0px));
    --bottom-nav-phone: calc(var(--bottom-nav-inset) + var(--bottom-nav-height) + var(--bottom-nav-gap));
    --bottom-nav-clearance: calc(var(--bottom-nav-phone) + 56px + 12px);
  }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 33;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: var(--bottom-nav-inset);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: auto;
    max-width: 540px;
    height: var(--bottom-nav-height);
    margin-inline: auto;
    padding: 6px;
    border: 1px solid #ffffffd9;
    border-radius: 32px;
    background: #fffaf0ed;
    box-shadow: 0 8px 32px #183b1b24, 0 2px 6px #6c641e12, inset 0 1px 0 #fff;
    isolation: isolate;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(calc(100% + var(--bottom-nav-inset) + 20px));
    transition: transform 340ms var(--mobile-ease), opacity 220ms ease, visibility 340ms;
  }
  @supports ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
    .mobile-bottom-nav {
      background: linear-gradient(155deg, #fffef7e6, #fff9e8c9);
      -webkit-backdrop-filter: blur(20px) saturate(1.5);
      backdrop-filter: blur(20px) saturate(1.5);
    }
  }
  .mobile-bottom-nav[data-visible="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
  .bottom-nav-link {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 5px 0;
    border-radius: 25px;
    color: #58604e;
    font-size: clamp(9.5px, 2.7vw, 11px);
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
  }
  .bottom-nav-link > .icon { width: 24px; height: 24px; flex: none; }
  .bottom-nav-link[aria-current="page"] {
    color: #287a16;
    background: #d9efb2c9;
    box-shadow: inset 0 1px 0 #ffffffe6;
  }
  .bottom-nav-link:active { transform: scale(.94); background-color: #d9efb2; }
  .bottom-nav-link:focus-visible { outline: 2px solid #398b1a; outline-offset: -2px; }
  .phone-pill { transition: bottom 340ms var(--mobile-ease); }
  .has-bottom-nav .phone-pill { bottom: var(--bottom-nav-phone); }
  body.has-bottom-nav[data-view]:not([data-view="home"]) {
    --panel-bottom: var(--bottom-nav-clearance);
  }
  /* Internal sections precede partner projects in the mobile drawer. */
  .sidebar .navigation { order: 0; }
  .sidebar .drawer-features { order: 1; margin-top: 18px; }
  .sidebar .partners-heading { order: 2; }
  .sidebar .partner-list { order: 3; }
  .sidebar .follow-heading { order: 4; }
  .sidebar .social-links { order: 5; }
  .sidebar .sidebar-note { order: 6; }
  /* Keep the original Hero scenery; reading below it has an unobstructed surface. */
  .reading-mobile-story > .foliage-edges,
  .reading-mobile-story > .foliage-corners,
  .reading-mobile-story > .decorations { visibility: hidden; }
}

@media (max-width: 1100px) and (max-height: 550px) and (orientation: landscape) {
  :root {
    --bottom-nav-height: 60px;
    --bottom-nav-inset: max(8px, env(safe-area-inset-bottom, 0px));
    --bottom-nav-phone: calc(var(--bottom-nav-inset) + 2px);
    --bottom-nav-clearance: calc(var(--bottom-nav-inset) + var(--bottom-nav-height) + 12px);
  }
  /* Use the wider screen to keep the call beside the dock and give the
     section panel more height, instead of stacking two rows of controls. */
  .mobile-bottom-nav { right: max(84px, calc(env(safe-area-inset-right, 0px) + 72px)); }
  .bottom-nav-link { gap: 2px; }
  .bottom-nav-link > .icon { width: 21px; height: 21px; }
}

@media (min-width: 740px) and (max-width: 1100px) and (max-height: 550px) and (orientation: landscape) {
  .bottom-nav-link { flex-direction: row; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-nav, .bottom-nav-link, .has-bottom-nav .phone-pill, .phone-pill { transition: none; }
}
